6

嗨,我在论坛上搜索过,但没有找到帮助,所以我发布了新的。这是场景,我在主 rootviewcontroller 中创建了一个 mfmailcomposeviewcontroller,我通过调用 presentviewcontroller 来显示它,但是当它被关闭时,我得到了这个错误:

error: address doesn't contain a section that points to a section in a object file

我正在使用的代码如下:

-(void) mailButtonTapped
{

if ([MFMailComposeViewController canSendMail]) {

    mailViewController_ = [[MFMailComposeViewController alloc] init];
    mailViewController_.mailComposeDelegate = self;
    [mailViewController_ setSubject:@"Try ..."];
    [mailViewController_ setMessageBody:@"Hey I just tried ..." isHTML:NO];
    NSData *videoData = [NSData dataWithContentsOfURL:movieURL_];
    [mailViewController_ addAttachmentData:videoData mimeType:@"video/quicktime" fileName:@"Video.mov"];
    [self presentViewController:mailViewController_ animated:YES completion:nil];

}

else {

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sharing Not Possible" message:@"Configure your mail to send the mail" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
    [alertView show];
    [alertView release];

    }
}

-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{

NSString *title = @"Email";
NSString *msg = nil;

if (result == MFMailComposeResultFailed)
    msg = @"Unable to send, check your email settings";
else if (result == MFMailComposeResultSent)
    msg = @"Email Sent Successfully!";
else if (result == MFMailComposeResultCancelled || result == MFMailComposeResultSaved)
    msg = @"Sending Cancelled";

UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];

[self dismissViewControllerAnimated:YES completion:nil];

}

解雇后我收到错误:

error: address doesn't contain a section that points to a section in a object file

请帮我

4

5 回答 5

15

我也有这个错误,但有另一种情况。我有一个用@property(赋值,非原子)定义的块属性。

为了解决这个问题,我用@property(复制,非原子)声明了我的块属性。

干杯

于 2013-02-18T17:35:34.467 回答
1

当访问不再存在的对象/指针时会发生此错误。并且还可能导致其他错误访问、0x00000 值访问等错误。

因此,您正在删除/释放指针,然后稍后访问。

通过查看代码,这只是一个没有调试的猜测,您将第二个 AlertView 的委托设置为 self,然后立即关闭视图控制器。

在关闭警报视图或按下按钮后尝试关闭,或者只是将 AlertView 委托设置为 nil。

即使这不完全是错误,主要原因是您在某处释放对象然后尝试调用函数或访问它。

于 2013-09-21T01:33:15.707 回答
0

我也有这个问题,但由一个非常愚蠢的错误引起,我frame在一个继承自的类上编写了一个属性UIView(这是一个UITableViewCell但我认为每个继承自的类都会发生这种情况UIView)这覆盖了原始frame属性并导致了这个错误.

只需更改属性名称即可修复。

于 2013-05-27T14:52:05.320 回答
0

你可以像这样使用它:

MFMailComposeViewController *mailViewController_ = [[MFMailComposeViewController alloc] init];
    mailViewController_.mailComposeDelegate = self;
    [mailViewController_ setSubject:@"Try ..."];
    [mailViewController_ setMessageBody:@"Hey I just tried ..." isHTML:NO];
    NSData *videoData = [NSData dataWithContentsOfURL:movieURL_];
    [mailViewController_ addAttachmentData:videoData mimeType:@"video/quicktime" fileName:@"Video.mov"];
    [self presentViewController:mailViewController_ animated:YES completion:nil];
[mailViewController_ release];
于 2013-05-23T03:43:39.060 回答
-1

完成期望在解雇动画完成时调用一个块。

只需删除“completion:nil”,它应该可以工作!

问候。

于 2013-02-05T15:48:31.630 回答