iphone - Facebook iOS SDK 崩溃

标签 iphone ios iphone-sdk-3.0 facebook-graph-api

我在我的 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/

相关文章:

ios - Google Cloud Datastore API 的 Objective-C 客户端?

ios - 捕获 VLCMobileKit For iOS 的警报 View

ios - 如何拦截 MKMapView 或 UIWebView 对象上的触摸事件?

iphone - 如何以编程方式获取 iPhone 3GS 的 MAC 地址?

iphone - 防止 iPhone 在连接到充电器且应用程序正在运行时锁定

javascript - 如何正确使用jquerymobile和phonegap中的快速按钮?

iphone - 将 UIImage 转换为 CVPixelBufferRef

iphone - NSXMLParser 值不被保留

objective-c - 基于导航的应用程序中屏幕底部的 "Back"按钮

iPhone UIView 动画