gpt4 book ai didi

iphone - Facebook iOS SDK 崩溃

转载 作者:行者123 更新时间:2023-11-29 05:05:53 25 4
gpt4 key购买 nike

我在我的 iPhone 应用程序中使用 facebook-ios-sdk。

我正在 myAppViewController 类中使用它的代码、委托(delegate)方法..

但是当我为 Facebook 代码创建不同的类时...然后应用程序在登录后崩溃

facebook类代码

-(void)start{
NSLog(@"111111111");
fbAppId = @"205518692797415";

fbPermissions = [[NSArray arrayWithObjects:
@"read_stream", @"offline_access",nil] retain];

facebookObj = [[Facebook alloc] initWithAppId:fbAppId];
NSLog(@"111111111..%@",facebookObj);
}

-(void)login{
NSLog(@"facebook login...%@",fbAppId);
[facebookObj authorize:fbPermissions delegate:self];
NSLog(@"facebook login done..%@",facebookObj);
}

查看Controller类的代码

-(IBAction)facebookBtnAct:(id)sender{
[bfaceBook login];
}

-(void)awakeFromNib{
bfaceBook = [[bFacebook alloc] init];
[bfaceBook start];
[self.view addSubview:mainScreen];
}

应用程序日志

111111111
111111111..<Facebook: 0x6302270>
facebook login...205518692797415
facebook login done..<Facebook: 0x6302270>
[myAppViewController facebookObj]: unrecognized selector sent to instance 0x6052f20
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[myAppViewController facebookObj]: unrecognized selector sent to instance 0x6052f20'
*** Call stack at first throw:
(
0 CoreFoundation 0x02605b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0275540e objc_exception_throw + 47
2 CoreFoundation 0x026076ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x025772b6 ___forwarding___ + 966
4 CoreFoundation 0x02576e72 _CF_forwarding_prep_0 + 50
5 myApp 0x0000210f -[myAppAppDelegate application:handleOpenURL:] + 53
6 UIKit 0x00312423 -[UIApplication _applicationOpenURL:event:] + 189
7 UIKit 0x00310729 -[UIApplication _callApplicationResumeHandlersForURL:event:] + 66
8 UIKit 0x00321457 -[UIApplication _handleApplicationResumeEvent:] + 1488
9 UIKit 0x00320e7a -[UIApplication handleEvent:withNewEvent:] + 4660
10 UIKit 0x00318b3c -[UIApplication sendEvent:] + 71
11 UIKit 0x0031d9bf _UIApplicationHandleEvent + 7672
12 GraphicsServices 0x02dc1822 PurpleEventCallback + 1550
13 GraphicsServices 0x02dc18a9 PurpleEventSignalCallback + 42
14 CoreFoundation 0x025e6faf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
15 CoreFoundation 0x0254539b __CFRunLoopDoSources0 + 571
16 CoreFoundation 0x02544896 __CFRunLoopRun + 470
17 CoreFoundation 0x02544350 CFRunLoopRunSpecific + 208
18 CoreFoundation 0x02544271 CFRunLoopRunInMode + 97
19 GraphicsServices 0x02dc000c GSEventRunModal + 217
20 GraphicsServices 0x02dc00d1 GSEventRun + 115
21 UIKit 0x00321af2 UIApplicationMain + 1160
22 myApp 0x00001f64 main + 102
23 myApp 0x00001ef5 start + 53

最佳答案

现已解决

我改变

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
return [[viewController facebookObj] handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
return [[viewController.bfaceBook facebookObj] handleOpenURL:url];
}

在 AppDelegate 类中

关于iphone - Facebook iOS SDK 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5308382/

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