在iOS中还有其他方式启动Messages应用程序吗? (捐款)

我们正在尝试提交一个制作慈善短信捐赠的iOS应用程序.过去我们已经做了不少问题,但苹果不再愿意接受我们的方法,并拒绝了我们的应用程序.

他们的说法是该应用不符合指南的第21.2节.哪个是:

21.2 The collection of donations must be done via a web site in Safari or an SMS

在过去,在这个当前的应用程序中,我们在MessageUI框架中使用MFMessageComposeViewController构建SMS消息.我们用这个因为作为一个短码的捐赠,我们需要能够在消息中写一个关键字.

在解决中心(和拒绝争议)中有一点点反复,我可以从苹果那里得到最多的答案,我们应该做的是:

Sending SMS messages from within the app may not be in compliance with the App Store guidelines.

The SMS link should launch Messages to make the donation.

我们可以使用短信:URL scheme启动某个号码的消息应用,但是该方法不允许我们添加我们所需的关键字.

所以问题是:有没有人知道另一种方式启动Messages应用程序?

我们的后备选项是放弃自己建立一条短信,并有一个警告,告诉用户“文字YYYY到ZZZZ”,这是一个很差的用户体验.

更新(2013年3月5日):

我们重新提交了应用程序再次使用我们的只有警报的后备选项…由于同样的原因,它再次被拒绝.我们再次与苹果竞争.

更新(2013年3月6日):

经过严厉的消息,苹果解释了明显的…应用程序已经通过提交.

我写了:

We have to disagree. The app does not include the ability to collect charitable donations within the app. It only informs the user on how they can donate.

所以;如果您有同样的问题,建议您先尝试在“修复”您的应用程序之前先抱怨.

解决方法

是和否

在基本水平上:通过文档查看,您(而非常令人沮丧)无法在外部呼叫消息应用程序时为消息设置正文.

你只能:

>打开消息应用程序

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:"]];

>输入一个号码给消息

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:+1234567890"]];

更复杂:是的.这是发送身体短信的方法和代码.它提供了一个视图,就像消息应用程序作为ModalView一样.并作参考you can read the docs here.

>将MessageUI框架导入到项目中
>将这些添加到发送消息的操作的视图(在我的例子中是单个按钮的简单视图)的视图.

#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMessageComposeViewController.h>

>发送消息的重要代码应该类似于:

-(IBAction)sendSMS:(id)sender {

    if([MFMessageComposeViewController canSendText]) {
        MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
        controller.body = @"Hello";
        controller.recipients = [NSArray arrayWithObjects:@"+1234567890",nil];
        controller.messageComposeDelegate = self;
        [self presentViewController:controller animated:YES completion:nil];
    }
}

上面的代码将不会发送文本或取消视图,因为我们还没有实现messageComposeViewController:didFinishWithResult:method – 这个文档可以读取here.这将如下所示:

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller 
                 didFinishWithResult:(MessageComposeResult)result {
    switch(result) {
        case MessageComposeResultCancelled:
            // user canceled sms
            [self dismissViewControllerAnimated:YES completion:nil];
            break;
        case MessageComposeResultSent:
            // user sent sms
            //perhaps put an alert here and dismiss the view on one of the alerts buttons
            break;
        case MessageComposeResultFailed:
            // sms send failed
            //perhaps put an alert here and dismiss the view when the alert is canceled
            break;
        default:
            break;
    }
}

在每种情况下,您都可以提出警报,关闭视图(如1)或任何应用程序需要的.

我相信这第二个方法应该被批准,或者苹果应该从文档中删除它.关键是canSendText if语句.如果没有实现这个(或者是forFinishWithResult的case切换),Apple肯定会拒绝该应用.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...