2012-06-11 77 views
0

在我的應用程序中,我使用MFMailComposer發送電子郵件。Iphone使用MFMailComposer以編程方式發送電子郵件?

在我的應用程序中,用戶可以選擇他想要發送和發送郵件的時間。

它工作正常。但我所做的是,我用NSTimer打開MFMailComposeViewController,我有編程方式單擊發送按鈕。

但我不確定,那個蘋果可能會批准我的應用或拒絕。 有沒有人有使用這種類型的功能在那裏的應用程序和蘋果已批准或拒絕那裏的應用程序。請讓知道。

請幫我一把。

下面是我的代碼:

-(void)showController { 
    MFMailComposeViewController *mailController; 
    //alloc, init, set properties, do whatever you normally would 
    [self.navigationController presentModalViewController:mailController animated:YES]; 
    [mailController release]; 

    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(sendMail:) userInfo:mailController repeats:NO]; 
} 

-(void)sendMail:(NSTimer*)theTimer { 
    MFMailComposeViewController *mailController = theTimer.userInfo; 
    UIBarButtonItem *sendBtn = mailController.navigationBar.topItem.rightBarButtonItem; 
    id targ = sendBtn.target; 
    [targ performSelector:sendBtn.action withObject:sendBtn]; 
} 
+0

這不是'MFMailComposeViewController'的預期行爲。我不會推薦做這樣的事情,蘋果很可能會拒絕你的應用程序使用這種自動電子郵件的方法。 – skram

+0

我可以建議尋找一些背景電子郵件發送代碼,如接受的答案在這裏:http://stackoverflow.com/questions/6284599/mfmailcomposeviewcontroller-question-locking-the-fields – Luke

回答

0

您需要確認與用戶。用戶將點擊發送按鈕。您只能創建郵件並顯示給用戶進行確認。它的默認行爲是MFMailComposeViewController。

謝謝

相關問題