English 中文(简体)
缩略语
原标题:iPhone iOS 5 SDK in app SMS error
  • 时间:2012-04-13 04:33:59
  •  标签:
  • ios5

每当我呼吁在SMS中预设一个错误,即出现以下错误......

申请试图在目标上推向一位无望控制者。

这是我在第4号职业介绍所工作的守则。

MFMailComposeViewController *MailController;
MFMessageComposeViewController *SMScontroller;
NSError *error;
NSString *EmailMessage;
NSString *SubjectMessage;

-(IBAction)sendInAppSMS
{

    if([MFMessageComposeViewController canSendText])
    {
        SMScontroller = [[MFMessageComposeViewController alloc] init];
        SMScontroller.messageComposeDelegate = self;

        NSString *MessageString = @"Hello";

        SMScontroller.body = MessageString;

        SMScontroller.navigationBar.tintColor = [UIColor blackColor];

        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];

        [self presentModalViewController:SMScontroller animated:YES];

        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
    }
    else{
        // alertView to tell user to setup a mail account. 
        NSString *message = [[NSString alloc] initWithFormat:@"To use this feature, you need to have an iPhone with SMS abilities."];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"SMS Account Not Detected" message:message delegate:nil cancelButtonTitle:@"Understood" otherButtonTitles:nil];
        [alert show];
    }

}

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
    switch (result) {
        case MessageComposeResultCancelled:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"I Like It" message:@"User cancelled sending the SMS"
                                                           delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
            [alert show];
        }
            break;
        case MessageComposeResultFailed:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"I Like It" message:@"Error occured while sending the SMS"
                                                           delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
            [alert show];
        }
            break;
        case MessageComposeResultSent:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"I Like It" message:@"SMS sent successfully..!"
                                                           delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
            [alert show];
        }
            break;
        default:
            break;
    }

    [self dismissModalViewControllerAnimated:YES];
}
最佳回答

我认为,如果你在模拟中这样做的话,你就会错过错,因为它有ms。 在模拟器中,我有同样的错误,但如果我与我的电话连接,我会做罚款。

问题回答

暂无回答




相关问题
New Notification Center

Is there a way to show a notification in the notification center without having push notifications enabled? For example if an email fails to send is there a way i can create a string and display it in ...

submit an ios app using ios5 OS and ios5 sdk

I m wondering if I can install IOS 5 and the IOS 5 SDK and still be able to develop and submit apps to Apple? Or once I install IOS 5 I m forced to install the IOS5 SDK (from what I understand I can t ...

What s new for web developers in iOS 5 Safari?

From the Apple WWDC we have learned that iOS Safari 5 has tabs, and the new Reader and Reading List functionality. None of which is particularly informative for web developers. What are the new ...

iOS - AudioSession Cateogry for AudioUnit Application

I am working on streaming audio player application for iOS. currently i am experimenting with AudioQueue and AudioUnit for playback. Both works fine in the normal condition. But I am facing an issue ...

Couldn t register with the bootstrap Server

I just changed some code in my program and got this error: Couldn t register com.yourcompany.XXX with the bootstrap server. Error: unknown error code. This generally means that another ...

Unable to manage orientation with multiple view controllers

I m trying to build an iPhone application that has two subviews in the main window. Each view has its own UIViewController subclass associated with it. Also, within each controller s implementation, I ...

热门标签