我有一个应用程序,表现出间歇性崩溃.崩溃日志显示的堆栈跟踪对我来说很难破译,因此希望其他人看到这一点并指出我正确的方向.
基本上,应用程序在启动时执行反向地理编码请求,以显示用户在标签中的位置.另外,我为特定的API调用执行另一个反向地理编码请求.
发生的事情是有时这个MKReverseGeocoder需要很长时间才能回来.最终我假设我会收到一个失败的回调,有时我会这样做,但在此之前可能需要几分钟.
由于API调用也发出了另一个MKReverseGeocoder请求,我想也许多个并发调用存在问题?
这是我的堆栈跟踪:
Program received signal: “EXC_BAD_ACCESS”.
(gdb) backtrace
#0 0x30c237a0 in -[MKPlacemark _mapkit_cache_heapTime] ()
#1 0x30bffe60 in compareTimes ()
#2 0x32403b24 in CFBinaryHeapAddValue ()
#3 0x30c0030c in -[MKCache setObject:forKey:] ()
#4 0x30c2aa48 in -[MKReverseGeocodeCache addPlacemark:forCoordinate:] ()
#5 0x30c2251c in -[MKReverseGeocoder requester:didReceiveResponse:forRequest:] ()
#6 0x3388cc1c in -[PBRequester _tryParseData] ()
#7 0x3388b288 in -[PBRequester connection:didReceiveData:] ()
#8 0x337490ce in -[NSURLConnection(NSURLConnectionReallyInternal) sendDidReceiveData:originalLength:] ()
#9 0x33748ff0 in _NSURLConnectionDidReceiveData ()
#10 0x30899ff8 in URLConnectionClient::_clientDidReceiveData ()
#11 0x3088ca3e in URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload () …Run Code Online (Sandbox Code Playgroud) 我开发了一个CGImage,当程序在屏幕上显示它时它工作正常:
[output_view.layer performSelectorOnMainThread:@selector(setContents:) withObject: (id) image waitUntilDone:YES];
Run Code Online (Sandbox Code Playgroud)
现在,这样做会导致应用程序崩溃:
UIImageWriteToSavedPhotosAlbum([UIImage imageWithCGImage: image)],nil,nil,nil);
Run Code Online (Sandbox Code Playgroud)
我根本不明白.这是崩溃期间的堆栈:
#0 0x33b5db6e in memmove (Line 65)
#1 0x341ddee2 in CGAccessSessionGetBytes
#2 0x31ab4488 in alphaProviderGetBytes
#3 0x341ddf52 in CGAccessSessionGetBytes
#4 0x31abbc80 in writeOne
#5 0x31abbdae in _CGImagePluginWriteJPEG
#6 0x31ab2ddc in CGImageDestinationFinalize
#7 0x3037eda2 in imageDataFromImageWithFormatAndProperties
#8 0x3037effc in imageDataFromImageRef
#9 0x3038ea3c in __-[PLAssetsSaver _saveImage:imageData:properties:completionBlock:]_block_invoke_1
#10 0x33c32680 in _dispatch_call_block_and_release
#11 0x33c32ba0 in _dispatch_worker_thread2
#12 0x33bd7250 in _pthread_wqthread
Run Code Online (Sandbox Code Playgroud)
这是问题的方法:
-(void)captureOutput: (AVCaptureOutput *) captureOutput didOutputSampleBuffer: (CMSampleBufferRef) sampleBuffer fromConnection: (AVCaptureConnection *) conenction{
NSAutoreleasePool …Run Code Online (Sandbox Code Playgroud) 我面临着一个非常奇怪的核心数据问题.我们来描述一下:
假设我有两个模型,ModelA并且ModelB.在数据模型ModelA中引用ModelB为一对多关联,因此ModelB具有一对一的关联ModelA.
当应用程序启动时(特别是在首次启动时),或者当用户询问时,我必须ModelB为每个ModelA实例创建或更新所有实例.ModelA实例是预先确定的 对于每个ModelA实例,我有大约200个实例ModelB.
我使用这样的代码:
ModelB *model = [NSEntityDescription insertNewObjectForEntityForName:@"ModelB"
inManagedObjectContext:context];
model.value = [NSNumber numberWithDouble:myValue];
model.modelA = modelA; // I pass modelA as a parameter to the function
[modelA addModelBObject:model];
Run Code Online (Sandbox Code Playgroud)
我不会立即保留数据(因为我有很多数据要保存),但我在流程结束时这样做.
有时,有时候,我EXC_BAD_ACCESS在这一行得到一个错误:
model.value = [NSNumber numberWithDouble:myValue];
Run Code Online (Sandbox Code Playgroud)
启用僵尸,我不能只看到那些愚蠢的EXC_BAD_ACCESS,没有更多的信息.
我尝试以不同的方式设置该值,但没有任何改变.然后,我尝试retain了NSNumber,但没有改变.然后,最后,我尝试retain了一旦创建的模型,我得到了平常EXC_BAD_ACCESS,但相应地创建了模型,也就是说:
ModelB *model = [[NSEntityDescription …Run Code Online (Sandbox Code Playgroud) 我创建了一个全新的基于视图的项目并添加到viewDidLoad中
- (void)viewDidLoad
{
[super viewDidLoad];
myField = [[UITextField alloc] initWithFrame:CGRectMake(50, 50, 150, 31)];
myField.delegate=self;
[self.view addSubview:myField];
[myField release];
}
Run Code Online (Sandbox Code Playgroud)
我的头文件是
@interface textfieldpracticeViewController : UIViewController<UITextFieldDelegate>{
UITextField *myField;
}
Run Code Online (Sandbox Code Playgroud)
当我点击文本字段并弹出键盘时,我开始输入但是在第二个字符上,我得到了exc_bad_access错误.我使用NSZombieEnabled,NSDebugEnabled,MallocStackLoggin和MallocStackNoCompact运行它,但它们无法捕获错误.
这在使用iphone 4.3模拟器时失败,但是当我在iphone上构建它时工作正常.这是一个xcode错误还是我错过了什么?
谢谢
PS甚至尝试过财产/合成废除
我的想法已经不多了.我收到一个EXC_BAD_ACCESS使用ARC的项目.根据调试器,它在内main().NSZombieEnabled设置为YES但我没有看到任何callstack或Class/Type或任何东西.检查器/配置文件也是如此.在应用程序崩溃后的某个时间,我得到的只是"会话超时".
而且很难在我的代码中找到它.
我正在设置像
NSLog(@"CrashLog: <%@:%@:%d:%s>", NSStringFromClass([self class]),
NSStringFromSelector(_cmd), __LINE__, __FILE__);
Run Code Online (Sandbox Code Playgroud)
关于enty和退出方法的代码,但我还没有找到任何有用的模式.我所能看到的是,所有我所讨论的方法都已经EXC_BAD_ACCESS被抛弃了.
有关如何隔离问题的任何想法?
Tim建议在gdb中使用back trace(bt).结果是:
#0 0x0be87580 in TI::Favonius::BeamSearch::choose_hit_test_node ()
#1 0x0be87b5f in TI::Favonius::BeamSearch::update_for_touch ()
#2 0x0be8ee32 in TI::Favonius::StrokeBuildManager::update_search_for_touch ()
#3 0x0be8f58f in TI::Favonius::StrokeBuildManager::key_down_or_drag_hit_test_for_UI ()
#4 0x0be6ba8b in TIInputManagerZephyr::simulate_touches_for_input_string ()
#5 0x0be7e5d9 in -[TIKeyboardInputManagerZephyr candidates] ()
#6 0x00678345 in -[UIKeyboardImpl generateAutocorrectionReplacements:] ()
#7 0x007dcaec in __71-[UITextInteractionAssistant scheduleReplacementsForRange:withOptions:]_block_invoke_0 ()
#8 0x007f6db2 in -[UITextSelectionView calculateAndShowReplacements:] ()
#9 0x00e255fd in __NSFireDelayedPerform ()
#10 0x01a03976 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#11 …Run Code Online (Sandbox Code Playgroud) 我有许多UIViews进入视野,然后走出视野并被闲置.但是,我相信他们中的一些人即使在他们离开后仍然会收到通知,这会导致问题.
在UIView"父"容器上:
if(self._content != nil && [self._content respondsToSelector:@selector(presentMe:)]) {
[self._content presentMe:NO];
}
Run Code Online (Sandbox Code Playgroud)
在UIView"孩子":
[[NSNotificationCenter defaultCenter] <-- EXC_BAD_ACCESS (code=1, address=0x70000008
postNotificationName:PRESENTING
object:self
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:prepareToEnter], PRESENTING, nil]];
Run Code Online (Sandbox Code Playgroud)
一切都在第一次工作,但如果我第二次启动相同的视图我得到一个EXC_BAD_ACCESS.这是不是意味着缺少某些东西?
仅供参考,所有这些都在ARC - xcode 4.3.2中
我们正在从带有注释的地图视图开始开发iPad应用程序.
当我们切换到另一个具有基于opengl的图表解决方案(shinobi)的视图时,通过使用故事板.在使用地图返回视图时,在地图上触摸移动它之前没有问题.当我们尝试移动地图时,它会在[EAGLContext setCurrentContext]中使用exc_bad_access异常崩溃
有任何想法吗?
以下是崩溃日志的一部分:
OS Version: iOS 6.0 (10A403)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000c
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 OpenGLES 0x39974b12 +[EAGLContext setCurrentContext:] + 74
1 VectorKit 0x32c64f0c -[VGLGPU setPaused:] + 120
2 VectorKit 0x32c54db8 -[VKMainLoop updateLinkState] + 492
3 VectorKit 0x32c54950 -[VKScreenCanvas _updateDisplayStatus:] + 104
4 VectorKit 0x32ccea9a -[VKScreenCanvas setGesturing:] + 254
5 MapKit 0x34defc3c -[MKMapView _willStartUserInteraction] + 48
6 MapKit 0x34de891a -[MKMapGestureController …Run Code Online (Sandbox Code Playgroud) 提前感谢您提供有关我所遇到的问题的任何帮助/见解.就在最近,我的iOS应用程序因可怕的EXC_BAD_ACCESS错误而开始失败.我对SO和Google进行了大量研究,并收到了一些很好的建议,但这些帖子都没有帮助我解决我的问题.到目前为止,我知道EXC_BAD_ACCESS可能是两件事之一:
1) A pointer is now pointing to memory that was deallocated.
2) A pointer itself is corrupt.
Run Code Online (Sandbox Code Playgroud)
我阅读并按照这里,这里,这里和这里的说明进行操作.当我执行"构建并运行"时,我可以100%重现exc_bad_access.但是,当我在调试器或工具中启用NSZombie时,我永远无法重现该问题.此外,NSZombie不会在控制台中留下任何有用的信息.
我最接近确定问题的方法是在每一行代码之后放置一个NSLog,以便查看崩溃的位置.我相信它在两个截然不同的地方崩溃 - 这两个点都在返回一个单元格cellForRowAtIndexPath.下面我提供了两种方法,我认为事情正在崩溃,以及我的控制台上的错误输出.任何帮助或指导将不胜感激,谢谢!
违规方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
static NSString *CellIdentifier = @"EventDetailCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.textLabel.textColor = [UIColor colorWithRed:150 green:143 blue:135 alpha:1.0];
cell.textLabel.highlightedTextColor = [UIColor …Run Code Online (Sandbox Code Playgroud) 我在iOS 7上只有一个不可重现的崩溃.我正在大量使用MKOverlayRenderer在地图上绘制形状.在iOS 6上不会发生此崩溃.
任何与此相关的想法都会有用.
Exception Type: EXC_BAD_ACCESS
Code: KERN_INVALID_ADDRESS at 0x291707628
Stack:
0 libobjc.A.dylib objc_msgSend + 5
1 VectorKit __50-[VKRasterOverlayTileSource invalidateRect:level:]_block_invoke_2 + 38
2 VectorKit -[VKTileKeyMap enumerateKeysAndObjectsUsingBlock:] + 58
3 VectorKit -[VKTilePool enumerateKeysAndObjectsUsingBlock:] + 76
4 VectorKit __50-[VKRasterOverlayTileSource invalidateRect:level:]_block_invoke + 178
5 ... libdispatch.dylib _dispatch_call_block_and_release + 10
6 libdispatch.dylib _dispatch_client_callout + 22
7 libdispatch.dylib _dispatch_main_queue_callback_4CF$VARIANT$mp + 268
8 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
9 CoreFoundation __CFRunLoopRun + 1300
10 CoreFoundation CFRunLoopRunSpecific + 522
11 CoreFoundation CFRunLoopRunInMode + 106
12 GraphicsServices GSEventRunModal …Run Code Online (Sandbox Code Playgroud) exc-bad-access ×10
ios ×4
iphone ×3
objective-c ×3
crash ×2
debugging ×2
mkmapview ×2
cocoa-touch ×1
core-data ×1
ios4 ×1
ios6 ×1
ios7 ×1
mapkit ×1
opengl-es ×1
uiimage ×1
uikit ×1
uitextfield ×1
xcode ×1