이전 응용 프로그램 중 하나를 업데이트하는 데 문제가 있습니다. 이는 Xcode 4.5로 업데이트 한 이후이며 iOS6에서 다음 오류를 발생시킵니다. ;UIViewControllerHierarchyInconsistency -보기는 한 번에 하나의보기 컨트롤러에서만 가능합니다.
*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <MainView: 0x1e818620; frame = (0 0; 320 476); autoresize = RM+BM; layer = <CALayer: 0x1e818750>> is associated with <MainViewController: 0x1e811850>. Clear this association before associating this view with <UIViewController: 0x21149860>.'
* 먼저 던져 호출 스택 : (0x377d82a3 0x35ae897f 0x377d81c5 0x38b0dd7b 0x38b0dc6b 0x1dc25 0x38b940ad 0x38b9405f 0x38b9403d 0x38b938f3 0x38b93de9 0x38abc5f9 0x38aa9809 0x38aa9123 0x37c5c5a3 0x37c5c1d3 0x377ad173 0x377ad117 0x377abf99 0x3771eebd 0x3771ed49 0x37c5b2eb 0x38afd301 0x1bf03 0x1bea8) 의 libC++ abi.dylib : 예외를 throw하는 호출을 종료합니다 [프로세스 9219 스레드 0x2403으로 전환]
나는 그것이 문제의 원인이라고 생각합니다.
mailComposer = [[UIViewController alloc] init];
[mailComposer setView:self];
[mailComposer setModalTransitionStyle: UIModalTransitionStyleCoverVertical];
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;
I 앱이 밖으로 충돌 할 때입니다 MFMail 작곡가에 저를 취해야 버튼을 클릭하면 그대로
.아이디어가 있으십니까? 사전에
감사
편집 - 내가 처음 3 줄을 제거하면 응용 프로그램은 그러나 메일보기가로드되지 않습니다 밖으로 충돌하지 않습니다 ... 여기에 전체 코드입니다;
// The actual mail window call
mailComposer = [[UIViewController alloc] init];
[mailComposer setView:self];
[mailComposer setModalTransitionStyle: UIModalTransitionStyleCoverVertical];
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;
[picker setSubject:@"Hello How are you"];
// Fill out the email body text
NSString *pageLink = @"http://www.apple.com";
NSString *iTunesLink = @"http://itunes.apple.com/gb/artist/randomer";
NSString *content = @"blah blah";
NSString *emailFileName = [NSString stringWithFormat:@"email_.html"];
NSString *emailFilePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: emailFileName];
NSString *body = [NSString stringWithContentsOfFile:emailFilePath encoding:NSUTF8StringEncoding error:nil];
body = [body stringByReplacingOccurrencesOfString:@"//TEXT_PLACEHOLDER//" withString:@"replace here"];
body = [body stringByReplacingOccurrencesOfString:@"//FRIENDNAME_PLACEHOLDER//" withString:pageLink];
body = [body stringByReplacingOccurrencesOfString:@"//ITUNES_PLACEHOLDER//" withString: iTunesLink];
body = [body stringByReplacingOccurrencesOfString:@"//PASSKEY_PLACEHOLDER//" withString: yourPassword];
body = [body stringByReplacingOccurrencesOfString:@"//PHONETIC_PLACEHOLDER//" withString: yourPhoneticPassword];
[picker setMessageBody:body isHTML:YES];
picker.navigationBar.barStyle = UIBarStyleBlack;
[mailComposer presentModalViewController:picker animated:YES];
[picker release];
}
//HANDLE THE MAIL EVENTS
////////////////////////
(공극) mailComposeController (MFMailComposeViewController *) 컨트롤러 didFinishWithResult (MFMailComposeResult) 결과 오류 (NSError *) 오류 { 는 // 에러에 대해 사용자에게 알려 인터페이스와 연결된 스위치 (결과) { 경우 MFMailComposeResultCancelled : 휴식; case MFMailComposeResultSaved : 휴식; 경우 MFMailComposeResultSent : 휴식; 경우 MFMailComposeResultFailed : 휴식;
default: { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Email" message:@"Sending Failed - Unknown Error :-(" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert release]; } break;
} [mailComposer dismissModalViewControllerAnimated : YES]; //[mailComposer.view.superview removeFromSuperview]; }
이 행의 기능은 무엇입니까? 여기에 '자기'란 무엇입니까? '[mailComposer setView : self]; ' – mifki
당신은 마지막 줄 만 있으면됩니다. 처음 3 줄은 무엇입니까? – Raptor
아이디어가 있으십니까?여기에서 고생하고 있습니다 : ( – user1695971