我有一個視圖,用戶可以翻閱其他用戶的配置文件。如果他們願意,用戶可以選擇通過電子郵件發送這些用戶。我遇到的問題只是正在使用的第一個配置文件的電子郵件。從解析表中獲取正確的電子郵件集
例如...
比方說,中有3個配置文件,每個人都有一個唯一的電子郵件。
只有[email protected]是越來越回升。
我應該將這些存儲在一個數組中,並將它們挑出來嗎?
或者是推薦的另一種方法?
編輯:
爲了澄清,我不想在一次電子郵件的每封電子郵件,他們需要是唯一的用戶正在觀看的輪廓。
因此,如果他們看着配置文件C,他們只需要發送電子郵件至[email protected]。
這裏的東西我曾嘗試:
// Profile Generator Method
- (void)createProfile
{
// I use a for loop to create each profile
// in the for loop I set the emails to the array, see below
[self.emailArray addObject:[self.profileObject objectForKey:@"email"]];
// add the emailUser method as a target to a button
}
// My Email Method
- (void)emailUser
{
for (int i = 0; i < [self.emailArray count]; i++)
{
self.emailString = [NSString stringWithFormat:@"%@", [self.emailArray objectAtIndex:i]];
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
[mc setSubject:@"Note"];
[mc setToRecipients:[NSArray arrayWithObject:self.emailString]];
mc.mailComposeDelegate = self;
if([MFMailComposeViewController canSendMail])
{
[self presentViewController:mc animated:YES completion:nil];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device is not configured to send mail." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
}
}
編輯兩個:
當我登錄我emailArray的輪廓正在創建我看到陣列中的所有電子郵件。
當我到達emailUser方法時,只出現一個。
發佈您嘗試過的一些代碼 –