iOS开发之地图代理不起作用(提示vImage decode failed, falling back to CG path.)
项目中用到了地图相关的东西,就把以前的demo搬了出来,结果发现直接运行之前的demo没有问题,在xcode5下新建项目再把代码粘贴过来就会提示
May 5 11:36:21 infomedia-iPod-touch TestLocation[1465] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
May 5 11:36:21 infomedia-iPod-touch TestLocation[1465] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
2014-05-05 11:36:21.974 TestLocation[1465:8b03] vImage decode failed, falling back to CG path.
2014-05-05 11:36:21.969 TestLocation[1465:9003] vImage decode failed, falling back to CG path.
May 5 11:36:22 infomedia-iPod-touch TestLocation[1465] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
2014-05-05 11:36:22.653 TestLocation[1465:a003] vImage decode failed, falling back to CG path.
May 5 11:36:22 infomedia-iPod-touch TestLocation[1465] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
2014-05-05 11:36:22.691 TestLocation[1465:9503] vImage decode failed, falling back to CG path.
May 5 11:36:22 infomedia-iPod-touch TestLocation[1465] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
2014-05-05 11:36:22.711 TestLocation[1465:890b] vImage decode failed, falling back to CG path.
May 5 11:36:22 infomedia-iPod-touch TestLocation[1465] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
2014-05-05 11:36:22.725 TestLocation[1465:9003] vImage decode failed, falling back to CG path.
May 5 11:36:22 infomedia-iPod-touch TestLocation[1465] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
2014-05-05 11:36:22.733 TestLocation[1465:9b03] vImage decode failed, falling back to CG path.
May 5 11:36:22 infomedia-iPod-touch TestLocation[1465] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
2014-05-05 11:36:22.736 TestLocation[1465:8b03] vImage decode failed, falling back to CG path.
May 5 11:36:22 infomedia-iPod-touch TestLocation[1465] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
2014-05-05 11:36:22.777 TestLocation[1465:9207] vImage decode failed, falling back to CG path.
检查了很多遍,代码一模一样,就是代理方法不执行,到网上搜了好多资料,没有解决。最后想到在xcode5和xcode4.6下开发的差异,估计是arc捣的鬼,然后把arc改为NO,结果就正常运行了。顺便把代码贴出来……
工具:xcode5.0
1.新建一个single view application ,导入map kit和core location库,将arc改为NO
2.ViewController.h文件
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>@interface ViewController : UIViewController<CLLocationManagerDelegate> {MKMapView *_mapView;UILabel *_showLabel;
}@end
ViewController.m文件
#import "ViewController.h"
#import "MapAddress.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad
{[super viewDidLoad];CLLocationManager* manager = [[CLLocationManager alloc] init];//定位的精确度manager.desiredAccuracy = kCLLocationAccuracyBest;//定位距离manager.distanceFilter = 1;manager.delegate = self;//开始定位[manager startUpdatingLocation];//地图_mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];_mapView.showsUserLocation = YES;[self.view addSubview:_mapView];
}//定位成功
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{//当前的位置CLLocation* newLocation = [locations lastObject];NSString* str = [MapAddress getGoogleAddress:newLocation];NSLog(@"%@",str);//停止定位//[manager stopUpdatingLocation];//地图显示//定位后的经纬度CLLocationCoordinate2D coordinate = newLocation.coordinate;//缩放比例MKCoordinateSpan span = MKCoordinateSpanMake(0.1, 0.1);//确定要显示的区域MKCoordinateRegion region = MKCoordinateRegionMake(coordinate, span);//让地图显示这个区域[_mapView setRegion:region animated:YES];
}//定位失败
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{NSLog(@"定位失败");
}
@end
3.MapAddress.h文件
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>@interface MapAddress : NSObject+ (NSString *) getBaiduAddress:(CLLocation *)location;
+ (NSString *) getGoogleAddress:(CLLocation *)location;
@end
MapAddress.m文件
#import "MapAddress.h"@implementation MapAddress+ (NSString *) getBaiduAddress:(CLLocation *)location {double latitude = location.coordinate.latitude;double longtitude = location.coordinate.longitude;NSString *urlstr = [NSString stringWithFormat:@"http://api.map.baidu.com/geocoder?output=json&location=%f,%f&key=dc40f705157725fc98f1fee6a15b6e60",latitude, longtitude];NSURL *url = [NSURL URLWithString:urlstr];NSString *s = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];return s;
}
+ (NSString *) getGoogleAddress:(CLLocation *)location {NSString *urlstr = [NSString stringWithFormat:@"http://maps.google.com/maps/api/geocode/json?latlng=%f,%f&language=zh-CN&sensor=false",location.coordinate.latitude, location.coordinate.longitude];NSLog(@"%@", urlstr);NSURL *url = [NSURL URLWithString:urlstr];NSString *s = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];return s;
}@end
iOS开发之地图代理不起作用(提示vImage decode failed, falling back to CG path.)相关推荐
- iOS开发:GitHub上传代码错误提示fatal: Authentication failed for 'https://gitee.com/XXX/XXX.git/‘的解决方法
上传代码到Git上面,有时候会遇到各种情况,有些时候是因为合并代码冲突,有些时候是因为修改了Git的登录密码需要重新认证.那么这里就来讲解错误提示fatal: Authentication faile ...
- IOS开发百度地图API入门到精通-用点生成路线,导航,气泡响应
(转)IOS开发百度地图API入门到精通-用点生成路线,导航,气泡响应 IOS百度地图API开发自定义气泡,点击气泡自动生成路线,以及拖拽 IOS百度地图开发POISearch搜索附近停车场,附近加油 ...
- IOS开发百度地图API
IOS百度地图API开发自定义气泡,点击气泡自动生成路线,以及拖拽 IOS百度地图开发POISearch搜索附近停车场,附近加油站 IOS百度地图视角跳到用户当前位置 IOS百度地图开发实时路况 IO ...
- IOS开发百度地图API-用点生成路线,导航,气泡响应
原地址:http://blog.sina.com.cn/s/blog_68661bd80101k4rx.html IOS百度地图API开发自定义气泡,点击气泡自动生成路线,以及拖拽 IOS百度地图开发 ...
- ios 开发百度地图的使用
IOS开发百度地图API-用点生成路线,导航,气泡响应 IOS百度地图API开发自定义气泡,点击气泡自动生成路线,以及拖拽 IOS百度地图开发POISearch搜索附近停车场,附近加油站 IOS百度地 ...
- 转:IOS开发百度地图API-用点生成路线,导航,气泡响应
IOS百度地图API开发自定义气泡,点击气泡自动生成路线,以及拖拽 IOS百度地图开发POISearch搜索附近停车场,附近加油站 IOS百度地图视角跳到用户当前位置 IOS百度地图开发实时路况 IO ...
- 转-iOS开发系列--地图与定位
来自: http://www.cnblogs.com/kenshincui/p/4125570.html#autoid-3-4-0 概览 现在很多社交.电商.团购应用都引入了地图和定位功能,似乎地图功 ...
- iOS开发系列--地图与定位
概览 现在很多社交.电商.团购应用都引入了地图和定位功能,似乎地图功能不再是地图应用和导航应用所特有的.的确,有了地图和定位功能确实让我们的生活更加丰富多彩,极大的改变了我们的生活方式.例如你到了一个 ...
- iOS开发之通过代理逆向传值
在iOS开发中,传值是几乎每个App都会用到的,对于传统的顺向传值应该说是比较简单的,但是逆向传值往往会用到代理模式来实现,很多同学在这一块有迷惑,迷惑的不是怎么逆向传值,而是不理解代理模式,下面就来 ...
- ArcGIS Runtime SDK for iOS 开发之地图范围(map extent)
注:本篇文章翻译自:https://developers.arcgis.com/ios/objective-c/guide/iphonesdk-mapnavigation.htm: 地图视图包含了地图 ...
最新文章
- 【Qt】qss样式表之:自定义属性实现动态切换样式
- 通过反射获取子类和父类定义的属性
- Ecshop实现仿Taobao地区运费模板
- c#_Array.Sort()
- 四层和七层负载均衡的区别介绍--转
- 如何在PowerPoint2007制造课件免费ppt模板下载
- optee内核中栈的介绍(一)
- Spring Security相关
- mysql pool返回值_【Mysql】你知道一条查询语句是如何执行的吗?
- delphi10android保存数据,DELPHI XE5 Android – SDCard的SAVE / LOAD文件
- 手把手带你入坑迁移学习(by 当过黑客的CTO大叔)
- ngix 全局配置文件和子配置文件 配置项中文注释
- 用python写生日快乐说说_生日快乐的说说(精选50句)
- vs2015中提示未能找到类型或命名空间名Word
- 深入剖析JDK动态代理源码实现
- TCP之快重传与快恢复
- 计算机毕业设计JAVA某市教育局综合信息管理平台mybatis+源码+调试部署+系统+数据库+lw
- Java使用Calender类实现打印日历(指定月份和年)
- 数字电路42( 单稳态触发器)
- jfinal使用Redis