Facebook iOS SDK crash

0

I am using facebook-ios-sdk in my iphone application.

I am using its code, delegate methods in myAppViewController class..

But when I make different class for facebook code...then application crash after login

Code of facebook class

-(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);
}

Code of view Controller Class

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

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

Log of the Application

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
iphone
ios
iphone-sdk-3.0
facebook-graph-api
asked on Stack Overflow Mar 15, 2011 by Amit Battan • edited Mar 15, 2011 by Cody Gray

1 Answer

1

Solved Now

I change the

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

to

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

in AppDelegate class

answered on Stack Overflow Mar 15, 2011 by Amit Battan

User contributions licensed under CC BY-SA 3.0