簡體   English   中英

通過iPhone模擬器中的MFMessageComposeViewController難以獲得SMS的功能

[英]Difficulty obtaining capability to SMS via MFMessageComposeViewController in the iPhone simulator

我是iPhone開發的新手。

這是我的問題。 我想在將iPhone模擬器部署到手機上之前對其進行“設備短信功能”檢查。 這是我在.m文件中編寫的代碼。 這是觸發我的SMS按鈕時調用的功能。

    Class messageClass = (NSClassFromString(@"MFMessageComposeViewController"));
 if (messageClass != nil)
 {
   NSLog (@" \ntxting\n");
  // We must always check whether the current device is configured for sending messages
  if ([messageClass canSendText] == TRUE)
  {
   NSLog (@"canSendText is not passingg"); //Not entering this loop
   [self displayTextSheet];
  }

問題是if循環不會進入。 我想知道Messageview控制器是否根本不會在模擬器中彈出,而僅在電話中彈出。

請指教。

更新:我在messageClass if循環中添加了一個NSLog,並被打印出來。 所以messageClass不是'nil'

模擬器無法發送SMS,因此[messageClass canSendText]在該處運行且您的if子句未執行時返回NO。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM