Post

Replies

Boosts

Views

Activity

Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
@glow you were able to build from Xcode 13.3.1 to 15.5b2 and the issue is fixed? Do we know when the issue first started happening? Is this a 15.4.x bug? Does anyone have the diff to get that Apple sample code project working correctly on 15.4.x? Is there any workaround in code other than just gating users on 15.4.x from ever using ARGeoTrackingConfiguration?
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’22
Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
@glow it sounds like a bad bug. The sample code from 14.0 is breaking in 15.4. Apple DTS told us there is no workaround. That's… not a good sign. It's possible the next version of Xcode builds and compiles to retcon a fix on 15.4.x. It's either an official fix from a new SDK, an unofficial fix in the form of discovering some kind of hacky private API to fix 15.4.x, or engineers just have to permanently gate their users from ARGeoTrackingConfiguration on 15.4.x.
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’22
Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
#import <objc/runtime.h> @interface SwizzledDecoder : NSObject - (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3; @end @implementation SwizzledDecoder - (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3 { if ([arg2 isEqualToString: @"collaborationData"]) { return; } return [self __validateAllowedClass: arg1 forKey: arg2 allowingInvocations: arg3]; } @end void NSXPCDecoderSwizzle(void) { // https://nshipster.com/method-swizzling/ static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ Class originalClass = NSClassFromString(@"NSXPCDecoder"); Class swizzledClass = NSClassFromString(@"SwizzledDecoder"); SEL originalSelector = @selector(_validateAllowedClass:forKey:allowingInvocations:); SEL swizzledSelector = @selector(__validateAllowedClass:forKey:allowingInvocations:); Method originalMethod = class_getInstanceMethod(originalClass, originalSelector); Method swizzledMethod = class_getInstanceMethod(swizzledClass, swizzledSelector); IMP originalImp = method_getImplementation(originalMethod); IMP swizzledImp = method_getImplementation(swizzledMethod); class_replaceMethod(originalClass, swizzledSelector, originalImp, method_getTypeEncoding(originalMethod)); class_replaceMethod(originalClass, originalSelector, swizzledImp, method_getTypeEncoding(swizzledMethod)); }); } @glow this is some really awful code to at least get the ARGeoTrackingConfiguration back on screen displaying live camera capture on a device running 15.4.1.
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’22
Reply to RandomAccessCollection Performance Problems when List is paired with NavigationStack
https://developer.apple.com/forums/thread/741484 https://github.com/apple/swift-collections/pull/335 was merged and these equality checks are now fast when comparing equal identities… I'm still not clear why SwiftUI would need dozens of equality checks to compare a let constant collection against itself… but I'm not sure there's anything left to do to optimize this from swift-collections for now.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’23
Reply to SwiftData and command line
import Foundation import SwiftData @Model class Person { var name: String init(name: String) { self.name = name } } func main() { print(Bundle.main.bundleIdentifier ?? "") // com.northbronson.DataDemo print(Bundle.main.object(forInfoDictionaryKey: "CFBundleName") ?? "") // DataDemo let configuration = ModelConfiguration( isStoredInMemoryOnly: true, allowsSave: false ) print(configuration.url) // file:///dev/null // let _ = configuration.url.startAccessingSecurityScopedResource() do { let _ = try ModelContainer( for: Person.self, configurations: configuration ) } catch { // configuration.url.stopAccessingSecurityScopedResource() print(error) } } main() // com.northbronson.DataDemo // DataDemo // file:///dev/null // error: addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (257) // CoreData: error: addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (257) // error: userInfo: // CoreData: error: userInfo: // error: NSFilePath : /dev/null // CoreData: error: NSFilePath : /dev/null // error: storeType: SQLite // CoreData: error: storeType: SQLite // error: configuration: (null) // CoreData: error: configuration: (null) // error: URL: file:///dev/null/ // CoreData: error: URL: file:///dev/null/ // CoreData: annotation: options: // CoreData: annotation: NSMigratePersistentStoresAutomaticallyOption : 1 // CoreData: annotation: NSPersistentHistoryTrackingKey : 1 // CoreData: annotation: NSInferMappingModelAutomaticallyOption : 1 // CoreData: annotation: NSPersistentStoreRemoteChangeNotificationOptionKey : 1 // CoreData: annotation: NSReadOnlyPersistentStoreOption : 1 // error: <NSPersistentStoreCoordinator: 0x600000960180>: Attempting recovery from error encountered during addPersistentStore: 0x600002960f00 Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} // CoreData: error: <NSPersistentStoreCoordinator: 0x600000960180>: Attempting recovery from error encountered during addPersistentStore: 0x600002960f00 Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} // error: Store failed to load. <NSPersistentStoreDescription: 0x600002960db0> (type: SQLite, url: file:///dev/null/) with error = Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} with userInfo { // NSFilePath = "/dev/null"; // } // CoreData: error: Store failed to load. <NSPersistentStoreDescription: 0x600002960db0> (type: SQLite, url: file:///dev/null/) with error = Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} with userInfo { // NSFilePath = "/dev/null"; // } // Unresolved error loading container Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} // SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer) // Program ended with exit code: 0 Was anyone able to get this working with a ModelConfiguration set to isStoredInMemoryOnly? I followed the steps to add CREATE_INFOPLIST_SECTION_IN_BINARY and I see the values being read correctly from Bundle… then this error throws up… I'm trying the startAccessingSecurityScopedResource that I read about… no luck. Hmm… AFAIK this is just a plain vanilla macOS command line tool (other than injecting an info.plist) with no funky sandbox behavior going on. Any ideas what else to try or where else to look?
Jan ’24
Reply to SwiftUI.View Compiler Errors when Property Wrapper is Annotated with MainActor
I can also fix the compiler error by putting the App conformance directly on the extension where my body is defined: @main struct MainActorDemoApp { // var body: some Scene { // WindowGroup { // ContentView() // } // } } extension MainActorDemoApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @Wrapper var value = "Hello, world!" var body: some View { Text(self.value) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’24
Reply to SwiftData and command line
import Foundation import SwiftData @Model class Person { var name: String init(name: String) { self.name = name } } func main() { let configuration = ModelConfiguration( isStoredInMemoryOnly: true, allowsSave: true ) do { let _ = try ModelContainer( for: Person.self, configurations: configuration ) } catch { print(error) } } main() I'm able to build and run by passing true to allowsSave. Is passing false from CLI not supported? I'm on Xcode Version 15.2 (15C500b).
Jan ’24
Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
https://developer.apple.com/documentation/arkit/content_anchors/tracking_geographic_locations_in_ar I'm seeing the same error from trying to build and run the Apple sample project. Building from Xcode 13.3.1 (13E500a) to iPhone 12 Pro Max running iOS 15.4.1 (19E258).
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
@glow you were able to build from Xcode 13.3.1 to 15.5b2 and the issue is fixed? Do we know when the issue first started happening? Is this a 15.4.x bug? Does anyone have the diff to get that Apple sample code project working correctly on 15.4.x? Is there any workaround in code other than just gating users on 15.4.x from ever using ARGeoTrackingConfiguration?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
@glow it sounds like a bad bug. The sample code from 14.0 is breaking in 15.4. Apple DTS told us there is no workaround. That's… not a good sign. It's possible the next version of Xcode builds and compiles to retcon a fix on 15.4.x. It's either an official fix from a new SDK, an unofficial fix in the form of discovering some kind of hacky private API to fix 15.4.x, or engineers just have to permanently gate their users from ARGeoTrackingConfiguration on 15.4.x.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
#import <objc/runtime.h> @interface SwizzledDecoder : NSObject - (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3; @end @implementation SwizzledDecoder - (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3 { if ([arg2 isEqualToString: @"collaborationData"]) { return; } return [self __validateAllowedClass: arg1 forKey: arg2 allowingInvocations: arg3]; } @end void NSXPCDecoderSwizzle(void) { // https://nshipster.com/method-swizzling/ static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ Class originalClass = NSClassFromString(@"NSXPCDecoder"); Class swizzledClass = NSClassFromString(@"SwizzledDecoder"); SEL originalSelector = @selector(_validateAllowedClass:forKey:allowingInvocations:); SEL swizzledSelector = @selector(__validateAllowedClass:forKey:allowingInvocations:); Method originalMethod = class_getInstanceMethod(originalClass, originalSelector); Method swizzledMethod = class_getInstanceMethod(swizzledClass, swizzledSelector); IMP originalImp = method_getImplementation(originalMethod); IMP swizzledImp = method_getImplementation(swizzledMethod); class_replaceMethod(originalClass, swizzledSelector, originalImp, method_getTypeEncoding(originalMethod)); class_replaceMethod(originalClass, originalSelector, swizzledImp, method_getTypeEncoding(swizzledMethod)); }); } @glow this is some really awful code to at least get the ARGeoTrackingConfiguration back on screen displaying live camera capture on a device running 15.4.1.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
@zackfromkeller does the method swizzling technique from below fix your build on 15.4.x?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
@zackfromkeller I just went outside to try the hack and I'm able to see live camera capture and place geo anchors correctly on 15.4.1.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Unable to use ARGeoTrackingConfiguration when launching a new AR Session in the app - 15.4 (and 15.41.)
I tried building and installing from Xcode 13.4 (13F17a) to iOS 15.4.1 (19E258) and I still see the bug, which leads me to believe we're not going to see a retroactive fix from Apple in the new SDK to fix this for users on 15.4.x. Sad face.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to RandomAccessCollection Performance Problems when List is paired with NavigationStack
In reality, no one will pass one million items to a List. @MobileTen This is a fair point… but I'm seeing dozens and dozens of equality checks even when I'm only creating the List with 10 elements… and those checks all go away (except for the first one) when switching from NavigationStack to NavigationView.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to RandomAccessCollection Performance Problems when List is paired with NavigationStack
https://developer.apple.com/forums/thread/741484 https://github.com/apple/swift-collections/pull/335 was merged and these equality checks are now fast when comparing equal identities… I'm still not clear why SwiftUI would need dozens of equality checks to compare a let constant collection against itself… but I'm not sure there's anything left to do to optimize this from swift-collections for now.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to SwiftData and command line
import Foundation import SwiftData @Model class Person { var name: String init(name: String) { self.name = name } } func main() { print(Bundle.main.bundleIdentifier ?? "") // com.northbronson.DataDemo print(Bundle.main.object(forInfoDictionaryKey: "CFBundleName") ?? "") // DataDemo let configuration = ModelConfiguration( isStoredInMemoryOnly: true, allowsSave: false ) print(configuration.url) // file:///dev/null // let _ = configuration.url.startAccessingSecurityScopedResource() do { let _ = try ModelContainer( for: Person.self, configurations: configuration ) } catch { // configuration.url.stopAccessingSecurityScopedResource() print(error) } } main() // com.northbronson.DataDemo // DataDemo // file:///dev/null // error: addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (257) // CoreData: error: addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (257) // error: userInfo: // CoreData: error: userInfo: // error: NSFilePath : /dev/null // CoreData: error: NSFilePath : /dev/null // error: storeType: SQLite // CoreData: error: storeType: SQLite // error: configuration: (null) // CoreData: error: configuration: (null) // error: URL: file:///dev/null/ // CoreData: error: URL: file:///dev/null/ // CoreData: annotation: options: // CoreData: annotation: NSMigratePersistentStoresAutomaticallyOption : 1 // CoreData: annotation: NSPersistentHistoryTrackingKey : 1 // CoreData: annotation: NSInferMappingModelAutomaticallyOption : 1 // CoreData: annotation: NSPersistentStoreRemoteChangeNotificationOptionKey : 1 // CoreData: annotation: NSReadOnlyPersistentStoreOption : 1 // error: <NSPersistentStoreCoordinator: 0x600000960180>: Attempting recovery from error encountered during addPersistentStore: 0x600002960f00 Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} // CoreData: error: <NSPersistentStoreCoordinator: 0x600000960180>: Attempting recovery from error encountered during addPersistentStore: 0x600002960f00 Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} // error: Store failed to load. <NSPersistentStoreDescription: 0x600002960db0> (type: SQLite, url: file:///dev/null/) with error = Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} with userInfo { // NSFilePath = "/dev/null"; // } // CoreData: error: Store failed to load. <NSPersistentStoreDescription: 0x600002960db0> (type: SQLite, url: file:///dev/null/) with error = Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} with userInfo { // NSFilePath = "/dev/null"; // } // Unresolved error loading container Error Domain=NSCocoaErrorDomain Code=257 "The file “null” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/dev/null} // SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer) // Program ended with exit code: 0 Was anyone able to get this working with a ModelConfiguration set to isStoredInMemoryOnly? I followed the steps to add CREATE_INFOPLIST_SECTION_IN_BINARY and I see the values being read correctly from Bundle… then this error throws up… I'm trying the startAccessingSecurityScopedResource that I read about… no luck. Hmm… AFAIK this is just a plain vanilla macOS command line tool (other than injecting an info.plist) with no funky sandbox behavior going on. Any ideas what else to try or where else to look?
Replies
Boosts
Views
Activity
Jan ’24
Reply to SwiftUI.View Compiler Errors when Property Wrapper is Annotated with MainActor
I can also fix the compiler error by putting the App conformance directly on the extension where my body is defined: @main struct MainActorDemoApp { // var body: some Scene { // WindowGroup { // ContentView() // } // } } extension MainActorDemoApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @Wrapper var value = "Hello, world!" var body: some View { Text(self.value) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to SwiftData and command line
import Foundation import SwiftData @Model class Person { var name: String init(name: String) { self.name = name } } func main() { let configuration = ModelConfiguration( isStoredInMemoryOnly: true, allowsSave: true ) do { let _ = try ModelContainer( for: Person.self, configurations: configuration ) } catch { print(error) } } main() I'm able to build and run by passing true to allowsSave. Is passing false from CLI not supported? I'm on Xcode Version 15.2 (15C500b).
Replies
Boosts
Views
Activity
Jan ’24
Reply to SwiftUI.View Compiler Errors when Property Wrapper is Annotated with MainActor
I found this article quite enlightening: https://lucasvandongen.dev/swift_actors_and_protocol_extensions.php @enodev I'll take a look. Thanks!
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to Aggregating Xcode Metrics Measure Test Reporting in Xcode or Command Line
You might be able to use xcresulttool for this. I'll take a look. Thanks!
Replies
Boosts
Views
Activity
Jan ’24
Reply to Instruments in Xcode 15.3 not showing symbols
I able to see macOS symbols from Instruments 15.3 but my symbols from iPhone sim are gone.
Replies
Boosts
Views
Activity
Mar ’24