gps cooridnates不在棉花糖中工作

时间:2016-02-12 07:18:39

标签: android gps android-6.0-marshmallow android-sdk-tools

我已经实现了代码以获得它在23版以下工作正常的纬度和经度,但不适用于Android Marshmallow。我也设置了运行时权限但仍然无法正常工作,下面是我调用方法的代码。

- (void)getLoadData
{
    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    spinner.backgroundColor = [UIColor blackColor];
    [spinner setCenter:CGPointMake([[UIScreen mainScreen] bounds].size.width / 2,[[UIScreen mainScreen] bounds].size.height / 2)];
    [self.view addSubview:spinner];
    [spinner startAnimating];

    AFOAuth1OneLeggedClient *clnt = [[AFOAuth1OneLeggedClient alloc] initWithBaseURL:[NSURL URLWithString:path] key:cosumer_key secret:cosumer_secret];
    [clnt getPath:@"products" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        if ([responseObject isKindOfClass:[NSDictionary class]]) {
            NSLog(@"responseObject: %@\n operation: %@", [responseObject valueForKey:@"products"], operation);

            array = [[NSMutableArray alloc] init];
            [array addObjectsFromArray: [responseObject valueForKey:@"products"]];

            NSLog(@"Array: %@", array);
            [spinner stopAnimating];
            DisplayCarViewController *controller = [[DisplayCarViewController alloc] init];
            [self.navigationController pushViewController:controller animated:true];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Error data: %@\n Error operation: %@",error, operation);
        [spinner stopAnimating];
    }];
}

0 个答案:

没有答案