How to open our app from iMessage

别来无恙 提交于 2019-12-06 09:44:07

Finally Problem solved. I've been to the Build Settings of my app again and stumbled over

First time i set to YES. The default though is NO. When I set this to NO the error disappeared. i am also shocked with this results

I assume you have a main App already working (besides the iMessage extension).

Go to your main app's Info.plist create a new URL Types structure like this

URL Types -> URL Schemes -> Your_App_Name_No_Spaces

After this you can go to your app extension

NSString *customURL = @"appName://";

 if ([[UIApplication sharedApplication] 
canOpenURL:[NSURL URLWithString:customURL]])
 {
     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
  }

In your subclass of MSMessagesAppViewController, there is a property extensionContext, of type NSExtensionContext. That object can open URLs for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!