貌似掉入iOS 7的坑了
leezhm
由 leezhm
发布于 2013年10月15日
无人欣赏。
新项目,用Xcode5基于iOS 7开发,今天发现貌似掉入一个地图API的坑了。
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
根本不调用(注,已经设置了self.mapViewer.showsUserLocation = YES)
然后会出现如下错误
2013年10月15日 22:34:18.754 FloweryFairy-iOS7[3879:a0b] Cannot find executable for CFBundle 0x9dc8540 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/AccessibilityBundles/GeoServices.axbundle> (not loaded)
Oct 15 22:34:19 Hseecoms-iMac.local FloweryFairy-iOS7[3879] <Error>: CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel; 3-component color space; kCGImageAlphaNoneSkipLast; 512 bytes/row.
2013年10月15日 22:34:19.164 FloweryFairy-iOS7[3879:9303] vImage decode failed, falling back to CG path.
没办法,把之前基于iOS 6的例子,编译测试。发现如果是iOS 6没有任何问题,如果设置为iOS 7就出现同样的问题。
网络搜索发现 下面两个帖子遇到了同样的问题!
http://www.cocoachina.com/bbs/read.php?tid=159223
http://www.cocoachina.com/bbs/m/read.php?tid=159477#read
问问这里有人遇到了这个问题么,Stackoverflow上暂时没看到别人问这个问题的。@tinyfool 帮忙转转。
共15条回复
楼长
·
leezhm
回复于 2013年10月15日
有人说是这个API过期了,但是我在文档中没看到说过期啊!
2楼
·
tinyfool
回复于 2013年10月15日
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation像是那个代码里面有问题,而不是这个东西不被调用了,你把代码贴出来看看。
3楼
·
leezhm
回复于 2013年10月15日
@interface XixiMainViewController ()
@property (strong, nonatomic) IBOutlet MKMapView *mapViewer;
@property (nonatomic, strong) CLLocationManager * locationManager;
@end
@implementation XixiMainViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIColor * background = [UIColor colorWithRed:0.43137f green:0.8f blue:0.94118 alpha:1.0f];
[self.view setBackgroundColor:background];
// init the map kit view
self.mapViewer.autoresizingMask = (UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
self.mapViewer.delegate = self;
//
self.mapViewer.showsUserLocation = YES;
self.mapViewer.zoomEnabled = YES;
self.mapViewer.scrollEnabled = YES;
// check the whether the location services is enable
if ([CLLocationManager locationServicesEnabled]) {
// enable
self.locationManager = [CLLocationManager new];
self.locationManager.delegate = self;
// set the location accuracy
[self.locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[self.locationManager startUpdatingLocation];
} else {
// show the alert window
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"为了获得更好的体验,请开启GPS定位服务!"
delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alert show];
}
}
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
// log current position
NSLog(@"Current Position(%f, %f)", userLocation.coordinate.latitude, userLocation.coordinate.longitude);
MKCoordinateRegion currentRegion = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 500, 500);
[self.mapViewer setRegion:currentRegion animated:YES];
}
8楼
·
9楼
·
10楼
·
sycx
回复于 2013年10月15日
我覺得你應該檢查下self.mapViewer是不是nil
本帖有15个回复,因为您没有注册或者登录本站,所以只能看到本帖的10条回复。如果想看到全部回复,请注册或者登录本站。