我在我的应用程序中使用 Flickr。当我单击 Flickr 按钮时,它会重定向到 safari 以使用 Flickr 和授权登录。
然后在成功授权后重定向到我的应用程序。但重定向后我想调用 ViewWillAppear。我也设定<UIApplicationDelegate>
了我的看法。但它没有调用以下任何方法。
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:YES];
NSLog(@"@@@@@@@@@@@@@@@@@@@@@Flickr Authorized is completed");
}
- (void)UIApplicationWillEnterForeground:(UIApplication *)application
{
NSLog(@"@@@@@@@@@@@@@@@@@@@@@Flickr Authorized is completed at foreground");
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
NSLog(@"@@@@@@@@@@@@@@@@@@@@@Flickr Authorized is completed at become active");
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSLog(@"@@@@@@@@@@@@@@@@@@@@@@Flickr Authorized is completed at openURL");
}
-(void)viewWillAppear:(BOOL)animated
{
NSLog(@"@@@@@@@@@@@@@@@@@@@@@Flickr Authorized is completed at viewWillAppear");
[super viewWillAppear:YES];
}
但是在 AppDelegate 从 safari 重定向后调用下面的方法。我使用了 SnapAndRun flickr 示例中的代码。
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSLog(@"@@@@@@@@@@@@@@@@@@@@@@Call Back Here@@@@@@@@@@@");
if ([self flickrRequest].sessionInfo)
{
// already running some other request
NSLog(@"Already running some other request");
}
else {
NSString *token = nil;
NSString *verifier = nil;
BOOL result = OFExtractOAuthCallback(url, [NSURL URLWithString:SRCallbackURLBaseString], &token, &verifier);
if (!result) {
NSLog(@"Cannot obtain token/secret from URL: %@", [url absoluteString]);
return NO;
}
[self flickrRequest].sessionInfo = kGetAccessTokenStep;
[flickrRequest fetchOAuthAccessTokenWithRequestToken:token verifier:verifier];
[activityIndicator startAnimating];
//[viewController.view addSubview:progressView];
}
return YES;
}
我知道我们可以在这里调用我的视图控制器方法。但是在我的视图本身重定向后,是否有任何替代方法可以调用默认委托方法。
任何建议将不胜感激。提前致谢。