简体   繁体   English

如何处理从FBSDK IOS Swift获取的用户位置

[英]How to Handle Fetched User's Location from FBSDK IOS swift

i got the user Location using FBSDK. 我使用FBSDK获得了用户位置。 Now I do not know how to seperate the information to get each part of information i am printing it in console and this is what get 现在我不知道如何分隔信息以获取信息的每个部分,我正在控制台中打印它,这就是

Optional({
id = 110855035610007;
name = "Rawalpindi, Pakistan";
})

how do i get "Rawalpindi" and "Pakistan" and store them in some variable according to Docs its returning a Struct i guess so i do not know how to handle that please guide me thanks 我如何获取“ Rawalpindi”和“巴基斯坦”并将它们存储在根据Docs返回的Struct 文件中,所以我不知道该如何处理,请指导我,谢谢

First thing, you have to create one responseDictionary and then store response in it. 首先,您必须创建一个responseDictionary,然后将响应存储在其中。

then you can get this name like, 那么你可以得到这个名字,

 let str = self.responseDic.valueForKey("name") as? String

Then you can separate this string like, 然后,您可以将字符串分隔为

 let arr : NSArray = str!.componentsSeparatedByString(",") as NSArray
 print(arr.objectAtIndex(0))
 print(arr.objectAtIndex(1))

Hope this way you will fix it. 希望以此方式您可以解决它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从FBSDK获取用户正在参加的活动的列表(Swift 4,iOS) - How to get user's list of Events they are attending from FBSDK (Swift 4, iOS) iOS通过快速最新的FBSDK获得用户的家乡 - iOS get user's hometown with swift and latest FBSDK 如何在swift iOS for iPhone中使用FBSDK获取用户电子邮件地址? - How to get user email address using FBSDK in swift iOS for iPhone? Swift Firebase - 如何从GeoFire获取个人用户的位置 - Swift Firebase -How to get individual user's location from GeoFire Swift中的iOS FBSDK检查权限 - iOS FBSDK check permissions in Swift 如何在用户位置IOS 9 SWIFT上居中地图 - How to Center a Map on User Location IOS 9 SWIFT 如何在Swift中选择用户的位置注释 - How to select the user's location annotation in Swift 当应用程序在后台时将用户的位置转发到服务器(Swift/iOS) - Forwarding user's location to server when application is in the background (Swift/iOS) 如何在表视图中从当前用户位置列出最近的用户-iOS Swift? - How to list closest user from current user location in a table view - iOS swift? 谷歌地图 - 如何找出用户的位置并在 Swift 中显示从该位置到目的地的路线? - Google maps - how to find out user's location and show the route from that location to the destination point in Swift?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM