How to open our app from iMessage

I had created an app in iMessage that is work perfactly but i want to know how can i open our app from iMessage

Suppose I have one app after that i added iMessage target and from iMessage I want to open my app from iMessage is it possible ?

I tried with this but not succeed

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

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

Error :

Answers


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.


Need Your Help

Recovering a commit made with no branch

git

I copied a directory which included a git repository to another location. I made some changes to some files and made a commit. Then I tried to push these changes but I was told I was not in a branc...

C++ reading from file puts three weird characters

c++ file-io byte-order-mark

When i read from a file string by string, >> operation gets first string but it starts with "i" . Assume that first string is "street", than it gets as "istreet".