我有一个应用程序,表现出间歇性崩溃.崩溃日志显示的堆栈跟踪对我来说很难破译,因此希望其他人看到这一点并指出我正确的方向.
基本上,应用程序在启动时执行反向地理编码请求,以显示用户在标签中的位置.另外,我为特定的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) 一般来说,我们如何在Mac应用程序中避免objc_msgSend()崩溃?另外,我们如何避免EXC_BAD_ACCESS崩溃?为什么我们得到它?我们如何处理这类错误?它们正在增加我们的应用程序,并希望就此问题寻求指导和帮助.
我们正在使用XCode 3.2.5,我们的项目是Cocoa,使用Objective-C语言.我们的Web服务是一个基于IIS的ASP.Net网站(我们可以从中下载/上传XML文件和图像).
我们正在Mac上开发一个可可应用程序,我们在启动应用程序的十次尝试中遇到过两次.这个应用程序有一个草图应用程序,当我们运行应用程序时,它只是在1分钟内冻结和崩溃而不做任何事情.这个应用程序的一些功能是:
崩溃不仅限于应用程序的发布后.有时候,在我们的mac应用程序中操作拖放,下载数据集以及添加/编辑/删除功能等程序时,应用程序也会崩溃.
老实说,我们对这个开发平台和环境比较陌生,我们还在学习.你能指导我们这个问题吗?像一些资源或提示我们做错了什么?非常感谢大家和更多的力量.
以下是崩溃报告的示例:
Process: Sketch [63065]
Path: /Users/william_hooley_27Inch/Desktop/untitled folder/MacGlass.app/Contents/MacOS/Sketch
Identifier: com.apple.CocoaExamples.Sketch
Version: 1.049 (48.1)
Code Type: X86 (Native)
Parent Process: launchd [116]
Date/Time: 2011-04-14 13:12:15.421 +1000
OS Version: Mac OS X 10.6.5 (10H574)
Report Version: 6
Interval Since Last Report: 714907 sec
Crashes Since Last Report: 17
Per-App Interval Since Last Report: 206437 sec
Per-App Crashes Since Last Report: 5
Anonymous UUID:
086C860F-E28E-4256-84F9-9692782AAD01
Exception Type: EXC_BAD_ACCESS
(SIGBUS) Exception Codes: …Run Code Online (Sandbox Code Playgroud) 我正在使用本教程研究一些IAP .
首先我用这个获取产品:
-(void)fetchAvailableProductsFirstLoad:(BOOL)firstTimeLoading {
[[IAPHelper sharedInstance] requestProductsWithCompletionHandler:^(BOOL success, NSArray *products) { ...
Run Code Online (Sandbox Code Playgroud)
帮助程序运行以下内容:
- (void)requestProductsWithCompletionHandler:(RequestProductsCompletionHandler)completionHandler {
@synchronized(self) {
// 1
_completionHandler = [completionHandler copy];
// 2
_productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:_productIdentifiers];
_productsRequest.delegate = self;
[_productsRequest start];
}
}
Run Code Online (Sandbox Code Playgroud)
当产品退回或失败时,会调用以下内容:
#pragma mark - SKProductsRequestDelegate
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
NSLog(@"Loaded list of products...");
_productsRequest = nil;
NSArray * skProducts = response.products;
for (SKProduct * skProduct in skProducts) {
NSLog(@"Found product: %@ %@ %0.2f",
skProduct.productIdentifier,
skProduct.localizedTitle,
skProduct.price.floatValue);
} …Run Code Online (Sandbox Code Playgroud) 我已经声明了一个属性someProperty并合成它:
@synthesize someProperty = _someProperty;
但是当我在代码中调用它时,我在getter overide方法中获得了EXC_BAD_ACCESS.为什么??
- (NSString *) someProperty { <---EXC_BAD_ACCESS HERE
if(!self.someProperty)
return self.someOtherProperty;
return self.someProperty;
}
Run Code Online (Sandbox Code Playgroud) 如果我在方向更改期间更改UICollectionView的布局,我会EXC_BAD_ACCESS在几次旋转后得到.
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
UICollectionViewLayout *layout = [[UICollectionViewFlowLayout alloc] init];
self.myCollectionView.collectionViewLayout = layout; // This causes EXC_BAD_ACCESS after a few rotations
}
Run Code Online (Sandbox Code Playgroud)
这是一个UICollectionView错误吗?或者我做错了什么?如果这是一个错误,有没有办法在方向更改期间更改整个布局?
我注意到在这个答案中提到了同样的问题.使用NSZombies进行调试不会产生其他信息.
在我的应用程序中,我有两个视图控制器.第一个Viewcontroller是应用程序窗口的rootViewController.单击第一个ViewController中的Button时,我将第二个Viewcontroller的视图作为subView添加到第一个视图中,第二个ViewController视图中有一个Button,我的问题是当我点击该按钮时应用程序崩溃了
-(void)theCheckoutViewisExpandedwitPatient:(id)patient
{
SecondViewController *sample=[[SecondViewController alloc]init];
CGRect rect=sample.view.frame;
rect.origin.y=30;
rect.origin.x=305;
[sample.view setFrame:rect];
[self.view addSubview:[sample view]];
}
Run Code Online (Sandbox Code Playgroud) 偶尔我会收到此错误:
EXC_BAD_ACCESS Code: KERN_INVALID_ADDRESS at 0x13421772123
Run Code Online (Sandbox Code Playgroud)
它发生在下面的save:行中(在CoreDataController单例类中)
NSError *error = nil;
NSManagedObjectContext *managedObjectContext = self.managedObjectContext;
if (managedObjectContext != nil) {
if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
}
}
Run Code Online (Sandbox Code Playgroud)
我知道这不是很多代码,但从经验来看,这是有共同的原因,以及任何方法来防止这个应用程序崩溃?
我上传了应用程序并被拒绝说
我们发现您的应用程序在运行iOS 7的iPad上崩溃,这不符合App Store审核指南.
好吧,我上传的时间,iOS7没有启动.
崩溃报告说
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 …Run Code Online (Sandbox Code Playgroud) 我的iPhone应用程序崩溃在客户端设备上的ios 7.0 iphone 5s我无法弄清楚它有什么问题,我正在使用crashlytics进行崩溃报告.Crashlytics报告由于线程#9 DataDetectorsCore processToken上的错误访问而崩溃
Crashed: NSOperationQueue 0x17023e120
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000620a51e24
0 DataDetectorsCore processToken + 400
1 DataDetectorsCore _DDScannerHandleState + 344
2 DataDetectorsCore _DDScannerHandleState + 344
3 DataDetectorsCore _DDScannerHandleState + 400
4 DataDetectorsCore _DDScannerHandleState + 400
5 DataDetectorsCore _DDScannerHandleState + 400
6 DataDetectorsCore _DDScannerHandleState + 400
7 DataDetectorsCore DDScannerScanQuery + 456
8 DataDetectorsUI -[DDOperation main] + 240
9 Foundation -[__NSOperationInternal _start:] + 644
10 Foundation __NSOQSchedule_f + 76
11 libdispatch.dylib _dispatch_client_callout + 16
12 libdispatch.dylib _dispatch_async_redirect_invoke + 152 …Run Code Online (Sandbox Code Playgroud) 我得到一个间歇性的错误,证明很难调试.
我从以下方法得到以下错误
Core Data Fetch上的EXC_BAD_ACCESS(代码= 1,地址= 0x10)
class func getAll(context: NSManagedObjectContext) -> [Tag] {
var returnValue: [Tag] = []
do {
let fetchRequest = NSFetchRequest(entityName: Tag.entityName())
returnValue = try context.executeFetchRequest(fetchRequest) as! [Tag]
} catch {
}
return returnValue
}
Run Code Online (Sandbox Code Playgroud)
这个错误是间歇性的,并且只发生在每几百个会话中,但是出现频繁,我需要处理它.代码中断了returnvalue = try context.execute...
fetchRequest的不是nil context的不是nil我已经打开了NSZombieFlag来试图查看某个内存是否在某个地方被释放然后被访问,但是我对这导致了什么感到难过.任何想法或见解将不胜感激.