简体   繁体   中英

App Delegate to Viewcontroller

I have an NSURL property in my app delegate:

@property (nonatomic, retain) NSURL *openedURL;

...and then:

- (BOOL)application:(UIApplication *)application
         openURL:(NSURL *)url
 sourceApplication:(NSString *)sourceApplication
      annotation:(id)annotation {
// attempt to extract a token from the url
self.openedURL = url;
// attempt to extract a token from the url
return [FBSession.activeSession handleOpenURL:url];       
}

I want to move this code to a normal UIViewController. How can I do that??

只有appdelegade可以具有openURL:处理程序,但是您可以在任何控制器或任何NSObject中调用一个方法,然后在其中执行所需的代码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM