IOS - Mapkit崩溃 - 这是xcode 4.2和自动引用计数(ARC)中的错误吗? [英] IOS - Mapkit crash - Is it a bug in xcode 4.2 and Automatic Reference Counting (ARC)?

查看:172
本文介绍了IOS - Mapkit崩溃 - 这是xcode 4.2和自动引用计数(ARC)中的错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MKMapView中发现了一个非常严重的问题,我认为这可能是新的xcode 4.2和ARC(自动引用计数)中的一个错误。

I have found a very wierd problem in MKMapView that i think might be a bug in the new xcode 4.2 and ARC (Automatic Reference Count).

非常基本的UIViewController类:MapViewController,它实现了协议:

I created a very basic UIViewController class: MapViewController, that implements the protocol :

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>
@interface MapViewController : UIViewController <MKMapViewDelegate>
@property (strong, nonatomic) IBOutlet MKMapView *mapView;

我使用xib文件来实例化mapview并链接到它的委托,即First Responder。

I use a xib file to instantiate the mapview and link to its delegate i.e First Responder.

除了UIViewController继承的自动生成方法之外,没有任何内容添加到m文件。

Nothing is added to the m file, except the autogenerated methods inherited by UIViewController.

MapViewController实例化如下: / p>

The MapViewController is instantiated like:

MapViewController *mapView = [[MapViewController alloc]init];
[self.view addSubview:mapView.view];

因此,当加载mapview并滚动地图或放大/缩小时,程序崩溃。
主程序将与一个EXE_BAD_ACCESS崩溃,意味着它正在访问非法内存。

So the program crash when the mapview is loaded and you scroll the map or zoom in/out. Main will crash with a EXE_BAD_ACCESS, meaning it is accessing illegal memory.

我用仪器配置它并检查僵尸,结果是mapview overrleases一个对象,它崩溃 - 如img中所示。

I Profiled it with instruments and checked for Zombies, and it turns out that the mapview overreleases an object and it crashes - as seen in the img.


![Zombie log] [1]

![The Zombie log][1]

我不认为我做错了,所以我想知道,如果你有任何一个解决方案的想法或想测试,如果你可以重现相同的结果。
我的下一步是在没有ARC的新项目中测试,看看是否改变了这个问题。

I do not think i do something wrong, so i would like to know if any of you might have a solution idea or want to test if you can reproduce the same result. My next step would be to test in a new project without ARC to see if that changes the problem.

系统信息:
Xcode 4.2 Build 4D199使用ARC - >自动引用计数

System info: Xcode 4.2 Build 4D199 using ARC -> Automatic reference counting

在Simulator for IOS 4.3中测试的应用程序

App tested in Simulator for IOS 4.3

推荐答案

对我来说完美无缺。您是否已将 MapKit.framework 链接到您的目标?

这篇关于IOS - Mapkit崩溃 - 这是xcode 4.2和自动引用计数(ARC)中的错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆