問題描述
我已經按照這篇文章升級了 cordova 3.5 中的地理定位插件以解決 iOS 8 中的問題.
I have upgraded the geolocation plugin in cordova 3.5 to fix the issue in iOS 8 by following this post.
http://shazronatadobe.wordpress.com/2014/09/18/cordova-ios-and-ios-8/
在 iOS8 模擬器中運行應用程序后,我收到通知允許MyApp"在您使用應用程序時訪問您的位置?但是在允許定位服務使用該應用后,它仍然顯示錯誤 locationManager::didFailWithError
(null).我試圖關閉模擬器并一次又一次地運行它.此外,通過檢查模擬器中的設置,位置服務似乎處于活動狀態(設置 > 隱私 > 位置服務 > MyApp > 使用時).通過在 iOS 7 模擬器中運行相同的應用程序可以正常工作并且能夠檢測 lat/lng.
After running the app in iOS8 simulator, I am getting the notification 'Allow "MyApp" to access your location while you use the app?' But it still shows the error locationManager::didFailWithError
(null) after allowing the location service to use the app. I have tried to close the simulator and run it again and again. Also it seems that location service is active (Settings > Privacy > Location services > MyApp > While Using) by checking the settings in the simulator. By running the same app in iOS 7 simulator is working fine and able to detect the lat/lng.
僅供參考:我正在使用 Xcode 6 構建應用程序.
FYI: I am using Xcode 6 to build the application.
任何幫助/建議都會有所幫助.
Any help/suggestion will be helpful.
推薦答案
聽起來很奇怪,但至少在我的 Xcode 6 項目上確實有效.還要確保將所需的密鑰添加到您的 Projectname-info.plist 文件中(例如 NSLocationWhenInUseUsageDescription -> 作為密鑰)
it sounds strange but it really works at least on my Xcode 6 Project. Make also sure to add the required Keys to your Projectname-info.plist file (e.g NSLocationWhenInUseUsageDescription -> as a Key)
接下來檢查您的方案(產品 -> 方案 -> 編輯方案 -> 允許位置模擬)如果您使用的是 gpx 文件,您還可以將其標記為默認位置.
Next check your scheme (Product -> Scheme -> Edit Scheme -> Allow Location Simulation) If you are using a gpx file you can also mark it as a default location.
現在您可以通過按下運行按鈕(播放符號)來啟動您的模擬器.一旦您的應用程序開始,您將收到許可通知.
Now you can start your simulator by pressing the run button (play symbol). As soon as your application started you will get notified for the permission.
現在的最終修復是轉到 iOS Simulator -> Debug -> Location 并通過從列表中選擇一個自定義位置以外的位置來更改位置.稍等一下,如果它沒有自行變回,則將其改回自定義位置.
The final fix now is to go to iOS Simulator -> Debug -> Location and change the location by choosing one out of the list except the custom location. Wait a little and change it back to custom location if it didnt change back by itself.
它對我有用,也希望你問候施瑞達
It worked for me, hope for you too regards Schreda
這篇關于地理定位在 iOS 8 模擬器中不起作用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!