如何使用[[UIApplication sharedApplication] openURL:]打开其他应用程序?

| 我遵循http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html指令在app2(FontTest)中打开app1(GlassButton)。 FontTest的打开方法如下:
-(void)open {

  BOOL res = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@\"glassbutton://\"]];

  if (res) {

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@\"glassbutton://\"]];

  }

}
\“ res \”的值为\“ YES \”,但是在调用openURL方法之后没有任何反应。 \“ FontTest \”的信息列表如下:
URL Schemes: glassbutton

URL identifier: com.yourcompany.glassbutton
我尝试成功通过\“ twitter:// \”和\“ fb:// \”打开twitter和facebook应用程序。但是我不知道为什么我不能打开这个小应用程序。我不确定是否有任何错误/失误?我是否需要为FontTest处理ѭ2if,如果可以,该如何处理?你能帮我吗?提前致谢!     
已邀请:
要请求启动您的应用程序,请使用以下命令:
NSString *urlString= @\"glassbutton://com.yourcompany.glassbutton\";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
然后,在glassbutton应用程序中,您需要处理应用程序委托方法中的任何特殊行为:
 - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {

    //your app specific code here for handling the launch

    return YES;
 }
请注意,在您正在打开的应用程序中,上述委托方法只会在调用以下方法后才被调用:
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
相应地处理,祝你好运。     

要回复问题请先登录注册