[UIApplication sharedApplication] openURL:@""
So, I can't open the URL that contains Japanese. Does anyone have any information?
The console contains
LaunchServices:ERROR:There is no registered handler for URL scheme(null)
appears.
For example, the link below cannot be opened.
[UIApplication sharedApplication] openURL:@"http://name.com";
[UIApplication sharedApplication] openURL:@"instagram://tag?name=grilled meat";
Each one will be opened from Safari, so I think it's a problem with the implementation.
However, if it is a URL that does not contain Japanese, you can open it with the above source code above.
Originally, I opened the URL including Japanese, but I feel like I can't open it after updating to Xcode7.
Please let me know if there is anything I can do.
Thank you for your cooperation.
Punycode encoding is required if the domain name contains Japanese.
Percent encoding is required if the query contains Japanese.
The corresponding libraries were published on GitHub.
Punycode-Cocoa makes it easy to respond.
When I tried it, I found out that
NSString*name=@"http://Name.com";
NSURL*url = NSURL URLWithString: name.encodedURLString;
[[UIAApplication sharedApplication] openURL:url];
started Safari in and the page was displayed correctly.
I opened it with exactly the same code even though the URL is https://www.google.co.jp/search?q=Japanese
.
Therefore, I think instagram://tag?name=yakiniku
can be done with this, too.
© 2024 OneMinuteCode. All rights reserved.