Skip to content
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

Added automatic PFObject subclass registration. #5

Closed
wants to merge 1 commit into from

Conversation

richardjrossiii
Copy link
Contributor

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

  • If you had a subclass of PFObject, which implemented PFSubclassing, 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.
    • If you would still like to use the old-style manual registration (not recommended), you can opt-out on specific subclasses by conforming to the new protocol PFSubclassingSkipAutomaticRegistration.
  • If you remove your calls to [MySubclass registerSubclass] in AppDelegate or similar, and MySubclass 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.
    • Note that this, however, allows for a much better potential plugin model using the Parse SDK using 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.

@richardjrossiii
Copy link
Contributor Author

Fixed OSX unit tests, was an issue related to symlink resolution only happening partially.

@bliang
Copy link

bliang commented Aug 16, 2015

+1

@richardjrossiii richardjrossiii force-pushed the richardross.subclassing.autoreg branch 2 times, most recently from 3fcdc47 to af28af7 Compare August 24, 2015 17:37
@richardjrossiii
Copy link
Contributor Author

Rebased.

@nlutsenko nlutsenko added this to the 1.8.4 milestone Aug 28, 2015
@nlutsenko
Copy link
Contributor

Hey guys, just letting everyone here know that we are tracking this to be merged in and release with version 1.8.4 of the SDK.

@nlutsenko
Copy link
Contributor

Needs rebasing + tests to pass, back in your queue :)

@facebook-github-bot
Copy link

@richardjrossiii updated the pull request.

@nlutsenko nlutsenko modified the milestones: 1.12.0, 1.11.0, 1.13.0 Dec 10, 2015
@richardjrossiii richardjrossiii force-pushed the richardross.subclassing.autoreg branch from 4a46a19 to 36f34bd Compare January 11, 2016 21:59
@nlutsenko nlutsenko removed this from the 1.13.0 milestone Mar 21, 2016
@CiraciNicolo
Copy link

+1

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.
@richardjrossiii richardjrossiii force-pushed the richardross.subclassing.autoreg branch from 36f34bd to 11111a0 Compare July 7, 2016 22:11
@richardjrossiii
Copy link
Contributor Author

Rebased.

@richardjrossiii
Copy link
Contributor Author

Due to issues with travis CI, we've moved this issue to #967, for any who are following this PR still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants