当模拟内存警告时,Twitter iOS 5.1上的应用程序崩溃。

时间:2013-02-13 06:32:57

标签: iphone ios5 twitter objective-c-2.0

if ([TWTweetComposeViewController canSendTweet]) {
    // Initialize Tweet Compose View Controller 
TWTweetComposeViewController *vc = [[[TWTweetComposeViewController alloc] init]autorelease];
    // Settin The Initial Text
    [vc setInitialText:status];

    // Setting a Completing Handler
    [vc setCompletionHandler:^(TWTweetComposeViewControllerResult result) {
        if(result == TWTweetComposeViewControllerResultDone) {
                 NSLog(@"Posted ");
        }
    }];     
} else {
    // Show Alert View When The Application Cannot Send Tweets
    NSString *message = @"The application cannot send a tweet at the moment. This is because it cannot reach Twitter or you don't have a Twitter account associated with this device.";
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops" message:message delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
    [alertView show];
}

只要没有内存警告发生,代码就可以正常运行,但是当我模拟设备上的内存警告时,它会使应用程序崩溃。

Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <TWTweetComposeViewController 0xee2dc80> for the key path "contentSize" from <UITextView 0xee3c5e0> because it is not registered as an observer.'

0 个答案:

没有答案