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

objectForKeyedSubscript unrecognized selector sent to instance on OS X 10.7 due to TyphoonStartup +(void)load invoked too early #237

Closed
emovla opened this issue Jul 8, 2014 · 4 comments

Comments

@emovla
Copy link

emovla commented Jul 8, 2014

Basically the call
NSArray *assemblyNames = [[NSBundle mainBundle] infoDictionary][@"TyphoonInitialAssemblies"];

inside

  • (TyphoonComponentFactory *)factoryFromPlist

results in the exception "objectForKeyedSubscript unrecognized selector sent to instance".

This stackoverflow article and the related blog entry seems to confirm that at the time +load is called, the NSDictioniary may not have the objectForKeyedSubscript dynamically added:

http://stackoverflow.com/questions/13544629/objectforkeyedsubscript-crash-on-ios-5-1

(I got this on OS X 10.7 but probably the same issue will exist on older iOS-es).

And changing the implementation to this seems to fix the issue:

  • (TyphoonComponentFactory *)factoryFromPlist
    {
    TyphoonComponentFactory *result = nil;

    NSDictionary* dict = [[NSBundle mainBundle] infoDictionary];
    NSArray *assemblyNames = [dict objectForKey:@"TyphoonInitialAssemblies"];

@alexgarbarev
Copy link
Contributor

Thanks @emovla! Interesting - didn't see that behaviour before. Would you like to make pull request or I can fix with your way?

@emovla
Copy link
Author

emovla commented Jul 8, 2014

Sure you can fix it with my way, thanks.

alexgarbarev added a commit that referenced this issue Jul 8, 2014
Added support for separated assemblies in plist for iPhone and iPad
@alexgarbarev
Copy link
Contributor

Pushed fix as Typhoon 2.1.4. Check please, then I'll close the issue

@emovla
Copy link
Author

emovla commented Jul 8, 2014

Yep it works fine

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

No branches or pull requests

2 participants