I have tried many times. When I change the file or re-create it, it shows 404 error
{
"code": 400,
"message": "InvalidArgumentError: Unable to unzip MLArchive",
"reason": "There was a problem with your request.",
"detailedMessage": "InvalidArgumentError: Unable to unzip MLArchive",
"requestUuid": "699afb97-8328-4a83-b186-851f797942aa"
}
Post
Replies
Boosts
Views
Activity
import SwiftUI
struct CIFilterDemoView: View {
let monalisa: UIImage = UIImage(named: "monalisa")!
@State var filtedImage: CGImage?
func testEVFilter() {
guard let rawFilter = CIRAWFilter(imageData: monalisa.pngData()) else { return }
rawFilter.setValue(3, forKey: kCIInputEVKey)
guard let image = rawFilter.outputImage else { return }
guard let cgImage = CIContext().createCGImage(image, from: image.extent) else { return }
self.filtedImage = cgImage
}
func testMatte() {
guard let rawFilter = CIRAWFilter(imageData: monalisa.pngData()) else { return }
guard let hairImage = rawFilter.semanticSegmentationHairMatte else { return }
guard let cgImage = CIContext().createCGImage(hairImage, from: hairImage.extent) else { return }
self.filtedImage = cgImage
}
var body: some View {
List {
Image(uiImage: monalisa)
HStack {
Button {
testEVFilter()
} label: {
Text("Test EV")
}
.buttonStyle(.borderedProminent)
Button {
testMatte()
} label: {
Text("Test Matte")
}
.buttonStyle(.borderedProminent)
}
if let filtedImage, let uiImage = UIImage(cgImage: filtedImage) {
Image(uiImage: uiImage)
.background(Color.red)
}
}
}
}
struct CIFilterDemoView_Previews: PreviewProvider {
static var previews: some View {
CIFilterDemoView()
}
}
When I run testMatte() get this error log:
2023-01-26 19:42:45.682098+0800 DemoApp[28473:1085301] -[CIRAWFilterImpl semanticSegmentationHairMatte]: unrecognized selector sent to instance 0x7ff0a8740130
2023-01-26 19:42:45.682583+0800 DemoApp[28473:1085301] [General] -[CIRAWFilterImpl semanticSegmentationHairMatte]: unrecognized selector sent to instance 0x7ff0a8740130
2023-01-26 19:42:45.688117+0800 DemoApp[28473:1085301] [General] (
0 CoreFoundation 0x00007ff80ca8d3eb __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff80c5d9e25 objc_exception_throw + 48
2 CoreFoundation 0x00007ff80cb2452b -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00007ff80c9f762b ___forwarding___ + 1324
4 CoreFoundation 0x00007ff80c9f7068 _CF_forwarding_prep_0 + 120
5 DemoApp 0x00000001016584af $s7DemoApp08CIFilterA4ViewV9testMatteyyF + 527
6 DemoApp 0x00000001016598c8 $s7DemoApp08CIFilterA4ViewV4bodyQrvg7SwiftUI05TupleD0VyAE5ImageV_AE6HStackVyAGyAE0D0PAEE11buttonStyleyQrqd__AE015PrimitiveButtonL0Rd__lFQOyAE0N0VyAE4TextVG_AE017BorderedProminentnL0VQo__AWtGGAmEE10background_20ignoresSafeAreaEdgesQrqd___AE4EdgeO3SetVtAE05ShapeL0Rd__lFQOyAI_AE5ColorVQo_SgtGyXEfU_AXyXEfU_yycfU1_ + 40
7 SwiftUI 0x00007ffa0e439df8 __swift_memcpy160_4 + 111106
8 SwiftUI 0x00007ffa0e43a799 __swift_memcpy160_4 + 113571
9 SwiftUI 0x00007ffa0e43a70b __swift_memcpy160_4 + 113429
10 SwiftUI 0x00007ffa0ec1c9d7 __swift_memcpy36_4 + 41329
11 SwiftUI 0x00007ffa0e84b8e4 objectdestroy.142Tm + 42261
12 SwiftUI 0x00007ffa0e84b8f8 objectdestroy.142Tm + 42281
13 SwiftUI 0x00007ffa0e84b8e4 objectdestroy.142Tm + 42261
14 SwiftUI 0x00007ffa0e57a829 block_destroy_helper.15 + 49718
15 SwiftUI 0x00007ffa0e57a18c block_destroy_helper.15 + 48025
16 SwiftUI 0x00007ffa0e6eb2d4 _callVisitToolbarContentType2 + 4283
17 SwiftUI 0x00007ffa0eeffd7d _callVisitStyleContextType2 + 11403
18 SwiftUI 0x00007ffa0eefe3f6 _callVisitStyleContextType2 + 4868
19 SwiftUI 0x00007ffa0eefe4da _callVisitStyleContextType2 + 5096
20 SwiftUI 0x00007ffa0eefdccd _callVisitStyleContextType2 + 3035
21 UIKitCore 0x00007ff9182ce09a -[UIGestureRecognizer _componentsEnded:withEvent:] + 162
22 UIKitCore 0x00007ff917b91620 -[UITouchesEvent _sendEventToGestureRecognizer:] + 776
23 UIKitCore 0x00007ff917b73c1e -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 247
24 UIKitCore 0x00007ff917b73655 -[UIGestureEnvironment _updateForEvent:window:] + 188
25 UIKitCore 0x00007ff917b7333f -[UIWindow sendEvent:] + 5301
26 UIKitCore 0x00007ff917b7131c -[UIApplication sendEvent:] + 984
27 UIKit 0x00007ffb2c015b78 -[UIApplicationAccessibility sendEvent:] + 85
28 UIKitCore 0x00007ff917b6f145 __dispatchPreprocessedEventFromEventQueue + 10186
29 UIKitCore 0x00007ff91883f061 __processEventQueue + 8273
30 UIKitCore 0x00007ff918837724 __eventFetcherSourceCallback + 249
31 CoreFoundation 0x00007ff80ca14b78 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
32 CoreFoundation 0x00007ff80ca14b27 __CFRunLoopDoSource0 + 157
33 CoreFoundation 0x00007ff80ca14901 __CFRunLoopDoSources0 + 212
34 CoreFoundation 0x00007ff80ca1357b __CFRunLoopRun + 929
35 CoreFoundation 0x00007ff80ca12b60 CFRunLoopRunSpecific + 560
36 HIToolbox 0x00007ff816367766 RunCurrentEventLoopInMode + 292
37 HIToolbox 0x00007ff816367576 ReceiveNextEventCommon + 679
38 HIToolbox 0x00007ff8163672b3 _BlockUntilNextEventMatchingListInModeWithFilter + 70
39 AppKit 0x00007ff80fb63233 _DPSNextEvent + 909
40 AppKit 0x00007ff80fb620b4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1219
41 AppKit 0x00007ff80fb546f7 -[NSApplication run] + 586
42 AppKit 0x00007ff80fb28727 NSApplicationMain + 817
43 AppKit 0x00007ff80fde9856 _NSApplicationMainWithInfoDictionary + 16
44 UIKitMacHelper 0x00007ff823ab35d3 UINSApplicationMain + 1413
45 UIKitCore 0x00007ff9178df688 UIApplicationMain + 144
46 SwiftUI 0x00007ffa0eeb7787 __swift_memcpy93_8 + 11978
47 SwiftUI 0x00007ffa0eeb7632 __swift_memcpy93_8 + 11637
48 SwiftUI 0x00007ffa0e52aedf __swift_memcpy195_8 + 12258
49 DemoApp 0x0000000101656cee $s7DemoApp0abB0V5$mainyyFZ + 30
50 DemoApp 0x0000000101656df9 main + 9
51 dyld 0x00007ff80c606310 start + 2432
)
ShareLink(
item: Image(systemName: "star"),
subject: Text("Sharing an icon with you"),
message: Text("This icon is made by the IconShop app"),
preview: SharePreview("Icon", image: Image(systemName: "star")))
{
HStack {
Text("Share Image")
Spacer()
Image(systemName: "square.and.arrow.up")
}
}
At "Mac Catalyst" env, will get the log:
2023-01-21 11:16:39.469261+0800 IconShop[67164:10060637] [ShareSheet] Only support loading options for CKShare and SWY types.
2023-01-21 11:16:39.469577+0800 IconShop[67164:10060637] [ShareSheet] error fetching item for URL:file:///var/folders/tr/rw5_yr292bd7zvwhr83skzvc0000gn/T/io.aben.IconShop/.com.apple.uikit.itemprovider.temporary.zkrp0q/PNG%20image.png : (null)
2023-01-21 11:16:39.472151+0800 IconShop[67164:10060637] [ShareSheet] error fetching file provider domain for URL:file:///var/folders/tr/rw5_yr292bd7zvwhr83skzvc0000gn/T/io.aben.IconShop/.com.apple.uikit.itemprovider.temporary.zkrp0q/PNG%20image.png : (null)
2023-01-21 11:16:39.472951+0800 IconShop[67164:10060901] [ShareSheet] error loading metadata for documentURL:file:///var/folders/tr/rw5_yr292bd7zvwhr83skzvc0000gn/T/io.aben.IconShop/.com.apple.uikit.itemprovider.temporary.zkrp0q/PNG%20image.png error:Error Domain=NSFileProviderInternalErrorDomain Code=0 "No valid file provider found from URL file:///var/folders/tr/rw5_yr292bd7zvwhr83skzvc0000gn/T/io.aben.IconShop/.com.apple.uikit.itemprovider.temporary.zkrp0q/PNG%20image.png." UserInfo={NSLocalizedDescription=No valid file provider found from URL file:///var/folders/tr/rw5_yr292bd7zvwhr83skzvc0000gn/T/io.aben.IconShop/.com.apple.uikit.itemprovider.temporary.zkrp0q/PNG%20image.png.}
2023-01-21 11:16:41.884666+0800 IconShop[67164:10060637] [NSExtension] Extension request contains input items but the extension point does not specify a set of allowed payload classes. The extension point's NSExtensionContext subclass must implement `+_allowedItemPayloadClasses`. This must return the set of allowed NSExtensionItem payload classes. In future, this request will fail with an error.
2023-01-21 11:16:42.286195+0800 IconShop[67164:10060899] [ShareSheet] Connection invalidated
So I can not find "save to file" , "Shart to PhotoLibary" button in the share menu.
最近使用service id 进行 sign in with apple 网页开发,总是提示 Invalid client. 我反复多次按照文档重新建立service id 和 app id 还有 key,最终还是 Invalid client.这个问题已经超过24小时了,跟网上传说的24小时后生效应该没关系。
我删除掉了之前可以正常使用的service id,发现它现在还可以登录,所以是不是苹果的服务器缓存有问题?已经过去好几个小时了。
Recently, when using the service ID to sign in with apple web page development, the Invalid client is always prompted I have repeatedly recreated the service id, app id and key according to the document, and finally the invalid client. This problem has lasted for more than 24 hours. It should have nothing to do with the online legend that the service id, app id and key will take effect 24 hours later.
I deleted the service ID that can be used normally before and found that it can still be logged in. Is there a problem with the Apple server cache? It has been several hours.
How to add a "Space" item at the toolbar with SwiftUI for macOS?
struct EditorView: View {
@ToolbarContentBuilder
func toolBarContent() -> some CustomizableToolbarContent {
ToolbarItem(id: "toggle", placement: .navigation) {
Button {
NSApp.keyWindow?
.contentViewController?
.tryToPerform(#selector(NSSplitViewController.toggleSidebar(_:)),
with: nil)
} label: {
Label("Toggle Libary", systemImage: "sidebar.left")
.accessibilityLabel("Toggle Libary")
.help("Toggle Libary")
}
}
ToolbarItem(id: "sfsymbols", placement: .automatic) {
Button {
print("")
} label: {
Label("SF Symbols", systemImage: "star.square.on.square.fill")
.accessibilityLabel("SF Symbols")
.help("SF Symbols")
}
}
.defaultCustomization(.hidden)
ToolbarItem(id: "flexibleSpace", placement: .automatic) {
Spacer()
}
.defaultCustomization(.hidden)
ToolbarItem(id: "save", placement: .automatic) {
Button {
print("")
} label: {
Label("Save", systemImage: "square.and.arrow.down")
.accessibilityLabel("Save")
.help("Save")
}
}
}
var body: some View {
ZStack {
CanvasView()
}
.toolbar(id: "main") {
toolBarContent()
}
}
}
I use CustomizableToolbarContent like above code.
Spacer() will get a "FlexibleSpace" item of the toolbar.
ToolbarItem(id: "flexibleSpace", placement: .automatic) {
Spacer()
}
How can I get a "Space" item?
Thanks!
Where is Playgrounds 4? It's 2021-12-14 now...
Come on please!!!
We are looking forward to it!
//
// ContentView.swift
// Shared
//
// Created by Abenx on 2021/8/8.
//
import SwiftUI
/// Demo of NavigationLink causing page problems
///
/// Problem description: When the following structure is used, after entering level3. If the app loses focus, such as drawing out of the control center or multi-page manager, it will cause the page to refresh and render, and eventually jump to level 2.
/// iPhone 12 Pro Max / iOS 15 beta 4 has this problem
/// iPhone 12 Pro Max / iOS 14.6 has no such problem
/// Xcode Version: 12.5.1 (12E507) & 13.0 beta 4 (13A5201i)
struct ContentView: View {
/// If you comment out this line of code, there will be no problem.
@Environment(\.openURL) var openURL
@State private var isOK: Bool = false
var body: some View {
NavigationView {
NavigationLink("Goto Level 2", destination: Level2View().onAppear {
/// If you comment out this line of code, there will be no problem.
isOK = false
})
}
}
}
struct Level2View: View {
var body: some View {
/// If you don't use GeometryReader, there is no problem.
GeometryReader {proxy in
NavigationLink("Goto Level 3", destination: Text("I am in Level 3"))
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
I found this way to take screenshot in full screen view of SwiftUI. But How to take screenshot of a ScrollView content view?
Thanks!
Normal way:
SwiftUI Extension
extension View {
func takeScreenshot(origin: CGPoint, size: CGSize) -> UIImage {
let window = UIWindow(frame: CGRect(origin: origin, size: size))
let hosting = UIHostingController(rootView: self)
window.rootViewController = hosting
window.makeKeyAndVisible()
return hosting.view.snapshotImage()!
}
}
Swift Extension
extension UIView {
func snapshotImage() -> UIImage {
.....
}
}
Using Configuration.storekit to test storekit.
It works well when I run debug.
But not work at Previews of Xcode.
Your CloudKit containers can’t be shown at this time. Try again later. Please file a bug and include the request ID eb93179f-6153-40f4-9b5b-9a7a8c99f763.
I am new of SwiftUI, write ugly codes like that...
let actionContentView = VStack {
if UIDevice.current.userInterfaceIdiom == .phone {
Spacer()
}
...
}
...
return UIDevice.current.userInterfaceIdiom == .phone ? AnyView(VStack(spacing: 0) {
settingContentView
cameraContentView
actionContentView
}) : AnyView(ZStack(alignment: .top){
cameraContentView
VStack (spacing:0) {
settingContentView
Spacer()
actionContentView.padding(40)
}
})
...
return UIDevice.current.userInterfaceIdiom == .phone ? AnyView(GeometryReader(content: internalView(geometry:))
.background(BubbleBackground())) : AnyView(GeometryReader(content: internalView(geometry:))
.edgesIgnoringSafeArea(.all)
.background(BubbleBackground()))
How to use conditions to switch view properties gracefully?
Thanks!
I am a new swifter from objective-c.
In the code:
import SwiftUI
@main
struct MySwiftAppApp: App {
@SceneBuilder var body: some Scene {
WindowGroup {
NavigationView {
ContentView()
}
}
WKNotificationScene(controller: NotificationController.self, category: "LandmarkNear")
}
}
Here is no 'WKHostingController' yet.
So, How to using 'WCSessionDelegate'?
I tried like that:
import SwiftUI
import WatchConnectivity
struct WatchInfo: View {
@State private var showMessage: String = "Wating"
init() {
ABWatchSessionManager.sharedInstance.addDelegateObject(WatchSessionDelegate())
}
var body: some View {
Text(showMessage)
}
class WatchSessionDelegate: NSObject, WCSessionDelegate {
func session(_ session: WCSession, didReceiveMessage message: [String : Any], replyHandler: @escaping ([String : Any]) -> Void) {
let data: Dictionary<String, String> = message["data"] as! Dictionary<String, String>
if data["dataType"] == DataType.ping.rawValue {
} else if data["dataType"] == DataType.data.rawValue {
}
}
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
}
func session(_ session: WCSession, didReceiveApplicationContext applicationContext: [String : Any]) {
}
}
}
struct WatchInfo_Previews: PreviewProvider {
static var previews: some View {
WatchInfo()
}
}
Is it the best way to using Delegate in SwiftUI-only code?
And how can I changing the 'showMessage'?
Thanks!
See the SwiftUI tutorials:
https://developer.apple.com/tutorials/swiftui/creating-a-macos-app
Un-star all the landmarks and click "Favorites only" will got a error
But I change the code "NavigationPrimary.swift"
LandmarkList(
selectedLandmark: $selectedLandmark,
filter: $filter
)
.listStyle(SidebarListStyle())
to
LandmarkList(
selectedLandmark: $selectedLandmark,
filter: $filter
)
.listStyle(InsetListStyle())
It works well.
So, What's the different of "InsetListStyle" and "SidebarListStyle"?
If I want to use "SidebarListStyle", how to fix it?
Thanks!
PS:
This is my code, fix some bugs in the tutorials
https://github.com/rushairer/MySwiftApp
https://developer.apple.com/tutorials/swiftui/working-with-ui-controls
Button action in List causes event bubbling error.
I tried fix it: https://github.com/rushairer/MySwiftApp/commit/8d9578f07a4e55d061f779f44bf20d113f642bd5
Using 'onTapGesture' instead of Button
macOS 10.16 beta
Using Xcode Version 11.5 (11E608c) will get error when distribute app to app store:
"Profile doesn't include the com.apple.application-identifier entitlement."
Using Xcode Version 12.0 beta (12A6159) will be OK.
But, I can not distribute app with Beta version Xcode...
Help~~me~~!