2009-09-07 24 views
9

Uygulamamdaki eki postayla göndermek için MessageUI çerçevesini kullandım. Ama şu hata var,iphone e-posta eki

2009-09-07 19:52:23.483 emailTest[11711:5b17] 
Error loading /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/DataClassMigrators/AccountMigrator.migrator/AccountMigrator: dlopen(/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/DataClassMigrators/AccountMigrator.migrator/AccountMigrator, 265): Library not loaded: /System/Library/PrivateFrameworks/MobileWirelessSync.framework/MobileWirelessSync 

Referenced from: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/DataClassMigrators/AccountMigrator.migrator/AccountMigrator 

     Reason: image not found 

2009-09-07 19:52:23.489 emailTest[11711:5b17] [+[AccountsManager _migrateAccountsIfNeeded]] Accounts migration failed 
[Switching to process 11711 local thread 0xf03] 

benim kodu

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc]init]; 
picker.mailComposeDelegate = self; 
[picker setSubject:@"This is iPhone email attachment test"]; 

UIImage *sampleImg = [UIImage imageNamed:@"iPhone.jpg"]; 
NSData *imageData = UIImageJPEGRepresentation(sampleImg, 1); 
[picker addAttachmentData:imageData mimeType:@"image/png" fileName:@"iPhone.jpg"]; 


NSString *emailBody = @"I am sending the image attachment with iPhone email service"; 
[picker setMessageBody:emailBody isHTML:YES]; 

[self presentModalViewController:picker animated:YES]; 
[picker release]; 

bana yardım edin.

+0

Daha belirgin olun - eki oluşturmak için hangi kodu çalıştırıyorsunuz? Mesajı ayırmak için? "MessageUI çerçevesini kullanarak" tam olarak nasılsınız? – Tim

+0

lütfen kodu inceleyin. – SST

+0

Merhaba, kodunuzu çalıştı mı. E-postada gönder düğmesine dokunulurken de aynı mesajı aldım. Ancak, postayla ek eklemiyorum. İptal düğmesine dokunduğumda posta denetleyicisini reddedemedim. Posta denetleyicisini cocos2d katmanına ekliyorum. Herhangi bir yardım lütfen. Teşekkür ederiz. –

cevap

16

Dosya adınızda uzantı yazmanız gerekmez. "iphone.jpg" gibi çalışmıyor. mimeType'ı zaten tanımladığınız için dosya adına "iphone" yazın. Ve ayrıca kaynak için yol tanımlamanız gerekir.

"rainy.png" dosyasını postayla eklemek için örnek kod aşağıdadır.

0

Bu hata, kod çalıştıran sim mektubu ve çalışan posta ile ilişkili gibi görünüyor. Hatta stok Apple'ın örnek MailComposer simülatörü özdeş hata bildirir:

2009-11-12 20:30:39.270 MailComposer[7426:4f1f] Error loading /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/DataClassMigrators/AccountMigrator.migrator/AccountMigrator: dlopen(/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/DataClassMigrators/AccountMigrator.migrator/AccountMigrator, 265): Library not loaded: /System/Library/PrivateFrameworks/MobileWirelessSync.framework/MobileWirelessSync 
    Referenced from: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/DataClassMigrators/AccountMigrator.migrator/AccountMigrator 
    Reason: image not found 
2009-11-12 20:30:39.271 MailComposer[7426:4f1f] [+[AccountsManager _migrateAccountsIfNeeded]] Accounts migration failed 
+0

Merhaba, Kayıtta aynı şeyi alıyorum. Posta denetleyicisine kapat veya gönder düğmesine dokunduğumda. Posta denetleyicisini cocos2d katmanına ekliyorum. Ve ben "kod simülatörü değil, kodunuzu çalıştıran" almıyorum. Bu ne ? onu değiştirebilir miyiz? Teşekkür ederiz. –

0

Ekleme aşağıdaki yöntem MFMailComposeViewController görevden:

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

{ 
// NEVER REACHES THIS PLACE 
[self dismissModalViewControllerAnimated:YES]; 

NSLog (@"mail finished"); 
} 
+0

İyi bir nokta, ama buradaki sorun muhtemelen bu değil ... btw, 'MFailComposeResult' yerine MFMailComposeResult' olmalıdır. – newenglander

0

kullanım ios 4,5 test, bir postada resim eklemek için bu, 6

MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init]; 
    UIImage *myImage = [UIImage imageNamed:@"image.png"]; 
    NSData *imageData = UIImagePNGRepresentation(myImage); 
    [mailer addAttachmentData:imageData mimeType:@"image/png" fileName:@"image"];