iOS 6.1.3 EXC_BAD_ACCESS KERN_INVALID_ADDRESS

时间:2013-05-23 21:08:18

标签: ios ios6 exc-bad-access

我有一个定期为客户端崩溃的应用程序。我无法复制崩溃,但我能够从客户端获取错误日志,我希望有人可以指出我正确的方向,我应该看到什么。这是崩溃报告中的少数,其他大多数崩溃报告都是低内存事件。如果重要,应用程序将使用ARC。

我是新手,所以我只需指出正确的方向,最好是善意的:)

Incident Identifier: C21570BF-3E76-44DD-BEB1-03FDA4A12750
CrashReporter Key:   ebcd6d296e2badb36644f9abfdae158007ba680e
Hardware Model:      iPad2,1
Process:         APP_NAME [106]
Path:            /var/mobile/Applications/F083D896-D881-4F8F-81FE-44BDA9C072EA/APP_NAME.app/APP_NAME
Identifier:      APP_NAME
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2013-05-17 14:26:42.639 -0700
OS Version:      iOS 6.1.3 (10B329)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xc1ed2375
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x3b46b5b0 objc_msgSend + 16
1   UIKit                           0x35566080 -[UIAlertView(Private) _performPopup:animationType:revealedBySpringBoardAlert:] + 504
2   UIKit                           0x35582f28 -[UIAlertView(Private) _repopup] + 76
3   UIKit                           0x3556cbd4 -[UIAlertView(Private) _removeAlertWindowOrShowAnOldAlert] + 192
4   UIKit                           0x3556c996 -[UIAlertView(Private) _popoutAnimationDidStop:finished:] + 590
5   UIKit                           0x35429aae -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 154
6   UIKit                           0x3549e8ea -[UIViewAnimationState animationDidStop:finished:] + 46
7   QuartzCore                      0x351d3bfc CA::Layer::run_animation_callbacks(void*) + 204
8   libdispatch.dylib               0x3b8874b4 _dispatch_client_callout + 20
9   libdispatch.dylib               0x3b88c1b8 _dispatch_main_queue_callback_4CF$VARIANT$mp + 220
10  CoreFoundation                  0x335dff36 __CFRunLoopRun + 1286
11  CoreFoundation                  0x33552eb8 CFRunLoopRunSpecific + 352
12  CoreFoundation                  0x33552d44 CFRunLoopRunInMode + 100
13  GraphicsServices                0x371092e6 GSEventRunModal + 70
14  UIKit                           0x354682fc UIApplicationMain + 1116
15  APP_NAME                            0x000bd492 main (main.m:16)
16  libdyld.dylib                   0x3b8a7b1c start + 0

1 个答案:

答案 0 :(得分:1)

我现在意识到这个问题没有得到很好的解决。

我正在使用AFNetworking将文件上传到服务器。我正在使用:

NSData *videoData = [NSData dataWithContentsOfURL:[NSURL URLWithString:video.filename]];
NSMutableURLRequest *request = [[AppApiManager sharedManager] multipartFormRequestWithMethod:@"POST" path:@"videos/upload" parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData>formData) {
[formData appendPartWithFileData:videoData name:@"video_filename" fileName:@"ipad-video.mov" mimeType:@"video/quicktime"];
}];

所以基本上,我正在为视频文件分配内存。解决方案是使用另一种方法将文件附加到从磁盘流式传输的表单请求:

-appendPartWithFileURL:name:fileName:mimeType:error: will stream data directly from the file, making memory allocation beforehand unnecessary.

长话短说,我完全忽略了分配NSData的所有内存