项目中用到了地图相关的东西,就把曾经的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.)的更多相关文章

  1. iOS开发 中的代理实现

    iOS开发 中的代理实现 关于今天为什么要发这篇文字的原因:今天在和同事聊天的时候他跟我说项目中给他的block有时候不太能看的懂,让我尽量用代理写,好吧心累了,那就先从写个代理demo,防止以后他看 ...

  2. iOS开发系列--地图与定位

    概览 现在很多社交.电商.团购应用都引入了地图和定位功能,似乎地图功能不再是地图应用和导航应用所特有的.的确,有了地图和定位功能确实让我们的生活更加丰富多彩,极大的改变了我们的生活方式.例如你到了一个 ...

  3. 转-iOS开发系列--地图与定位

    来自: http://www.cnblogs.com/kenshincui/p/4125570.html#autoid-3-4-0 概览 现在很多社交.电商.团购应用都引入了地图和定位功能,似乎地图功 ...

  4. iOS 开发之协议-代理传值

    刚开始做iOS开发的时候,对 protocol.delegate 的理解一直都是晕晕乎乎一知半解的状态,不知道两个UIViewController之间怎么进行传值. 面试过几个童鞋,问道怎么用 del ...

  5. iOS开发系列--地图与定位总结

    现在很多社交.电商.团购应用都引入了地图和定位功能,似乎地图功能不再是地图应用和导航应用所特有的.的确,有了地图和定位功能确实让我们的生活更加丰富多彩,极大的改变了我们的生活方式.例如你到了一个陌生的 ...

  6. iOS开发中地图开发的简单应用

    iOS上使用地图比Android要方便,只需要新建一个MKMapView,addSubView即可.这次要实现的效果如下: 有标注(大头针),定位,地图. 1.添加地图 1.1 新一个Single V ...

  7. iOS开发---百度地图配置流程,2.6.0 版本 支持64位

      1.首先需要在百度地图下载最新SDK:地址: http://developer.baidu.com/map/index.php?title=iossdk/sdkiosdev-download 2. ...

  8. ios开发--高德地图SDK使用简介

    高德LBS开放平台将高德最专业的定位.地图.搜索.导航等能力,以API.SDK等形式向广大开发者免费开放.本章节我们来简单学习一下如何使用它的定位及地图SDK. 一.相关框架及环境配置 地图SDK 对 ...

  9. IOS开发之地图导航

    一.问题描述 现在很多的APP 都开始引入了地图和定位功能,包括一些餐饮业,团购等.他们都过定位和地图来让用户更加方便的根据自己的位置找到合适的目标,也就是说,现在地图定位已经不再是导航工具类,地图工 ...

随机推荐

  1. Power Designer 使用技巧总结

    1.设置主键自增 在表的属性界面---选择column---双击主键: 2. 为脚本添加注释: 在表的属性界面---选择column分别进行下列设置:

  2. thinkphp 模板替换

    具体详见tp手册. 如果需要修改模板替换映射路径. 则需: 'TMPL_PARSE_STRING'=>array( '__PUBLIC__'=>__ROOT__.'/'.APP_NAME. ...

  3. 转:HTTP请求(GET、POST和soap区别)和响应

    一直对Http请求和SOAP请求不是太理解,只是知道SOAP是基于Http的,并且增加了很多XML标签,SOAP经常用在WebService中,比如在C#中创建一个WebService,然后在客户端生 ...

  4. 【DataStructure In Python】Python模拟二叉树

    使用Python模拟二叉树的基本操作,感觉写起来很别扭.最近做编译的优化,觉得拓扑排序这种东西比较强多.近期刷ACM,发现STL不会用实在太伤了.决定花点儿时间学习一下STL.Boost其实也很强大. ...

  5. Oracle Java SE远程安全漏洞(CVE-2013-5878)

    漏洞版本: Oracle Java SE 7u45 Oracle Java SE 6u65 漏洞描述: BUGTRAQ ID: 64927 CVE(CAN) ID: CVE-2013-5878 Jav ...

  6. Linux Kernel ‘/bcm/Bcmchar.c’本地信息泄露漏洞

    漏洞名称: Linux Kernel ‘/bcm/Bcmchar.c’本地信息泄露漏洞 CNNVD编号: CNNVD-201311-053 发布时间: 2013-11-06 更新时间: 2013-11 ...

  7. 用PowerShell批量收回wsp包

    转:http://www.xuebuyuan.com/168334.html 提供wsp部署的参数:$wspnames:路径下的所有wsp文件名用逗号隔开,如"sumhtestwsp.wsp ...

  8. C# asp.net 操作Word的前提配置和简单的方法

    操作的前提: 1.要保证机器本身要安装OFFICE. 有时安装了Office,但是不能找到Microsoft Word 11.0(或者更高的版本) Object Library.那可能是因为在安装of ...

  9. Error:Could not open initscript class cache for initialization script 'C:\Users\Avishek\AppData\Local\Temp\asLocalRepo14.gradle' (C:\Users\Avishek.gradle\caches\2.2.1\scripts\asLocalRepo14_dkwbdtenxxg

    Error:Could not open initscript class cache for initialization script 见鬼 Android Studio打开项目时遇到这个问题 昨 ...

  10. HDU5669 Road 分层最短路+线段树建图

    分析:(官方题解) 首先考虑暴力,显然可以直接每次O(n^2) ​的连边,最后跑一次分层图最短路就行了. 然后我们考虑优化一下这个连边的过程 ,因为都是区间上的操作,所以能够很明显的想到利用线段树来维 ...