[英]IOS-Facebook Blank white screen after app is authorized
I am upgrading from Parse v1.6.4 to the latest version and also i am upgrading facebook ios sdk to v4.7. 我正在从Parse v1.6.4升级到最新版本,我也正在将facebook ios sdk升级到v4.7。 The problem is after the app is authorized,it shows a blank white screen and if i click "done",it closes the safari and in the log it shows that,user cancelled login.
问题是在应用程序被授权后,它显示一个空白的白色屏幕,如果我点击“完成”,它会关闭Safari并在日志中显示用户取消登录。
It was working fine before upgrading it to the new version. 在将其升级到新版本之前,它工作正常。
my plist
我的plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbxxxxxx</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string><my FacebookAppID></string>
<key>FacebookDisplayName</key>
<string>my appname</string>
white listing FB server
白名单FB服务器
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
AppDelegate.m
AppDelegate.m
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return [[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
}
viewController.m
viewController.m
-(IBAction)facebookLogin:(id)sender
{
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
if ([FBSDKAccessToken currentAccessToken])
{
//Do something
}
else
{
[login logInWithReadPermissions:@[@"email"] fromViewController:nil handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
if (error)
{
NSLog(@"Error");
}
else if (result.isCancelled)
{
NSLog(@"User cancelled login");
}
else
{
NSLog(@"Login Success");
if ([result.grantedPermissions containsObject:@"email"])
{
NSLog(@"result is:%@",result);
}
else
{
NSLog(@"FB email permission error");
}
}
}];
}
}
Here's an image of the screen. 这是屏幕的图像。
I am running this test app in my IPhone 6 device. 我在我的iPhone 6设备上运行这个测试应用程序。
Thank you! 谢谢! :)
:)
Edit 1:
编辑1:
Today,i upgraded my project to Facebook's new v4.8 SDk and this time,it seems like it's working.今天,我将我的项目升级到Facebook的新v4.8 SDk,这一次,它似乎正在运作。
I am not sure,what i was doing wrong at that time but it's working now for arm64 devices.我不确定,那时我做错了什么,但它现在正在为arm64设备工作。
But when i enable support for armv7s,it's giving me this error...但是当我启用对armv7s的支持时,它给了我这个错误......
ld: file is universal (4 slices) but does not contain a(n) armv7s slice:
It points to FBSDKLoginKit.framework. 它指向FBSDKLoginKit.framework。
Are armv7s devices not supported anymore? armv7s设备是否不再受支持?
Is there anyway to get rid of this error? 反正有没有摆脱这个错误?
Thank you! 谢谢! :)
:)
I had the same problem and it turned out that 我遇到了同样的问题,结果证明了这一点
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool
is deprecated in ios 9.0. 在ios 9.0中已弃用。 I also had implemented the method
我也实现了这个方法
func application(application: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool
so FB SDK was calling the latter. 所以FB SDK正在调用后者。 So I had to make sure that I call FBSDKApplicationDelegate in both methods (once for ios 8 and once for ios9).
所以我必须确保在两种方法中调用FBSDKApplicationDelegate (一次用于ios 8,一次用于ios9)。
Here is my implementation of AppDelegate: 这是我对AppDelegate的实现:
@available(iOS 9.0, *)
func application(application: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
let handled = FBSDKApplicationDelegate.sharedInstance().application(application,
openURL: url,
sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String,
annotation: options [UIApplicationOpenURLOptionsAnnotationKey])
if !handled {
return self.openURL(url)
}
return true
}
@available(iOS, introduced=8.0, deprecated=9.0)
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
let handled = FBSDKApplicationDelegate.sharedInstance()
.application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
if !handled {
return self.openURL(url)
}
return true
}
where self.openURL(url) can be used to handle other url types beside the facebook ones. 其中self.openURL(url)可用于处理facebook旁边的其他url类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.