日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

iOS开发之地图代理不起作用(提示vImage decode failed, falling back to CG path.)

發(fā)布時(shí)間:2023/12/16 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 iOS开发之地图代理不起作用(提示vImage decode failed, falling back to CG path.) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

項(xiàng)目中用到了地圖相關(guān)的東西,就把以前的demo搬了出來,結(jié)果發(fā)現(xiàn)直接運(yùn)行之前的demo沒有問題,在xcode5下新建項(xiàng)目再把代碼粘貼過來就會(huì)提示

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.
檢查了很多遍,代碼一模一樣,就是代理方法不執(zhí)行,到網(wǎng)上搜了好多資料,沒有解決。最后想到在xcode5和xcode4.6下開發(fā)的差異,估計(jì)是arc搗的鬼,然后把a(bǔ)rc改為NO,結(jié)果就正常運(yùn)行了。順便把代碼貼出來……


工具:xcode5.0

1.新建一個(gè)single view application ,導(dǎo)入map kit和core location庫(kù),將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{//當(dāng)前的位置CLLocation* newLocation = [locations lastObject];NSString* str = [MapAddress getGoogleAddress:newLocation];NSLog(@"%@",str);//停止定位//[manager stopUpdatingLocation];//地圖顯示//定位后的經(jīng)緯度CLLocationCoordinate2D coordinate = newLocation.coordinate;//縮放比例MKCoordinateSpan span = MKCoordinateSpanMake(0.1, 0.1);//確定要顯示的區(qū)域MKCoordinateRegion region = MKCoordinateRegionMake(coordinate, span);//讓地圖顯示這個(gè)區(qū)域[_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

總結(jié)

以上是生活随笔為你收集整理的iOS开发之地图代理不起作用(提示vImage decode failed, falling back to CG path.)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。