Fix RCTLinkingManager crash on iOS7

Reviewed By: nicklockwood

Differential Revision: D2982199

fb-gh-sync-id: 28ff6ddfe850df5925424423115ba953651ca94f
shipit-source-id: 28ff6ddfe850df5925424423115ba953651ca94f
This commit is contained in:
Pieter De Baets 2016-02-26 06:49:20 -08:00 committed by Facebook Github Bot 9
parent 9edfd945d1
commit c8835d0226
1 changed files with 4 additions and 3 deletions

View File

@ -34,17 +34,18 @@ RCT_EXPORT_MODULE()
- (NSDictionary<NSString *, id> *)constantsToExport
{
NSURL *initialURL;
if (_bridge.launchOptions[UIApplicationLaunchOptionsURLKey]) {
initialURL = _bridge.launchOptions[UIApplicationLaunchOptionsURLKey];
} else if (_bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]) {
} else if (&UIApplicationLaunchOptionsUserActivityDictionaryKey &&
_bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]) {
NSDictionary *userActivityDictionary = _bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey];
if ([userActivityDictionary[UIApplicationLaunchOptionsUserActivityTypeKey] isEqual:NSUserActivityTypeBrowsingWeb]) {
initialURL = ((NSUserActivity *)userActivityDictionary[@"UIApplicationLaunchOptionsUserActivityKey"]).webpageURL;
}
}
return @{@"initialURL": RCTNullIfNil(initialURL.absoluteString)};
}