[英]iPhone - MessageUI - framework not found Message
我希望能夠在我的應用程序中使用iPhone Mail.app,這樣我的用戶就可以在不離開應用程序的情況下發送共享電子郵件。 我知道3.0使這成為可能。
我通過ctrl單擊我的框架文件夾 - >添加現有框架來正確添加框架。
將此添加到我希望Mail.app出現的viewcontroller的頭文件中。
#import <MessageUI/MessageUI.h>
我彈出一個UIAlert,在關閉時我調用下面的函數,我的代碼中沒有出現錯誤。 我是否必須在Interface Builder中做一些額外的事情? 錯誤消息是在下面
-(void)showEmailModalView {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self; // <- very important step if you want feedbacks on what the user did with your email sheet
NSString * emailSubject = [[NSString alloc] initWithFormat:@"iPhone Subject Test"];
[picker setSubject:emailSubject];
NSString * content = [[NSString alloc] initWithFormat:@"iPhone Email Content"];
// Fill out the email body text
NSString *pageLink = @"http://mugunthkumar.com/mygreatapp"; // replace it with yours
NSString *iTunesLink = @"http://link-to-mygreatapp"; // replate it with yours
NSString *emailBody =
[NSString stringWithFormat:@"%@\n\n<h3>Sent from <a href = '%@'>MyGreatApp</a> on iPhone. <a href = '%@'>Download</a> yours from AppStore now!</h3>", content, pageLink, iTunesLink];
[picker setMessageBody:emailBody isHTML:YES]; // depends. Mostly YES, unless you want to send it as plain text (boring)
picker.navigationBar.barStyle = UIBarStyleBlack; // choose your style, unfortunately, Translucent colors behave quirky.
[self presentModalViewController:picker animated:YES];
[picker release];
[content release];
[emailSubject release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[self dismissModalViewControllerAnimated:YES];
}
我的錯誤信息:
ld: framework not found Message
collect2: ld returned 1 exit status
我遵循了這個教程: http : //blog.mugunthkumar.com/coding/iphone-tutorial-in-app-email/
做了一些研究后我發現我使用的教程非常好! 代碼沒有錯誤,我的問題是我將MessageUI Framework添加到我的項目中的方式。
錯誤道。 按住Ctrl鍵並單擊frameworks文件夾,然后選擇add - > existing frameworks ..
正確的方式。 在xcode屏幕左側的文件面板中打開“目標”,雙擊項目名稱。 將彈出一個新窗口,在新窗口的底部,您可以添加一個新的鏈接庫,通過單擊左下角的小加號添加一個。 向下滾動到MessageUI並選擇Add。
如果您已經以錯誤的方式添加了MessageUI Framework,只需刪除它並繼續正確的方式。 如果仍然無效,請嘗試關閉xcode,重新啟動並重建應用程序。
經過幾個小時的尋找答案,這對我有用。
鏈接器命令行輸出將告訴您很多關於XCode用於嘗試構建二進制文件的內容,包括Framework包含路徑和鏈接器在構建中包含的框架。 從那里,您將能夠准確地看到XCode正在使用的內容以及您的設置中可能缺少的內容。 可以在“構建結果”窗口的其中一個輸出窗格中找到命令行輸出。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.