我们正在尝试提交一个 iOS 应用程序,该应用程序可以进行慈善短信捐赠。我们过去已经毫无问题地完成了其中的一些工作;但 Apple 不再愿意接受我们的做法并拒绝了我们的应用程序。
他们声称该应用不符合准则的第 21.2 点。即:
21.2 The collection of donations must be done via a web site in Safari or an SMS
过去,在当前这个应用程序中,我们在 MessageUI
框架中使用 MFMessageComposeViewController
来构建 SMS 消息。我们使用这个是因为;作为对短代码的捐赠,我们需要能够在消息中写入关键字。
在调解中心反复讨论(和拒绝纠纷)后,我能从 Apple 那里得到的关于我们应该做的最多的事情是:
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为特定号码启动消息应用程序,但该方法不允许我们添加所需的关键字。
所以问题是:有没有人知道另一种启动消息应用程序的方法?
我们的后备选择是放弃自己构建 SMS 消息,并发出警告告诉用户“将 YYYY 发送到 ZZZZ”,这是一种非常糟糕的用户体验。
更新(2013 年 3 月 5 日):
我们再次使用仅警报后备选项重新提交了该应用程序……由于同样的原因再次被拒绝。我们再次与 Apple 竞争。
更新(2013 年 3 月 6 日):
在向 Apple 发出严厉的信息解释显而易见的事情之后...应用已通过提交。
我写道:
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"]];
更复杂:是的。这是发送带有正文的 SMS 的方法和代码。它以 ModalView 的形式呈现与消息应用程序完全一样的 View 。并供引用 you can read the docs here 。
将
MessageUI
框架导入您的项目将这些添加到 View 的 .h 中,发送消息的操作处于打开状态(在我的例子中是一个只有一个按钮的简单 View )。
#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]; } }
上面的代码不会发送文本或取消 View ,因为我们还没有实现 messageComposeViewController:didFinishWithResult:
方法 - 可以阅读 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;
}
}
在每种情况下,您都可以显示警报、关闭 View (如情况 1)或您的应用所需的任何内容。
我确信第二种方法应该得到批准,否则 Apple 应该将其从他们的文档中删除。关键是 canSendText
if 语句。如果这个(或 didFinishWithResult
的大小写切换)没有实现,Apple 肯定会拒绝该应用。
关于ios - 在 iOS 中是否有另一种启动消息应用程序的方法? (用于捐赠),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14871949/