我正在尝试使用sfsafariviewcontroller
实现SSO方案。情景如下。
wkwebview
。safariviewcontroller
打开SSO页面。问题出在第4步。当用户打开消息以获取SMS-pin并返回应用程序时,sfsafariviewcontroller
将使用初始URL重新加载页面。因此用户无法进入SMS-pin。
为什么SfSafariViewController
每次都会使用初始网址重新加载页面?
实施如下。
@interface WebContentViewController()<SFSafariViewControllerDelegate>
...
@end
@implementation WebContentViewController
...
...
- (BOOL)decideNavigationFlow:(NSURL *) url isLinkClicked: (BOOL) isLinkClicked {
....
....
if(IS_IOS9_OR_GREATER){
SFSafariViewController *svc = [[SFSafariViewController alloc] initWithURL:url];
[self presentViewController:svc animated:YES completion:nil];
}
}
-(void)safariViewController:(SFSafariViewController *)controller didCompleteInitialLoad:(BOOL)didLoadSuccessfully {
LogInfo(@"#######Initial load completed");
}
-(void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
LogInfo(@"#######Done pressed");
}
@end