[英]Difficulty obtaining capability to SMS via MFMessageComposeViewController in the iPhone simulator
I am new to iPhone developement. 我是iPhone开发的新手。
Here is my question. 这是我的问题。 I would like to do a 'device texting capability' check on my iPhone simulator before I deploy it to my phone.
我想在将iPhone模拟器部署到手机上之前对其进行“设备短信功能”检查。 This is the code I wrote in the .m file.
这是我在.m文件中编写的代码。 This is the function which is called when my SMS button is triggered.
这是触发我的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];
}
The problem is that the if-loop does not enter. 问题是if循环不会进入。 I was wondering if the Messageview controller does not pop up in the simulator at all and only for the phone.
我想知道Messageview控制器是否根本不会在模拟器中弹出,而仅在电话中弹出。
Please advice. 请指教。
Update: I have added a NSLog in the messageClass if loop and that gets printed. 更新:我在messageClass if循环中添加了一个NSLog,并被打印出来。 so messageClass is not 'nil'
所以messageClass不是'nil'
模拟器无法发送SMS,因此[messageClass canSendText]
在该处运行且您的if子句未执行时返回NO。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.