Search code examples
objective-cxcode4ios5

iOS: How can I have my app launch the iMessage app?


I want to launch the iMessage app (built in new feature for iOS 5) from within my own application.. Can some one help me out ??

I know apps can be opened from within an app using openURL:, but whats the URL schema for iMessage??

Thanks in advance !!


Solution

  • From IPhone URL Schemes:

    NSString *stringURL = @"sms:";
    NSURL *url = [NSURL URLWithString:stringURL];
    [[UIApplication sharedApplication] openURL:url];
    

    You can't target iMessage specifically because it is transparent in the system. So you should work with SMS instead, and iMessage will be used if available.