2012-04-12 41 views
0

地狱大家,发送使用Twitter SDK的Twitter在IOS5

我想每一个如何运行我的应用程序,它显示线程1使用Twitter框架在我的IOS5,应用发布一条Twitter消息:接收到的节目信号:代码行上的“EXC_BAD_ACCESS”:iOS5twitter.completionHandler = ^(TWTweetComposeViewControllerResult result);

这里的Twitter的代码块:

//代码块

TWTweetComposeViewController *iOS5twitter = [[TWTweetComposeViewController alloc] init]; 

[iOS5twitter addImage:self.item.image];  
[iOS5twitter addURL:self.item.URL]; 

//if I comment out the following block of code, it works. 
iOS5twitter.completionHandler = ^(TWTweetComposeViewControllerResult result) 
{ 
    [self.currentTopViewController dismissViewControllerAnimated:YES completion:nil]; 

    switch (result) { 

     case TWTweetComposeViewControllerResultDone: 
      [self sendDidFinish]; 
      break; 

     case TWTweetComposeViewControllerResultCancelled: 
      [self sendDidCancel];     

     default: 
      break; 
    } 
}; 
//the above code can be commented out, the it works. 

[self.currentTopViewController presentViewController:iOS5twitter animated:YES completion:nil]; 
[iOS5twitter release]; 

//代码块结束

如果我注释掉下面的代码块,它的工作原理和信息可以在Twitter上发布,但唯一的问题是应用程序无法在消息发布成功或不成功时提示对话框。

//if I comment out the following block of code, it works. 

/* iOS5twitter.completionHandler = ^(TWTweetComposeViewControllerResult结果) { [self.currentTopViewController dismissViewControllerAnimated:YES完成:无];

switch (result) { 

     case TWTweetComposeViewControllerResultDone: 
      [self sendDidFinish]; 
      break; 

     case TWTweetComposeViewControllerResultCancelled: 
      [self sendDidCancel];     

     default: 
      break; 
    } 
}; 

*/// 上面的代码可以被注释的那样,它的工作原理。

任何人都可以帮助我弄清楚如何解决EXC_BAD_ACCESS问题,并启用消息发布成功或不成功时提示最终用户?

在此先感谢!


最后,上面的代码工作真实设备(iPhone 4S的ios5.1)没有注释块码,它是如此的陌生,所以如果你也得到了上述问题一个模拟器,我想建议你试试它在真实的设备上。

苹果的问题是为什么我们在模拟器和真实设备之间得到不同的结果,这会让开发人员发疯? ...

回答

0

这不是一个答案,但我不认为我有足够的观点能够发表评论。

我在我的Mac上用SDK 5.1在iPhone模拟器中获得相同的行为。我会建议在这写一个rdar://。

http://bugreport.apple.com