FB返回崩溃app xcode ios iphone

时间:2012-06-24 19:11:00

标签: iphone ios xcode

将FB集成到我的应用程序时会出现并改变其连接状态,但是当它返回到应用程序时会崩溃,

这是来自fb开发者页面的返回过程,并将其添加到我的视图控制器页面

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    return [[Ball_GameViewController facebook] handleOpenURL:url]; 

}

在该行开始时有一条建议

  

返回

  

警告:'Ball_GameViewController'可能无法响应'+ facebook'

我有任何想法将它指向错误的区域。

Ball_GameViewController.h

#import <UIKit/UIKit.h>
#import "FBConnect.h"

@interface Ball_GameViewController : UIViewController <FBSessionDelegate, FBDialogDelegate>
{
    Facebook *facebook;
}

@property (nonatomic, retain) Facebook *facebook;
@property (nonatomic, retain) IBOutlet UIWindow *window;

- (IBAction)facebookpost;
- (IBAction)start;
- (IBAction)reset;
- (void)countdown;
- (void)scorecount;
- (void)checkTime;

@end

1 个答案:

答案 0 :(得分:3)

Ball_GameViewController @interface中,您需要使用:

@property (nonatomic, strong) Facebook * facebook;

Ball_GameViewController @implementation中,您需要@synthesize facebook;

更新

试试这个:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

    Ball_GameViewController * ballGame = [[Ball_GameViewController alloc] init];

    return [[ballGame facebook] handleOpenURL:url]; 
}