gpt4 book ai didi

iphone - 按照教程中的说明调用FBSession.activeSession会导致NSException

转载 作者:行者123 更新时间:2023-12-01 18:24:18 25 4
gpt4 key购买 nike

我正在尝试在我的iPhone应用程序中启用Facebook登录。

我正在按照此页面上的说明进行操作:
https://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/#step4

我已按照步骤4(登录Facebook)中的说明进行操作,但是运行该程序时代码崩溃。

这是导致崩溃的我的方法:

- (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.

// We need to properly handle activation of the application with regards to Facebook Login
// (e.g., returning from iOS 6.0 Login Dialog or from fast app switching).
NSLog(@"here 1");
NSLog(@"active session: %@",FBSession.activeSession);
[FBSession.activeSession handleDidBecomeActive];
NSLog(@"here 2");
}

这是崩溃时的堆栈跟踪记录(应用程序名称替换为XXX):
2013-02-11 17:31:17.956 TRIO[9426:907] here 1
* thread #1: tid = 0x2503, 0x324d9960 libobjc.A.dylib`objc_exception_throw, stop reason = breakpoint 1.1
frame #0: 0x324d9960 libobjc.A.dylib`objc_exception_throw
frame #1: 0x3161af98 CoreFoundation`-[NSException raise] + 8
frame #2: 0x0009f7cc XXX`-[FBSession initWithAppID:permissions:defaultAudience:urlSchemeSuffix:tokenCacheStrategy:] + 240 at FBSession.m:236
frame #3: 0x0009f6d6 XXX`-[FBSession initWithAppID:permissions:urlSchemeSuffix:tokenCacheStrategy:] + 46 at FBSession.m:208
frame #4: 0x0009f680 XXX`-[FBSession init] + 32 at FBSession.m:191
frame #5: 0x000a061a XXX`+[FBSession activeSession] + 62 at FBSession.m:568
frame #6: 0x00073c4e XXX`-[AppDelegate applicationDidBecomeActive:] + 66 at AppDelegate.m:118
frame #7: 0x38e3bae2 UIKit`-[UIApplication _stopDeactivatingForReason:] + 342
frame #8: 0x38e219b8 UIKit`-[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 1072
frame #9: 0x38dc9c38 UIKit`-[UIApplication handleEvent:withNewEvent:] + 1004
frame #10: 0x38dc96cc UIKit`-[UIApplication sendEvent:] + 72
frame #11: 0x38dc911a UIKit`_UIApplicationHandleEvent + 6154
frame #12: 0x393605a2 GraphicsServices`_PurpleEventCallback + 590
frame #13: 0x393601d2 GraphicsServices`PurpleEventCallback + 34
frame #14: 0x315f0172 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
frame #15: 0x315f0116 CoreFoundation`__CFRunLoopDoSource1 + 138
frame #16: 0x315eef98 CoreFoundation`__CFRunLoopRun + 1384
frame #17: 0x31561ebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #18: 0x31561d48 CoreFoundation`CFRunLoopRunInMode + 104
frame #19: 0x38e2047c UIKit`-[UIApplication _run] + 668
frame #20: 0x38e1d2f8 UIKit`UIApplicationMain + 1120
frame #21: 0x00073748 XXX`main + 96 at main.m:16

当我运行Facebook示例代码时,它们可以正常工作,并且我相信我已经添加了所有必需的框架。

谢谢。

最佳答案

我遇到了与上述相同的错误,这是因为我没有将自己的FacebookAppID以及“URL类型”键添加到项目的info.plist中

关于iphone - 按照教程中的说明调用FBSession.activeSession会导致NSException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14807494/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com