IOS從一個APP跳到另一個APP


以下為跳轉到大眾點評APP代碼如下:

NSString *requestUrlString = @"dianping://shopinfo?id=1000";        
NSURL *requestUrl = [NSURL URLWithString: requestUrlString]; if([[UIApplication sharedApplication] canOpenURL:requestUrl]) { [[UIApplication sharedApplication] openURL:requestUrl]; } else { //沒有安裝應用,默認打開HTML5站 NSString *keywords = [@"吃飯飯" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; requestUrl = [NSURL URLWithString:[NSString stringWithFormat:@"http://m.dianping.com/shoplist/219/search?from=m_search&keyword=%@",keywords]]; [[UIApplication sharedApplication] openURL:requestUrl]; }

 跳轉的過程中可能會出現ERROR:

error: "This app is not allowed to query for scheme dianping"

解決方法是在info.plist文件內添加以下配置項,將其列為白名單才可以正常檢查是否已經安裝此程序。

<key>LSApplicationQueriesSchemes</key>

<array>

        <string>weixin</string>

        <string>wechat</string>

        <string>dianping</string>

</array>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM