2013-03-14 96 views
0

我正在使用RSS應用程序,需要通過消息發送文章的URL。我到目前爲止這段代碼,iOS中的消息應用程序無法正常工作

MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init] ;{ 
      if([MFMessageComposeViewController canSendText]) 
      { 
       controller.body = @"Check Out This Informtaion, %@", [NSURL URLWithString:self.feedItem[@"url"]]; 
       controller.recipients = [NSArray arrayWithObjects: nil]; 
       controller.messageComposeDelegate = self; 
       [self presentModalViewController:controller animated:YES]; 
      }} 

,它會工作,它開闢了應用程序內的消息,但所有它在郵件中說的是

Check Out This Information, %@

當我做同樣的

[NSURL URLWithString:self.feedItem[@"url"]];

對外開放的頁面在Safari瀏覽器,它的工作原理,這樣是正確的,但我不知道如何解決它,請HEL頁。

回答

2

這條線:

controller.body = @"Check Out This Informtaion, %@", [NSURL URLWithString:self.feedItem[@"url"]]; 

相當於

controller.body = @"Check Out This Informtaion, %@"; 
[NSURL URLWithString:self.feedItem[@"url"]]; 

...因爲這兩種說法都是獨立執行。

正如user2056143指出的,您錯過了一個NSString-stringWithFormat:圍繞您的值。 I .: .:

controller.body = [NSString stringWithFormat:@"Check Out This Informtaion, %@", [NSURL URLWithString:self.feedItem[@"url"]]]; 
+0

我會在幾分鐘內嘗試這個,現在無法訪問我的Mac,謝謝 – Steve 2013-03-15 01:02:13

+0

當我在想它時,你們是否知道一個堆棧溢出的問題,用於實現Safari瀏覽器ios中的共享按鈕應用程序。帶有圖標和不同分享選項的那個。 – Steve 2013-03-15 01:07:26

+0

是對UIActivityViewController的搜索 – 2013-03-15 02:32:04

1

更改身體:

controller.body = [NSString stringWithFormat:@"Check Out This <a href=\"%@\">Information<\a>", self.feedItem[@"url"]]; 
+1

我已經修復了格式(用4個空格開始一行代碼),但我不認爲你需要爲此使用HTML;郵件正文可能只是純文本。 – 2013-03-15 00:14:47

相關問題