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开发 中的代理实现
		
iOS开发 中的代理实现 关于今天为什么要发这篇文字的原因:今天在和同事聊天的时候他跟我说项目中给他的block有时候不太能看的懂,让我尽量用代理写,好吧心累了,那就先从写个代理demo,防止以后他看 ...
 - iOS开发系列--地图与定位
		
概览 现在很多社交.电商.团购应用都引入了地图和定位功能,似乎地图功能不再是地图应用和导航应用所特有的.的确,有了地图和定位功能确实让我们的生活更加丰富多彩,极大的改变了我们的生活方式.例如你到了一个 ...
 - 转-iOS开发系列--地图与定位
		
来自: http://www.cnblogs.com/kenshincui/p/4125570.html#autoid-3-4-0 概览 现在很多社交.电商.团购应用都引入了地图和定位功能,似乎地图功 ...
 - iOS 开发之协议-代理传值
		
刚开始做iOS开发的时候,对 protocol.delegate 的理解一直都是晕晕乎乎一知半解的状态,不知道两个UIViewController之间怎么进行传值. 面试过几个童鞋,问道怎么用 del ...
 - iOS开发系列--地图与定位总结
		
现在很多社交.电商.团购应用都引入了地图和定位功能,似乎地图功能不再是地图应用和导航应用所特有的.的确,有了地图和定位功能确实让我们的生活更加丰富多彩,极大的改变了我们的生活方式.例如你到了一个陌生的 ...
 - iOS开发中地图开发的简单应用
		
iOS上使用地图比Android要方便,只需要新建一个MKMapView,addSubView即可.这次要实现的效果如下: 有标注(大头针),定位,地图. 1.添加地图 1.1 新一个Single V ...
 - iOS开发---百度地图配置流程,2.6.0  版本  支持64位
		
1.首先需要在百度地图下载最新SDK:地址: http://developer.baidu.com/map/index.php?title=iossdk/sdkiosdev-download 2. ...
 - ios开发--高德地图SDK使用简介
		
高德LBS开放平台将高德最专业的定位.地图.搜索.导航等能力,以API.SDK等形式向广大开发者免费开放.本章节我们来简单学习一下如何使用它的定位及地图SDK. 一.相关框架及环境配置 地图SDK 对 ...
 - IOS开发之地图导航
		
一.问题描述 现在很多的APP 都开始引入了地图和定位功能,包括一些餐饮业,团购等.他们都过定位和地图来让用户更加方便的根据自己的位置找到合适的目标,也就是说,现在地图定位已经不再是导航工具类,地图工 ...
 
随机推荐
- vs2012+opencv2.4.7 实现单张人脸识别
			
参考:http://blog.sina.com.cn/s/blog_593c85f20100ncnj.html OpenCV的库中带有检测正面人脸的 Haar迭代算法Haar Cascade Face ...
 - mysql查看'datadir'目录
			
mysql查看创建的数据库的数据,包含表等存放的目录,可以输入下面指令查看: show variables like 'datadir'
 - cocos2d-html5 Layer 和 Scene 创建模式
			
var myLayer = cc.Layer.extend({ init:function() {//2 界面 var bRet = false; if (this._super()) { bRet ...
 - OCR识别流程
			
1.图像输入.预处理:图像输入:对于不同的图像格式,有着不同的存储格式,不同的压缩方式.预处理:主要包括二值化,噪声去除,倾斜较正等2.二值化:对摄像头拍摄的图片,大多数是彩色图像,彩色图像所含信息量 ...
 - SQLite入门与分析(八)---存储模型(1)
			
写在前面:SQLite作为嵌入式数据库,通常针对的应用的数据量相对于通常DBMS的数据量是较小的.所以它的存储模型设计得非常简单,总的来说,SQLite把一个数据文件分成若干大小相等的页面,然后以B树 ...
 - VC常用数据类型使用转换
			
我们先定义一些常见类型变量借以说明 int i = 100; long l = 2001; float f=300.2; double d=12345.119; char username[]=&qu ...
 - 《ArcGIS Engine+C#实例开发教程》
			
原文:<ArcGIS Engine+C#实例开发教程> 摘要:<ArcGIS Engine+C#实例开发教程>,面向 ArcGIS Engine(以下简称AE)开发初学者,本教 ...
 - 在Myeclipse buildpath 加server lib
			
把eclipse下的工程复制过来后,发现缺少Server Runtime.本想直接在buildpath里加lib,在Myeclipse里找了一圈,恁是没发现在哪里可以添加,虽然在preference里 ...
 - Medium上关于git的文章
			
rebase和merge的正确使用时机 https://medium.com/@porteneuve/getting-solid-at-git-rebase-vs-merge-4fa1a48c53aa ...
 - 函数lock_rec_find_similar_on_page
			
/*********************************************************************//** Looks for a suitable type ...