I have the same doubt.
Apple's documentation is always like this, only writing APIs, without detailed explanations and examples.
Post
Replies
Boosts
Views
Activity
MLModelCollection.beginAccessing(identifier: "Collection Name") { result in
var modelURL: URL?
switch result {
case .success(let collection):
print(collection)
modelURL = collection.entries["io.aben.animegan2face.v1"]?.modelURL
case .failure(let error):
print(error)
}
print(modelURL as Any)
}
Got failure error:
MLModelCollection: namespace (animegan2face_paint_512_v2) registration failed. Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.triald.namespace-management was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.triald.namespace-management was invalidated: failed at lookup with error 159 - Sandbox restriction.}
Error Domain=com.apple.CoreML Code=10 "Failed to begin access for model collection with identifier 'animegan2face_paint_512_v2': invalid identifier" UserInfo={NSLocalizedDescription=Failed to begin access for model collection with identifier 'animegan2face_paint_512_v2': invalid identifier}
nil
Same issue here
I'm getting exactly the same issue!!! @Apple
Come on Apple Devs!
I have the same question.
I have the same question too.
Still experienced this issue after upgrading to Xcode 12.4!!!!!!!!!!!!!!!!!!!!!!
2021 is coming...
Me too.
Only swift package preview can not run code with "requestAuthorization"...
So I need a xcode project target.
WWDC20 did it!
let containerIdentifier = persistentStoreDescriptions.cloudKitContainerOptions!.containerIdentifier
persistentStoreDescriptions.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: containerIdentifier)
persistentStoreDescriptions.cloudKitContainerOptions?.databaseScope = .public
But, when could we really using it in apps?
https://github.com/rushairer/ScreenshotableView
My made a 'ScreenshotableView' to fix this issue
There is is still no way of deleting iCloud containers! 2020-07-16
Lucky, I found a way to take screenshot in scrollview
...
struct ColorGroupView: View {
var colors: [UIColor]
@State var coverImage: UIImage
var body: some View {
let content =
VStack {
ForEach(1...50, id: \.self) { i in
Text("Hello \(i)")
.frame(maxWidth: .infinity, minHeight: 60)
}
}
return GeometryReader { geometry in
VStack(spacing: 0) {
ScrollView {
content
}
ScrollView {
Image(uiImage: self.coverImage)
.frame(maxWidth: .infinity, minHeight: 60)
}
HStack{
Button("Button") {
let screenshot = content.takeScreenshot(origin: geometry.frame(in: .global).origin, size: geometry.size)
self.coverImage = screenshot
}
}
.padding()
.padding(.bottom, geometry.safeAreaInsets.bottom)
.frame(maxWidth: .infinity)
.background(VisualEffectBlur())
}
.edgesIgnoringSafeArea(.bottom)
}
}
}
extension View {
func takeScreenshot(origin: CGPoint, size: CGSize) -> UIImage {
let window = UIWindow(frame: CGRect(origin: origin, size: size))
let hosting = UIHostingController(rootView: self)
hosting.view.sizeToFit()
window.height = hosting.view.frame.size.height > 0 ? hosting.view.frame.size.height : window.height
window.width = hosting.view.frame.size.height > 0 ? hosting.view.frame.size.height : window.width
window.rootViewController = hosting
window.makeKeyAndVisible()
return window.snapshotImage()!
}
}
...
extension UIView {
func height ...
func width ...
func snapshotImage ...
Could you share your code?
How to take a screenshot of List in a ScrollView of SwiftUI?