小编Nir*_*era的帖子

如何在iOs中使用CLGeoCoder使用邮政编码/邮政编码获取纬度经度?

我是Objective-C编程的新手.

我想通过邮政编码/邮政编码在MapView中显示位置.为此,我必须找到纬度和经度.

我已经通过将zip代码传递给Web服务并获得所有信息的响应来引用了许多解决方案.

但我不想使用任何网络服务.我想通过使用CLGeocoder来做到这一点

我正在使用下面的代码来查找纬度经度.

-(IBAction)fetchCoordinates:(id)sender {

  if (!self.geocoder) {
    self.geocoder = [[CLGeocoder alloc] init];
  }

  NSString *address = [NSString stringWithFormat:@"%@ %@ %@", self.streetField.text, self.cityField.text, self.countryField.text];

  [self.geocoder geocodeAddressString:address completionHandler:^(NSArray *placemarks, NSError *error) {
    NSLog(@"mark :: %@", placemarks);
    if ([placemarks count] > 0) {
        CLPlacemark *placemark = [placemarks objectAtIndex:0];
        CLLocation *location = placemark.location;
        CLLocationCoordinate2D coordinate = location.coordinate;

        self.coordinatesLabel.text = [NSString stringWithFormat:@"%f, %f", coordinate.latitude, coordinate.longitude];

        if ([placemark.areasOfInterest count] > 0) {
            self.nameLabel.text = [placemark.areasOfInterest objectAtIndex:0];

        } else {
            self.nameLabel.text …
Run Code Online (Sandbox Code Playgroud)

iphone location objective-c ios clgeocoder

6
推荐指数
1
解决办法
5506
查看次数

通过IOS Google Drive SDK列出Google云端硬盘的所有文件夹

实际上我将google-drive-sdk与我的ios应用程序集成在一起.我可以通过google-drive-sdk for iOS在谷歌驱动器上传指定的文件.另外,我想提供一种功能,用于从用户希望在Google云端硬盘上传该文件的可用文件夹中选择文件夹.

因此,我找到了如何列出Google云端硬盘的所有文件,但无法找到如何列出Google云端硬盘的所有文件夹.

我还在Google Developer网站上浏览了整个API参考,但没有找到任何有关它的解决方案.

我找到了一个地方,使用下面的代码文件夹列表可以完成所以尝试它但它没有工作.

GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
query.q = @"mimeType='application/vnd.google-apps.folder' and trashed=false";

[self.driveService executeQuery:query completionHandler:^(GTLServiceTicket *ticket,
                                                          GTLDriveFileList *files,
                                                          NSError *error) {

    if (error == nil) {
        NSLog(@"Array of folder: %@", files.items);
    } else {
        NSLog(@"An error occurred: %@", error);
    }
}];
Run Code Online (Sandbox Code Playgroud)

那么有什么解决方案可以使用google-drive-sdk从Google云端硬盘获取文件夹列表吗?

objective-c ios google-drive-api google-api-objc-client

5
推荐指数
1
解决办法
2438
查看次数