Post

Replies

Boosts

Views

Activity

Errors when Share Extension Loads
Seeing several errors in the Xcode console when the share extension loads. These don't appear to be causing a runtime issue, but would be helpful to understand what's causing these and how to resolve. Thank you 2022-12-29 16:16:02.370435-0800 LRN-ShareExtension[43934:8790737] [Foundation] *** -[NSXPCDecoder validateAllowedClass:forKey:]: NSSecureCoding allowed classes list contains [NSObject class], which bypasses security by allowing any Objective-C class to be implicitly decoded. Consider reducing the scope of allowed classes during decoding by listing only the classes you expect to decode, or a more specific base class than NSObject. This will become an error in the future. Allowed class list: {(     "'NSObject' (0x21c961dd8) [/usr/lib]" )} NSXPCInterface: <NSXPCInterface: 0x281ef0a40> Protocol: EXExtensionContextHosting SEL: _loadPreviewImageForPayload:contextIdentifier:completionHandler: (3 arguments, 0 proxies)  Classes: [{_EXItemProviderExtensionVendorLoadOperator, _EXItemProviderSandboxedResource, NSValue, NSDictionary, NSError, _EXItemProviderCopyingLoadOperator, NSArray, NSUUID, NSExtensionItem, NSItemProvider, NSDate, NSURL, NSData, NSNumber, NSNull, CKShare, UIImage, NSString}, NSUUID, {}]  Reply block: (arg #4, (2 arguments, 0 proxies), signature 'v@?@@"NSError"') [{NSObject}, {NSError}] SEL: _cancelRequestWithError:forExtensionContextWithUUID:completion: (3 arguments, 0 proxies)  Classes: [{NSError}, NSUUID, {}]  Reply block: (arg #4, (0 arguments, 0 proxies), signature 'v@?') [] SEL: _completeRequestReturningItems:forExtensionContextWithUUID:completion: (3 arguments, 0 proxies)  Classes: [{_EXItemProviderExtensionVendorLoadOperator, _EXItemProviderSandboxedResource, NSValue, NSDictionary, NSError, _EXItemProviderCopyingLoadOperator, NSArray, NSUUID, NSExtensionItem, NSItemProvider, NSDate, NSURL, NSData, NSNumber, NSNull, CKShare, UIImage, NSString}, NSUUID, {}]  Reply block: (arg #4, (0 arguments, 0 proxies), signature 'v@?') [] SEL: _loadItemForPayload:contextIdentifier:completionHandler: (3 arguments, 0 proxies)  Classes: [{_EXItemProviderExtensionVendorLoadOperator, _EXItemProviderSandboxedResource, NSValue, NSDictionary, NSError, _EXItemProviderCopyingLoadOperator, NSArray, NSUUID, NSExtensionItem, NSItemProvider, NSDate, NSURL, NSData, NSNumber, NSNull, CKShare, UIImage, NSString}, NSUUID, {}]  Reply block: (arg #4, (2 arguments, 0 proxies), signature 'v@?@@"NSError"') [{NSObject}, {NSError}] <NSXPCConnection: 0x283ae86e0> connection from pid 43815 on mach service named com.nyny.LRN.LRN-ShareExtension.apple-extension-service
0
0
696
Dec ’22
Issues using LinkPresentation's startFetchingMetadata (for: url)
I have a swiftUI app that displays rich link information. Am using LinkPresentation's startFetchingMetadata(for :url) to get back metadata. The code below works DispatchQueue.global(qos: .background).async {             self.metadataProvider.startFetchingMetadata(for: url) { (metadata, error) in                 if let error {                     print("Error retrieving metadata:", error)                     self.metadataProvider.cancel()                     completion(false)                     return                 }                 guard let metadata else {                     print("Fetched metadata is nil?")                     self.metadataProvider.cancel()                     completion(false)                     return                 }                 DispatchQueue.main.async {                     self.metadata = metadata                     self.extractLinkMetadataImage()                     self.saveLinkMetadata()                     completion(true)                 }             }         } .. but displays the following messages in the Xcode console. Q1.) How do I remove the assertions error? I've already set Outgoing Network Connections in my App Group to Yes Q2.) How do I address the purple main thread warning. I've made sure both the startFetchingMetadata and imageProvider.loadObject calls are being made in DispatchQueue.global(qos: .background).async blocks. 2022-12-28 17:51:11.924604-0800 lrn[40432:8224366] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}> 2022-12-28 17:51:11.924760-0800 lrn[40432:8224366] [ProcessSuspension] 0x12201c120 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=40438, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} 2022-12-28 17:51:12.170643-0800 lrn[40432:8223670] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness. 2022-12-28 17:51:12.170826-0800 lrn[40432:8223670] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness. 2022-12-28 17:51:12.336358-0800 lrn[40432:8224255] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}> 2022-12-28 17:51:12.336405-0800 lrn[40432:8224255] [ProcessSuspension] 0x12201c120 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=40440, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} 2022-12-28 17:51:12.336495-0800 lrn[40432:8223670] [ProcessSuspension] ProcessAssertion::remainingRunTimeInSeconds failed to get handle for process with PID=40440 Thanks
1
0
1.8k
Dec ’22
Deleting all items in an array causes issues with the ForEach used to render the arrays items
I use Core Data with two entities: Set and Link. Both entities contain a UUID id. Sets can contain 1 or more Links and this is represented in a 1-many relationship When the user wants to delete ALL links, this code is called for link in learningSet.webLinksArray.reversed(){       container.viewContext.delete(link) } do{ try container.viewContext.save() } catch let error { print("Failure deleting all links  } Here is the view code that renders link if !learningSet.webLinksArray.isEmpty{ LazyVGrid(columns: columns, alignment: .center, spacing: 16, pinnedViews: []) { ForEach(learningSet.webLinksArray, id: \.id) { link in  RichWebLinkView(webLink: link)      } } } It all works, but I get the following error/warning in the console ForEach<Array, Optional, ModifiedContent<ModifiedContent<DeckMiniView, _FrameLayout>, _FlexFrameLayout>>: the ID nil occurs multiple times within the collection, this will give undefined results! LazyVGridLayout: the ID nil is used by multiple child views, this will give undefined results! It's unclear why the LazyVGrid is even being re-rendered when the weblinksArray is empty. Im guessing this is happening while the delete for loop is running and the array isn't fully empty. Any suggestions on how to fix this would be appreciated.
1
0
878
Dec ’22
Deleting core data entity from inside a withAnimation block causes concurrency violation
withAnimation(.easeInOut){ delete(deck) } func delete(deck){ container.viewContext.delete(deck) do{ try container.viewContext.save() } catch let error { print("Delete Failed } } This (pseudo) code almost always throws a CoreData concurrency violation when running on device from Xcode. It doesn't seem to happen when running the app directly on device (without Xcode) Wrapping the delete with a viewContext.perform block stops the crash but the delete no longer animates in the VGrid Appreciate any help
3
0
1.2k
Dec ’22
How do we prevent the .onTapGesture on other views from firing when SwiftUI menu is visible on the screen?
Here is my code: Menu { Picker("Topic", selection: $selectedTopic) { Text("Unassigned") .tag(nil as Topic?) Divider() ForEach(topics, id:\.id) { topic in Text(topic.name!).tag(topic as Topic?) .foregroundColor(topic.foregroundColor) } } } label: { Image(systemName: "circle.grid.3x3.circle") .font(.system(size: 26,weight: .ultraLight)) .foregroundColor(learningSet.topic?.foregroundColor ?? .primary) .frame(width:30, height: 30) } This correctly shows the menu and if I select an item, the .onchange fires like it should. Problem is if the user clicks on some other view on the screen while the is active, it fires that views .onTappedGesture. I tried different combinations of highPriorityGesture and SimultaneousGesture to no avail. I also tried the approach of adding a full screen view In between the view with the menu and the underlying views and added an onTap to it. That approach works fine with one issue: If the user click on the currency selected item, the .onChange for the picker doesn't fire, the menu disappears but its .onDisappear doesn't fire. So there is no way to know the menu is no longer visible, and hide my full screen view. Any help would be greatly appreciated. Thanks.
0
0
767
Dec ’22
SwiftUI Nav Bar overlaps status bar
As shown in the image above, the nav bar overlaps the status bar. If I drag from the top, it corrects itself and appears like I need it to, like this .. Im not using edgesIgnoringSafeArea anywhere so that can't be causing it. Appreciate any pointers on why this is happening and how to fix it. Thanks.
0
0
501
Dec ’22