parse-community / Parse-SDK-iOS-OSX

The Apple SDK for Parse Platform (iOS, macOS, watchOS, tvOS)
https://parseplatform.org
Other
2.81k stars 871 forks source link

EXC_BAD_ACCESS crash on iOS 14 devices using Xcode 13 beta #1618

Closed bmueller closed 3 years ago

bmueller commented 3 years ago

I'm getting an EXC_BAD_ACCESS crash whenever I run my project on an iOS 14 device using the Xcode 13 beta. Seems to be happening in the registerSubclassesInBundle method of the PFObjectSubclassingController class.

image
bmueller commented 3 years ago

Never mind, this is an issue with an iOS 15 class.

RealKnappster commented 3 years ago

Hi @bmueller - I'm currently seeing a similar issue on my end. What ended up being the fix for you?

bmueller commented 3 years ago

@RealKnappster I had to go into PFObjectSubclassingController and, in registerSubclassesInBundle, change this loop to skip checking the classes (marked "XXXXXX" below) that are causing the crash:

for (unsigned i = 0; i < bundleClassCount; i++) { NSString *className = [NSString stringWithUTF8String:classNames[i]]; if ([className isEqualToString:@"XXXXXXXX"]) { continue; } Class bundleClass = objc_getClass(classNames[i]); // For obvious reasons, don't register the PFObject class. if (bundleClass == pfObjectClass) { continue; } // NOTE: Cannot use isSubclassOfClass here. Some classes may be part of a system bundle (even // though we attempt to filter those out) that may be an internal class which doesn't inherit from NSObject. // Scary, I know! for (Class kls = bundleClass; kls != nil; kls = class_getSuperclass(kls)) { if (kls == pfObjectClass) { // Do -conformsToProtocol: as late in the checking as possible, as its SUUUPER slow. // Behind the scenes this is a strcmp (lolwut?) if ([bundleClass conformsToProtocol:@protocol(PFSubclassing)] && ![bundleClass conformsToProtocol:@protocol(PFSubclassingSkipAutomaticRegistration)]) { [self _rawRegisterSubclass:bundleClass]; } break; } } } free(classNames);

RealKnappster commented 3 years ago

@bmueller Ah interesting- so you ended up forking the repo then? I'm getting the EXC_BAD_ACCESS on the auto-generated model access files from each of my on-device CoreML models. Are you using any .mlmodel files in your project?

RealKnappster commented 3 years ago

@bmueller fyi- I was able to fix this in my case without forking/editing the Parse repo. If you are using CoreML models in your project, Apple has confirmed that there is a known issue with the model access code generator on Xcode 13: https://developer.apple.com/forums/thread/689930

It sounds like we can expect this to be fixed in an upcoming Xcode release, but using their workaround (removing MLShapedArray properties) works for now.