像圖片這樣,但是沒有網址.
這問題爬文都沒有有我要的答案,難道只有我掉坑嗎?我怎每次都遇到很多奇耙的事件,還好都自己解決掉,這次就做個記錄,要是有網友有遇到像我這樣狀況,可以試看看.
1.Google Sing in
關鍵點:要改成 [[UIApplication sharedApplication].keyWindow.rootViewController ];
(void)signIn:(GIDSignIn *)signIn presentViewController:(UIViewController *)viewController{
[[UIApplication sharedApplication].keyWindow.rootViewController presentModalViewController:viewController animated:NO];
}
- (void)signIn:(GIDSignIn *)signIn dismissViewController:(UIViewController *)viewController {
[[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:YES completion:nil];
//[self dismissViewControllerAnimated:YES completion:nil];
}
2.Facebook Sing in
關鍵點:
要新增 UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logOut];
//[self.loginDelegate dismissLoginView:self];
[login logInWithReadPermissions: @[@"public_profile", @"email"]
fromViewController:vc
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
NSLog(@"Process error");
} else if (result.isCancelled) {
NSLog(@"Cancelled");
} else {
以我的範例使用上面的方式即可.
原因似乎是跳轉時找不到我從哪個頁面做跳轉的情況,原因是我用了第三方套件關係,因為需求要有酷炫的效果,好吧!總之找到補坑的方法了.
keep codeing ...
沒有留言:
張貼留言