Launch Apple Mail App from within my own App?

后端 未结 15 2292
心在旅途
心在旅途 2020-11-29 01:59

What I already found is

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@\"mailto:\"]];

But I just want to open the Mail ap

15条回答
  •  爱一瞬间的悲伤
    2020-11-29 02:22

    Apparently Mail application supports 2nd url scheme - message:// which ( I suppose) allows to open specific message if it was fetched by the application. If you do not provide message url it will just open mail application:

    NSURL* mailURL = [NSURL URLWithString:@"message://"];
    if ([[UIApplication sharedApplication] canOpenURL:mailURL]) {
        [[UIApplication sharedApplication] openURL:mailURL];
    }
    

提交回复
热议问题