'Black screen when using ARGeoTrackingConfiguration on iOS 15.4?
I am trying to run this sample project from Apple that uses ARGeoTrackingConfiguration
: https://developer.apple.com/documentation/arkit/content_anchors/tracking_geographic_locations_in_ar
This sample app is supposed to show an AR camera feed in the top part of the screen, and a map view in the lower part. However, I am not seeing the camera feed, it's just black. I suspect this is something that changed in iOS 15.4, since my colleague was able to run the app successfully on a phone with iOS 15.3.1.
Some other details:
- I am seeing this issue on an iPhone 12 Pro Max and an iPhone 13 mini.
- Both these devices can support geotracking and are connected to the internet.
- I am in a location that has geotracking support, according to these docs: https://developer.apple.com/documentation/arkit/argeotrackingconfiguration
- I updated to iOS 15.4.1 but the issue is still occurring.
- I tried updating to the iOS 15.5 beta 1 and the issue is still occurring.
Has anyone else noticed this issue? Am I doing something wrong? Is there a workaround?
I filed a radar ticket as well, just in case.
EDIT: I filed a TSI request for this issue, and I got back a response saying that there is no workaround for the issue. However, it looks like the bug has been fixed in iOS 15.5 beta 2.
Solution 1:[1]
// Class originalClass = NSClassFromString(@"NSXPCDecoder");
// Class swizzledClass = NSClassFromString(@"SwizzledDecoder");
// SEL originalSelector = @selector(_validateAllowedClass:forKey:allowingInvocations:);
// SEL swizzledSelector = @selector(__validateAllowedClass:forKey:allowingInvocations:);
@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
https://developer.apple.com/forums/thread/703735?answerId=711909022#711909022
I could think of a few options to "fix" this using Private (Apple) APIs. This approach is not super terrible and at least would unblock you from testing on a 15.4.x device (I confirmed this works on Xcode 13.3.1 and iOS 15.4.1).
As far as whether or not Apple would approve #YOLO
#FIDLAR
code like this in an App Store review? I can't help you there.
The real fix (we can hope for) is the next version of Xcode ships with an SDK that builds and compiles with a retroactive fix for 15.4.x.
Solution 2:[2]
This issue has been fixed in iOS 15.5
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | vanvoorden |
Solution 2 | Dante Puglisi |