xcode EXC_BAD_ACCESS (SIGSEGV) - KERN_INVALID_ADDRESS

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19053568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:56:41  来源:igfitidea点击:

EXC_BAD_ACCESS (SIGSEGV) - KERN_INVALID_ADDRESS

objective-cxcodeexc-bad-accesssegmentation-fault

提问by Fahim Parkar

I have uploaded the app and it get rejected saying

我已经上传了应用程序,但它被拒绝说

We found that your app crashed on iPad running iOS 7, which is not in compliance with the App Store Review Guidelines.

我们发现您的应用在运行 iOS 7 的 iPad 上崩溃,这不符合 App Store 审核指南。

Well the time when I uploaded, iOS7 was not launched.

好吧,我上传的时候,iOS7还没有启动。

The crash report says

崩溃报告说

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0xb1b1f20b

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x3a2f5b26 objc_msgSend + 6
1   MapKit                          0x30ca46a6 -[MKMapView mapViewDidFinishLoadingTiles:] + 46
2   VectorKit                       0x376bbaf4 -[VKTileSource didFinishWithNetwork] + 68
3   VectorKit                       0x376bc196 __32-[VKTileSource performDownload:]_block_invoke126 + 38
4   GeoServices                     0x345b6fdc ___ZNK49-[GEOTileLoaderInternal _loadedTile:forKey:info:]66__49-[GEOTileLoaderInternal _loadedTile:forKey:info:]_block_invoke3$_1clERKN8LoadItem9RequesterE_block_invoke_2 + 52
5   libdispatch.dylib               0x3a7ddd78 _dispatch_call_block_and_release + 8
6   libdispatch.dylib               0x3a7ddd64 _dispatch_client_callout + 20
7   libdispatch.dylib               0x3a7e47bc _dispatch_main_queue_callback_4CF$VARIANT$mp + 264
8   CoreFoundation                  0x2fab881c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 4
9   CoreFoundation                  0x2fab70f0 __CFRunLoopRun + 1296
10  CoreFoundation                  0x2fa21ce2 CFRunLoopRunSpecific + 518
11  CoreFoundation                  0x2fa21ac6 CFRunLoopRunInMode + 102
12  GraphicsServices                0x3471c27e GSEventRunModal + 134
13  UIKit                           0x322c3a3c UIApplicationMain + 1132

In crash we see MapKit 0x30ca46a6 -[MKMapView mapViewDidFinishLoadingTiles:].

在崩溃中我们看到MapKit 0x30ca46a6 -[MKMapView mapViewDidFinishLoadingTiles:]

Is MapKit is giving problem?

MapKit 有问题吗?

For mapkit, below is what I have

对于mapkit,下面是我所拥有的

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"Location";
    // Do any additional setup after loading the view.
    CLLocationCoordinate2D cords = {29.32511601390379, 48.08847418705136};
    MKCoordinateSpan span = {0.008400,0.008400};
    region = (MKCoordinateRegion) {cords,span};
    mapView.showsUserLocation = YES;
    [mapView setRegion:region animated:YES];
    [mapView setDelegate:self];

    DisplayMap *ann = [[DisplayMap alloc] init];
    ann.coordinate = region.center;
    [mapView addAnnotation:ann];
}

Also I don't have dealloc in mapkitviewcontroller. Is that fine? I am asking as this error is related to memory management.

另外我在 mapkitviewcontroller 中没有 dealloc。可以吗?我问这个错误与内存管理有关。

My App was having 5 tabs. First 4 tabs are just UIWebView. For webview, I found that I didn't put webview in dealloc. Below is what I had in webview,

我的应用程序有 5 个标签。前 4 个选项卡只是 UIWebView。对于webview,我发现我没有把webview放在dealloc中。以下是我在 webview 中的内容,

- (void)dealloc {
    [super dealloc];
}

Right now I don't have iOS 7 on my xcode too. I need to download that, but thought to ask before here.

现在我的 xcode 上也没有 iOS 7。我需要下载那个,但想在这里之前问一下。

Note:All is working perfectly with iOS 6.

注意:一切都与 iOS 6 完美配合。

Any guesses why I am getting this error?

猜猜我为什么会收到这个错误?

采纳答案by Fahim Parkar

When I put mapViewin dealloc, the problem get solved.

当我放入mapViewdealloc时,问题就解决了。

On further investigation, also noticed that I didn't added title for DisplayMap.

在进一步调查中,还注意到我没有为DisplayMap.

DisplayMap *ann = [[DisplayMap alloc] init];
ann.title = @"My Location";

回答by PgmFreek

Did set the map view delegate to nil before navigating away from the page. Also I think there is some memory management issue with IOS maps. So It is better to release maps in the deallocmethod.

在离开页面之前,将地图视图委托设置为 nil。另外我认为 IOS 映射存在一些内存管理问题。所以最好在dealloc方法中释放maps 。