[英]Parse geopoint swift not getting current location
嘗試使用解析PFGeoPoint.geoPointForCurrentLocationInBackground
來獲取當我向后端發送內容時的當前位置。 代碼看起來像
NSLog("Before block")
PFGeoPoint.geoPointForCurrentLocationInBackground {
(geoPoint: PFGeoPoint!, error: NSError!) -> Void in
NSLog("inside block")
if !error {
// do something with the new geoPoint
}
}
我從來沒有在控制台上得到我的內部塊。 我安裝了Core Locations Framework,它允許我做類似的事情
let point = PFGeoPoint(latitude:40.0, longitude:-30.0)
如果在我上面的呼叫時,我沒有被要求提供用戶位置。
NSLocationWhenInUseUsageDescription
和
NSLocationAlwaysUsageDescription
將此鍵放在info.plist中
我在目標c中遇到了類似的問題。 我把這把鑰匙放在我的info.plist中
NSLocationWhenInUseUsageDescription
它在沒有那個密鑰的iOS 7中運行良好,但在8中它不會。
當8出局時,Parse很可能會處理這種情況。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.