- Home /
Custom URL Scheme iOS
How do you have your Unity iOS app respond when a URL on a webpage (in iOS browser such as Safari) points back to the app?
i bet prime31 have a plugin for that. reach for your paypal account :)
actually, i'm hoping to figure out how to do this. i have the plist stuff setup in iOS but i just need to figure out how to get the unity app to respond
I'm trying to do this, but with no success.
I have added that method to "AppController.mm":
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
if (!url) { return NO; }
NSString *URLString = [url path];
[[NSUserDefaults standardUserDefaults] setObject:URLString for$$anonymous$$ey:@"url"];
[[NSUserDefaults standardUserDefaults] synchronize];
return YES;
}
And that in one of my game object class:
string passedData = PlayerPrefs.GetString("url");
Debug.Log("PlayerPrefs > URL" + passedData);
But the value for key "url" is empty.
Did you get it working? What am I missing?
no, I ended up doing something rather lame - i.e., http poll server for confirm and tell the player to switch back to the app :(
Answer by JaviTheGreat · Aug 24, 2016 at 10:35 AM
Here is the best answer I've seen so far...
http://answers.unity3d.com/questions/654998/launched-from-a-browser.html
thanks to @whydoidoit