почтовое вложение iPhone

Идея преобразовать в HSV или некоторое другое цветовое пространство кажется хорошей, и может быть необходимой для точной цветной работы, но в обычных целях ошибки работы в RGB не может быть достаточно для имения значение. Кроме того, это может быть боль для контакта с граничными случаями: RGB является пространством, имеющим форму куба, в то время как HSV не. При работе со значениями байта у Вас могут быть many-one и one-many отображения между пробелами. Это может или не может быть проблемой в зависимости от приложения. YMMV

9
задан DShah 22 November 2011 в 15:51
поделиться

2 ответа

Вам не нужно вводить расширение в имя файла. вроде "iphone.jpg" не работает. просто напишите «iphone» в имени файла, потому что вы уже определили mimeType. А также вы должны определить путь к ресурсу.

Ниже приведен пример кода для прикрепления файла "rainy.png" к почте.

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Hello"];


// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"first@example.com"]; 
NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil]; 
NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"]; 

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

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

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

[self presentModalViewController:picker animated:YES];
[picker release];
16
ответ дан 4 December 2019 в 13:03
поделиться

Эта ошибка, похоже, связана с запущенной почтой в симуляторе, а не с вашим кодом. Даже стандартный образец MailComposer от Apple сообщает об идентичной ошибке в симуляторе:

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
ответ дан 4 December 2019 в 13:03
поделиться