2014-09-17 37 views
51

Xcode 6 dan iOS 8'de eposta soğukkanlılığını açmaya çalışırken, ancak bir hata alıyorum.Eposta soğukkanlılık iOS 8

https://developer.apple.com/library/content/samplecode/MessageComposer/Introduction/Intro.html

Ama sonuç aynıdır: Xcode 5. itibaren çalışıyorum eğer aynı kod Daha sonra elma geliştirici portalından bir örnek kod indirilen iyi çalışıyor. Ben burada

Xcode 6 kodunu optimize etmek özlüyorum şey, ya da bazı ayar var mı kodudur: benim düğmesi eylem

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; 

picker.mailComposeDelegate = self; 

[picker setSubject:@"Hello from California!"]; 

// Set up recipients 
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"]; 
NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]", @"[email protected]", nil]; 
NSArray *bccRecipients = [NSArray arrayWithObject:@"[email protected]"]; 

[picker setToRecipients:toRecipients]; 
[picker setCcRecipients:ccRecipients]; 
[picker setBccRecipients:bccRecipients]; 

// Attach an image to the email 
NSString *path = [[NSBundle mainBundle] pathForResource:@"rainy" ofType:@"jpg"]; 
NSData *myData = [NSData dataWithContentsOfFile:path]; 
[picker addAttachmentData:myData mimeType:@"image/jpeg" fileName:@"rainy"]; 

// Fill out the email body text 
NSString *emailBody = @"It is raining in sunny California!"; 
[picker setMessageBody:emailBody isHTML:NO]; 

[self presentViewController:picker animated:YES completion:NULL]; 

eposta temsilci

self.feedbackMsg.hidden = NO; 
// Notifies users about errors associated with the interface 
switch (result) 
{ 
    case MFMailComposeResultCancelled: 
     self.feedbackMsg.text = @"Result: Mail sending canceled"; 
     break; 
    case MFMailComposeResultSaved: 
     self.feedbackMsg.text = @"Result: Mail saved"; 
     break; 
    case MFMailComposeResultSent: 
     self.feedbackMsg.text = @"Result: Mail sent"; 
     break; 
    case MFMailComposeResultFailed: 
     self.feedbackMsg.text = @"Result: Mail sending failed"; 
     break; 
    default: 
     self.feedbackMsg.text = @"Result: Mail not sent"; 
     break; 
} 

[self dismissViewControllerAnimated:YES completion:NULL]; 

sonuç içinde :

email composure delegate disappearing automatically with result 0, i.e., MFMailComposeResultCancelled

with error codes : MessageComposer[10993:196902] viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x7b93f7e0 {Message=Service Connection Interrupted}

ve

2014-09-17 22:04:22.538 MessageComposer[10993:205761] timed out waiting for fence barrier from com.apple.MailCompositionService

+2

hata nedir? Sorunuzdaki ilgili kodu gösterin. – rmaddy

+0

Yine, hata nedir? Hangi çizgi? – rmaddy

+0

Bu soruya göz atın: http://stackoverflow.com/questions/25604552/i-have-real-misunderstanding-with-mfmailcomposeviewcontroller-in-swift-ios8-in – hoiberg

cevap

103

Görünüşe göre, bu yalnızca bir simülatör sorunudur. (iOS 8 simülatörü) globalMailer yaklaşımı, cihazlarda işe yarıyor.

kimse bu sorunla karşılaşırsa, sadece gerçek bir cihazda test edin.

+0

Sorun sadece simülatörde de vardı. Test uçuşu ile cihaz üzerinde test edildi ve iyiydi. iyi çalışıyor ben ama gerçek cihazda da iOS simülatörü aynı sorun var gayet de – mikebz

+1

:) – Jesus

+0

çalışacak iOS7.1 kodunuzu çalıştıran bir Simülatörü üzerinde test yapmak eğer – ilovebali