ios 應用程序之間的跳轉

//被跳轉的應用程序
1.找到偏好設置xx-info.plist
2.新建一行(點擊加號或者右鍵addrow)
3.在item0裏面找到url identifier:設置url標示符(這一步可有可無)
4.在item0裏面點擊加號,新建一行。選擇:url schemes
5.設置url schemes(應用程序跳轉的標誌)

//跳轉的應用程序
//標示符:application1
    //“:”表示分割符,後面可以傳遞參數
    //先用“//”分割,再用”&”分割……
    NSURL* url = [NSURL URLWithString:@"application1://name=application2&pwd=12345"];
    if ([[UIApplication sharedApplication] canOpenURL:url])
    {
        [[UIApplication sharedApplication] openURL:url];
    }else
    {
        UIAlertView* alertView = [[[UIAlertView alloc] initWithTitle:@"提示" message:@"跳轉失敗" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil] autorelease];
        [alertView show];
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章