OC

Knowledge OS
登录 注册
全部话题 移民 创业 iOS Mac Objective-C Swift Android 招聘 求职

貌似掉入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];
}
4楼 ·
leezhm 回复于 2013年10月15日

2楼 @tinyfool 代码贴的太难受了!在来编辑

5楼 ·
tinyfool 回复于 2013年10月15日

4楼 @leezhm 有带预览的编辑器你们都贴不好代码。。。。

Markdown多简单啊

6楼 ·
tinyfool 回复于 2013年10月15日

@sycx 看看

7楼 ·
leezhm 回复于 2013年10月15日

5楼 @tinyfool 论坛支持么,貌似不支持啊,我只看到单行代码的

8楼 ·
tinyfool 回复于 2013年10月15日 | 更新于 2013年10月16日

7楼 @leezhm 工具栏,101010就是贴代码的意思......

先把一堆代码贴进来,然后选中,然后点击那个按钮......

9楼 ·
leezhm 回复于 2013年10月15日

8楼 @tinyfool 好吧,我错了。 我发帖的时候默认用了单行代码 然后习惯于markdown的多行代码(三点)发现不支持。后来的确使用了101010这个的,不过我是先点击这个,让出现enter code here,当我把代码弄进去,发现还是不对的。现在根据你的提示,先贴代码,然后在点击101010,成功了!

10楼 ·
sycx 回复于 2013年10月15日

我覺得你應該檢查下self.mapViewer是不是nil

本帖有15个回复,因为您没有注册或者登录本站,所以只能看到本帖的10条回复。如果想看到全部回复,请注册或者登录本站。
登录 或者 注册
[顶 楼]
|
|
[底 楼]
|
|
[首 页]

AltStyle によって変換されたページ (->オリジナル) /