URL schemeã使ã£ã¦ã¢ããªãèµ·åãã
(2011/11/05 追è¨)
Xcode 4.2ã§ã¯è¨å®ããç®æãå¤ããã¾ããã®ã§æ°ãã解説ãæ¸ãã¾ããã
URL schemeã使ã£ã¦ã¢ããªãèµ·åãã(Xcode 4.2ã®å ´å) - å¼·ç«ã§é²ã
http://d.hatena.ne.jp/nakamura001/20111105/1320501005
(追è¨ããã¾ã§)
iPhoneã§ã¯URL schemeã使ã£ã¦ã¢ããªãèµ·å(åæã«å¼æ°ã渡ããã¨ãå¯è½)ãããã¨ãã§ãã¾ãã
å ¬å¼ã®ããã¥ã¡ã³ãã¯ãã¡ãã«ãªãã¾ãã
iOS Application Programming Guide: Implementing Common Application Behaviors
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StandardBehaviors/StandardBehaviors.html#//apple_ref/doc/uid/TP40007072-CH4-SW50
URL schemeã«å¯¾å¿ããã¢ããªãèµ·å
ããã§ã¯ä¾ã¨ãã¦ç¡æã®ã¢ããªã§URL schemeã«å¯¾å¿ãã¦ããWikiamoãä¾ã«è§£èª¬ããã¾ããå®æ©ã§ãã¹ãããå ´åã¯こちらããã¤ã³ã¹ãã¼ã«ãã¦ããã¦ä¸ããã
Wikiamoã¯Wikipediaãé²è¦§ã§ããã¢ããªã§ããURL schemeã®è¨è¿°ã«ã¤ãã¦ã¯ãã¡ãã«èª¬æãæãã¾ãã
Wikiamo 1.3 ãªãªã¼ã¹ - Windchase
http://d.hatena.ne.jp/Psychs/20081110/1226267064
ä¾ã¨ãã¦ãdogãã®ãã¼ã¸ãéãå ´åã®ããã°ã©ã ã¯ä»¥ä¸ã®æ§ã«ãªãã¾ãã
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"wikiamo://en.wikipedia.org/wiki/dog"]];
ã¡ã¼ã«ã«ã¦ä»¥ä¸ã®URLãiPhoneéãããããã¯ãªãã¯ãã¦èµ·åãã¹ãããããã¨ãå¯è½ã§ãã
â»ããã§ã¯URLã <> ã§æãã§ãã¾ãããããçç¥ããã¨URLã¨ãã¦æ±ãããªãã®ã§å¸¸ã«ä»ããæ§ã«ãã¦ä¸ããã
<wikiamo://en.wikipedia.org/wiki/dog>
(2011/07/06 追è¨)
ç¾å¨ã§ã¯ <> ã§æãã§ãURLã¨ãã¦æ±ãããªããªã£ãã¿ããã§ãã
(追è¨ããã¾ã§)
URL schemeã«å¯¾å¿ããã¢ããªãä½ã
次ã«URL schemeã«å¯¾å¿ããã¢ããªãä½ãæ¹æ³ã解説ãã¾ãã
(2011/07/06 ä¿®æ£&追è¨)
ã¾ãã¯plistãã¡ã¤ã«ã表示ãã¦ããç»é¢ã§å³ã¯ãªãã¯ãã¡ãã¥ã¼ã®ä¸ãããShow Raw Keys/Valuesããã¯ãªãã¯ã
次ã«ä»¥ä¸ã®æ§ãªæ§æã§ãCFBundleURLTypesãã®ãã¼ã¿ãä½æãã¾ãããItem 0ãã®ValueTypeã¯DictonaryããCFBundleURLSchemesãã®ValueTypeã¯Arrayã«æãã¾ãã
ãªãã com.example.test 㨠test ã«ã¤ãã¦ã¯ä»®ã®ãã®ã§ããå®éã«ä½¿ç¨ããå ´åã«ã¯å¤ãå¤æ´ãã¦ä¸ããã
å®ç¾©ã¯è¤æ°è¨è¿°ããäºãå¯è½ã§ãã
(ä¿®æ£&追è¨ããã¾ã§)
ãã¾ãå¤æ´ãããã¨ã¯ç¡ãã¨æãã¾ããã©ãããã¯ãåãå¤æ´ãããå¯è½æ§ãèããã¨ä»¥ä¸ã®æ§ã«è¨è¿°ããæ¹ãè¯ãããããã¾ããã
URL schemeã§ã¢ããªãå¼ã°ããã¨ãã«ã¢ããªå´ã«ã¯ application:handleOpenURL: ã¨ããã¡ã½ãããå¼ã°ãã¾ãããã®ã¡ã½ããã®ä¸ã§Query(å¼æ°)ãå¦çãã¦ã¢ããªã®åä½ã«åæ ããã¾ãã
ãµã³ãã«ã¨ãã¦ã¡ã½ãããå¼ã°ããã¨ãã®URLæ å ±ãã¢ã©ã¼ã表示ããã¢ããªãこちらã«ä½æãã¾ããã
主ãªããã°ã©ã ã¯ä»¥ä¸ã¨ãªãã¾ãã
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { NSString* msg = [NSString stringWithFormat:@"[URL]%@\n[schame]%@\n[Query]%@", [url absoluteString], [url scheme], [url query]]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"debug" message:msg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alert show]; [alert release]; return YES; }
ããã°ã©ã ãå¼ã¶URL schemeã®è¨è¿°ã¯ Info.plist ã«è¨å®ãããURL identifierããURL Schemesã®Itemãã使ç¨ãã
[URL Schemesã®Item]://[URL identifier]?[Query(å¼æ°)]
ã®å½¢ã«ãªãã¾ããå®éã®ãã¼ã¿ãå½ã¦ã¯ãããã®ã¯ãã¡ã
Scheme://Scheme.yourcompany.com?a=1&b=2&c=3
å®éã«å¼ã³åºãã¦ã¿ãå ´å㯠Wikiamo ã®å ´åã¨åæ§ãªä»¥ä¸ã®ããã°ã©ã ãå®è¡ãã¦ãè¯ãã®ã§ãã
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"Scheme://Scheme.yourcompany.com?a=1&b=2&c=3"]];
ã¡ã¼ã«ã®å ´åã¯ãããªãã¾ãã
<Scheme://Scheme.yourcompany.com?a=1&b=2&c=3>
ä»åã®è§£èª¬ã§ã¯Queryã a=1&b=2&c=3 ã¨ããå½¢å¼ã使ç¨ãã¦ãã¾ããå¾ã§ã¢ããªå´ã§åå²ãããã¨ãèãã㨠Wikiamo ã®æ§ã« / ã使ã£ãå½¢å¼ã«ããæ¹ãè¯ãã¨æãã¾ãã
<Scheme://Scheme.yourcompany.com/a/1/b/2/c/3>
â»ãã®å ´åã [url query] ã«å¤ã¯ç¡ãã®ã§ [url absoluteString] ã®æååã / ã§åå²ãããã®ã使ç¨ãããã¨ã«ãªãã¾ãã
(2010/07/24 追è¨)
URL schemeã使ã£ã¦ããã¢ããªã®æ
å ±ãã¾ã¨ãã¦ãããµã¤ããç»å ´ãã¾ãããããã¯ãããããã
Home - handleOpenURL:
http://handleopenurl.com/
(2011/10/09 追è¨)
URL schemeã¯ä½¿ç¨ãã¦åé¡ç¡ãæ©è½ã®ã¿ã§ä½¿ç¨ããªãã¨åé¡ã«ãªãå ´åãæãã¾ãã
ãã®è¾ºãã«ã¤ãã¦ã®è§£èª¬ã¯ãã¡ãã®ãµã¤ãã®ãã»ãã¥ãªãã£ãã®é ç®ã詳ããã§ããä¸èªããå§ããã¾ãã
ããµéçºæ¥è¨: iOSã§ç¬èªã«ã¹ã¿ã URLã¹ãã¼ã ãè¨å®ããæ¹æ³ã«ã¤ãã¦
http://safx-dev.blogspot.com/2010/10/iosurl.html