iOS贴墙FB问题

时间:2012-08-14 17:37:51

标签: ios facebook status

我正试图在自己的墙上发布消息。识别我的FB应用程序ID并登录到我的帐户的流程,但我无法在墙上发布任何内容。该应用程序突然关闭。一个非常奇怪的行为。有什么建议吗?

-(IBAction) postMessage:(id) sender 
   {
        if (login == NO) {
                   NSArray* permissions =  [[NSArray arrayWithObjects: @"read_stream",
                              @"publish_stream", nil] retain];
                    [facebook authorize:permissions delegate:self];

        } else {

                  NSLog(@"Posting message");
                  NSString *message = @"test message here";
                 NSMutableDictionary *params = [NSMutableDictionary dictionary];
                 [params setObject:message forKey:@"message"];

                 [facebook requestWithMethodName:@"facebook.Stream.publish" andParams:params
                       andHttpMethod:@"POST" andDelegate:self]; //[params release];                       
      }

   }

   - (void)fbDidLogin {
      NSLog(@"logged in");
     login = YES;
       }


  - (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response {
         NSLog(@"received response");
       }


  - (void)viewDidLoad {
       [super viewDidLoad];
   facebook = [[Facebook alloc] initWithAppId:@"APP_ID"];
  }

修改

在appDelegate中,

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {

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

认证后应用程序不会重新启动。

0 个答案:

没有答案