-
-
Notifications
You must be signed in to change notification settings - Fork 877
Added automatic PFObject subclass registration. #967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
// Skipping a bundle. Not entirely sure of the best solution to that here. | ||
if (shouldSubscribe) { | ||
@weakify(self); | ||
[[NSNotificationCenter defaultCenter] addObserverForName:NSBundleDidLoadNotification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From offline discussion:
Store the registration token in the ivar, validate that it's nil
here to avoid double subscribe as well as clean up the registration in dealloc
.
11111a0
to
a491c1e
Compare
Looks great, can't wait to see this feature! |
a491c1e
to
645b29e
Compare
|
||
// There are two different paths that we will need to check for the bundle, depending on the platform. | ||
// - First, we need to check the raw executable path fom the bundle. | ||
// This should be valid for most frameworks on OS X. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Not OSX, macOS
.
This will scan all loaded code bundles for classes which inherit from `PFObject`, and register them upon Parse initialization. Still have opt-in support for manual-only registration, though it shouldn't be necessary for most cases.
645b29e
to
e9a4e59
Compare
We're seeing this crash which appears to be related, but we don't have subclasses of PFObjects, so I'm not sure where to look or what to do except downgrade to 1.13. Any suggestions would be appreciated.
|
This should be fixed as of 1.14.2. Please update the SDK and comment here if it helped or if you are still running into an issue here. |
Thanks @nlutsenko. I don't see 1.14.2 on cocoapods yet... I just see 1.14.1. Can cocoapods be updated to 1.14.2 please? |
Please run 'pod repo update' to make sure you have the latest specs locally. |
I was looking on cocoapods.org, and saw only 1.14.1, but now I see 1.14.2, so -shrug-. Many thanks for being responsive. |
Well, with 1.14.2 we are still seeing an issue, but so far only against iOS 10.0.0:
|
@levigroker, just tested on iOS 10 and it works just fine on both Simulator and Device. |
@nlutsenko Thanks... unfortunately this is happening in production and we're not able to reproduce it locally either. Perhaps the NSInternalInconsistencyException could report the offending bundle? |
This will help track down the issue should this assert arrise. See @levigroker’s comments in parse-community#967
I'm seeing reports this crash as well, on iOS 9 and iOS 10, also without being able to reproduce locally. |
* parseOriginal: (211 commits) Parse 1.14.2 ☁️ (parse-community#988) Fixed crash when an NSBundle without executable is loaded (parse-community#981) Parse 1.14.1 ☁️ (parse-community#977) Fix not automatically registered subclasses of built-in subclasses of PFObject. (parse-community#976) Parse 1.14.0 ☁️ (parse-community#973) Update xctoolchain to latest. Improve code coverage for PFFileState. Update Carthage dependencies. Update gem dependencies. Update PFObjectState.m (parse-community#922) Added automatic PFObject subclass registration. (parse-community#967) Fix non-faulted task when loading installationId from persistence group fails. (parse-community#970) Remove no longer required bitcode flag for iOS. Update Travis-CI configuration to use macOS name. Update Rakefile to use macOS instead of OSX. Update all gems to latest. Update xctoolchain to latest. Update all xcode configurations to latest. Update Carthage dependencies. Update starter projects to use configuration-based initialization API. (parse-community#957) ...
We are still seeing this issue consistently. I've filed #1068 |
This will help track down the issue should this assert arrise. See @levigroker’s comments in #967
Older discussion visible here: #5
This is a breaking change.
What's new
Currently, every
PFObject
subclass must be registered with parse before it is used. This can create some hard-to-track-down issues if you're not aware of this, and it isn't exactly the cleanest API.In Objective-C/Swift, it is relatively easy to search at run-time for subclasses of
PFObject
, and have them register with parse automatically (in the case of dynamic libraries, even as soon as they load from their bundles).This should prevent needing your app delegate to have lots of extra lines of code related to simply registering all of your
PFObject
subclasses.What's breaking
PFObject
, which implementedPFSubclassing
, but intentionally did not register it with parse (or only conditionally registered it with parse), then you may run into errors printed to the console and a crash on start. The error message in the console should be concrete enough to help you track down the issue.PFSubclassingSkipAutomaticRegistration
.[MySubclass registerSubclass]
inAppDelegate
or similar, andMySubclass
is located in a not-yet loaded dynamic library/framework, then until you manually load that library (by using a class/method/function inside it), your subclass will not be registered.dlopen
& friends, if your application needs such a feature.These breaking changes shouldn't effect 99% of our users, and workarounds should be fairly simple for those it will break for.
Fixes #963
Closes #964