项目中用到了地图相关的东西,就把曾经的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. 中国海洋大学第四届朗讯杯高级组 A Rocky

    http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2718&cid=1203 题意:给你一个m乘n的格子阵,从一边进去,直线往前走,如果前边有 ...

  2. SQLite入门与分析(六)---再谈SQLite的锁

    写在前面:SQLite封锁机制的实现需要底层文件系统的支持,不管是Linux,还是Windows,都提供了文件锁的机制,而这为SQLite提供了强大的支持.本节就来谈谈SQLite使用到的文件锁——主 ...

  3. ANDROID_MARS学习笔记_S01原始版_006_ListView

    一.代码1.xml(1)main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayo ...

  4. js中replace用法

    js中replace的用法 replace方法的语法是:stringObj.replace(rgExp, replaceText) 其中stringObj是字符串(string),reExp可以是正则 ...

  5. 强制IE浏览器或WebBrowser控件使用指定版本显示网页2

    一.问题的提出 偶然发现,Winform里的WebBrowser和IE实际安装的版本似乎并不同步,很有趣! 下面有张图,里面一个窗口是用IE9打开某网站,另一个窗口是用Winform+WebBrows ...

  6. 错误信息:A TCP error (10013: 以一种访问权限不允许的方式做了一个访问套接字的尝试。) occurred while listening on IP Endpoint=192.168.1.18:8002.

    百度之后,知道这个原因是端口已经被其他进程打开了 使用cmd命令,查看8002端口被哪一个程序占用了 C:\Windows\System32>netstat -ano | find " ...

  7. How to: Define a Windows Communication Foundation Service Contract

    This is the first of six tasks required to create a basic Windows Communication Foundation (WCF) app ...

  8. 开发完整的Web项目必备

    开发工具 数据库系统 DB2数据库 Oracle数据库 SQL Server数据库 MySQL数据库 Access数据库 Web服务器 IIS BEA WebLogic Server Apache T ...

  9. 如何配置Java环境

    下载JDK并安装 搜索JDK,官网立马就出来了,下载之后个人觉得毕竟开发,毕竟这东西不大,C盘稳一点,安装在C盘可以的 配置 右键打开计算机->属性->高级系统设置->高级-> ...

  10. bzoj1040

    论环形dp的重要! 其实这个环比较简单,稍微分析一下就知道, 这是一个简单环,并且每个联通块里只含有一个. 我觉得把处理环的关键,就是要找出环形和线形(树形)有什么区别. 如果我们从某处断开的做dp的 ...