Objective c 错误:地址不为';t包含指向对象文件中某个节的节

Objective c 错误:地址不为';t包含指向对象文件中某个节的节,objective-c,Objective C,嗨,我已经在论坛上搜索了这里,但是没有找到任何帮助,所以我发布了新的。下面是一个场景,我正在主rootviewcontroller中创建一个mfmailcomposeviewcontroller,我通过调用presentviewcontroller来显示它,但当它被解除时,我得到以下错误: error: address doesn't contain a section that points to a section in a object file 我使用的代码如下所示: -(void)

嗨,我已经在论坛上搜索了这里,但是没有找到任何帮助,所以我发布了新的。下面是一个场景,我正在主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

请帮助我

完成需要在解雇动画完成时调用一个块

只要删除“completion:nil”就可以了


问候。

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

为了解决这个问题,我用@property(copy,nonatomic)声明了我的块属性


干杯

您可以这样使用它:

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];

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


只需更改属性名即可修复

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

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

通过查看代码(这只是一个猜测,没有调试),您将第二个AlertView的委托设置为self,但随后立即关闭viewcontroller

尝试在解除警报视图或按下按钮后解除警报,或者可能只是将警报视图委托设置为零


即使这不完全是错误,主要原因是您在某个地方释放了一个对象,然后试图调用函数或访问它

我尝试在解除ViewController后释放mailViewController,但没有运气在didFinishWithResult方法中设置一个断点,并告诉是否达到该断点。如果进入此处,它也会显示alertview。当该视图被驳回,而之前的视图出现时,问题就会出现。感谢这个问题,很明显,但不可能单独找到它--'completion:nil很好。。。在任何情况下都不应该产生问题。