標籤:io os ar 使用 檔案 on 問題 html ad
iOS下頻繁請求地理位置授權
做的某個cordova應用有用到geolocation外掛程式,跑在iOS的時候發現app請求了一次授權,結果webkit還請求了一次授權,不但如此,webkit請求的格式還相當醜/var/mobile/Applications/157EB70D-4AA7-826E-690F0CBE0F/appname.app/www/index.html,放狗一搜,果然很多人在聊這個問題,解決方案眾說紛紜,主要cordova本身發展較快變化較大,不能說每個解決都是有效,但也不能說是錯的,結果不帶版本號碼的解決方案變成耍流氓了。時至今日(4.0.0),我的解決如下:
確保在onDeviceReady後才使用navigator.geolocation,順利通過。
在xcode中報找不到外掛程式的異常
報錯一般如下:
ERROR: Plugin ‘Geolocation’ not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
我們需要自行把外掛程式對應的.m檔案在項目設定檔中添加:
In XCode, goto Build Phases -> open the Compiled Sources dropdown. Click + and add the missing plugin .m file that should be in your Plugins directory (but is missing from the compiled sources).
就是在Build Phases / Compile Sources裡面添加未包含進去的外掛程式檔案即可。奇怪的是,之前從沒這麼做過,外掛程式都能正常使用。。。
ios模擬器報錯
這不算問題,保持cordova, ios-sim都為最新版。記錄下來是為了強調這一原則。keep update
cordova開發跨平台應用問題隨筆記