I am usually able to solve the crashes but here I have not clue from where it comes from.
I use parse, and I am simply doing a request in background with a completion block.
The app crashes at a simple if condition and I can barely identify anything, no way to print description, ...
Do you have any idea ? A starting point ? anything ?
Xcode 6.1 is really strange, it seems that the debugger is buggy.
Here is the log of the crash :
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000019657a964 __kill + 8
1 MyAPP 0x00000001001f2b70 0x10009c000 + 1403760
2 libsystem_platform.dylib 0x0000000196610958 _sigtramp + 64
3 MyAPP 0x00000001001318cc 0x10009c000 + 612556
4 MyAPP 0x000000010013797c 0x10009c000 + 637308
5 MyAPP 0x0000000100135fc4 0x10009c000 + 630724
6 MyAPP 0x00000001002e408c 0x10009c000 + 2392204
7 MyAPP 0x00000001001dbf78 0x10009c000 + 1310584
8 libdispatch.dylib 0x00000001964393a8 _dispatch_call_block_and_release + 20
9 libdispatch.dylib 0x0000000196439368 _dispatch_client_callout + 12
10 libdispatch.dylib 0x000000019643d97c _dispatch_main_queue_callback_4CF + 928
11 CoreFoundation 0x000000018566d69c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
12 CoreFoundation 0x000000018566b744 __CFRunLoopRun + 1488
13 CoreFoundation 0x00000001855991f0 CFRunLoopRunSpecific + 392
14 GraphicsServices 0x000000018e7275a0 GSEventRunModal + 164
15 UIKit 0x0000000189eca780 UIApplicationMain + 1484
16 Shuff 0x0000000100129474 0x10009c000 + 578676
17 libdyld.dylib 0x0000000196462a04 start + 0
And here is a sample of the iOS code :
var query = PFQuery(className: "_User")
query.whereKey("facebookId", containedIn: ids)
query.findObjectsInBackgroundWithBlock(){
results, error in
if var resultsvar = results? {
self.functionToCall(resultsvar)
}
}
and the functionToCall crashes.
Maybe this can help :
0 0x00000001001679c8 in specialization of Swift._ArrayBuffer._nonNative.getter : Swift.Optional [inlined] ()
Yes !!! The debugger is not working well ! I was able to find the correct lines by doing the following : put a breakpoint at the start of where you think the app crashes, go step by step, remember the lowest line you've gone through. Even if the debugger crashes on another the line, the line you are looking for is probably the lowest one.
This is just a guess but I was working on something similar and I think you need to change this code to:
query.findObjectsInBackgroundWithBlock(){
results?, error? in
if var resultsvar = results {
self.functionToCall(resultsvar)
}
}
Note that I made both results and error optional. In my case I was providing a block defined in Obj-C, and in Obj-C these objects can legally be == nil. So I think you have to define them as optionals in Swift.
Related
We see a sporadic crash in our user base, during a routine read from NSUserDefaults. The overwhelming majority of users don't experience this problem, and those that do aren't running any particular version of iOS. It seems to have appeared only since we started deploying with Xcode 9.1.
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x000000016efe3fc0
Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x101816d4c #objc _NSContiguousString.length() + 5720
1 CoreFoundation 0x181e2a168 CFStringCompareWithOptionsAndLocale + 96
2 Foundation 0x1828602fc -[NSString isEqualToString:] + 76
3 CoreFoundation 0x181e19558 CFEqual + 596
4 CoreFoundation 0x181e15414 CFBasicHashFindBucket + 344
5 CoreFoundation 0x181e152a0 CFDictionaryGetValue + 224
6 CoreFoundation 0x181ef0c74 -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 108
7 CoreFoundation 0x181f8f224 -[CFPrefsSource copyValueForKey:] + 64
8 CoreFoundation 0x181f992c0 __76-[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:]_block_invoke + 40
9 CoreFoundation 0x181ef44f0 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:buttConfigurationURL:perform:]_block_invoke + 268
10 CoreFoundation 0x181ef3d0c normalizeQuintuplet + 356
11 CoreFoundation 0x181ef43d8 -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:buttConfigurationURL:perform:] + 108
12 CoreFoundation 0x181f99258 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 124
13 CoreFoundation 0x181f9bbbc _CFPreferencesGetAppBooleanValueWithContainer + 136
14 Foundation 0x1828517a8 -[NSUserDefaults(NSUserDefaults) boolForKey:] + 112
15 <our code> 0x100d80750 #objc SettingsPersistence.persistedBool.getter (SettingsPersistence.swift:90)
Here's how we retrieve the value (Swift 3, called via Objective C):
fileprivate static let PersistedBoolKey = "persistedBool"
public var persistedBool: Bool {
get {
return UserDefaults.standard.bool(forKey: SettingsPersistence.PersistedBoolKey)
}
set(newPersistedBool) {
UserDefaults.standard.set(newPersistedBool, forKey: SettingsPersistence.PersistedBoolKey)
}
}
I thought it might be a thread issue, but this occurs on the main thread. Either way, NSUserDefaults is documented as completely thread-safe.
This looks to me like a low-level bug in Apple's libraries. What can I do to fix this problem on my end? Who should I report it to? Has anyone else experienced a similar problem?
Thank you!
This crash has disappeared ever since upgrading Xcode to 9.4.1.
My app crash with a NSInternalInconsistencyException like this
Exception reason:NSInternalInconsistencyException
Exception name:Can't cancel on a touch that isn't already active!
Exception stack:(
0 CoreFoundation 0x0000000191a4d1d0 <redacted> + 148
1 libobjc.A.dylib 0x000000019048455c objc_exception_throw + 56
2 CoreFoundation 0x0000000191a4d08c <redacted> + 0
3 Foundation 0x000000019250502c <redacted> + 112
4 UIKit 0x0000000197fd1960 <redacted> + 404
5 UIKit 0x0000000197fcf970 <redacted> + 1648
6 libdispatch.dylib 0x00000001908d61fc <redacted> + 24
7 libdispatch.dylib 0x00000001908d61bc <redacted> + 16
8 libdispatch.dylib 0x00000001908e43dc <redacted> + 928
9 libdispatch.dylib 0x00000001908d99a4 <redacted> + 652
10 libdispatch.dylib 0x00000001908e634c <redacted> + 572
11 libdispatch.dylib 0x00000001908e60ac <redacted> + 124
12 libsystem_pthread.dylib 0x0000000190adf2a0 _pthread_wqthread + 1288
13 libsystem_pthread.dylib 0x0000000190aded8c start_wqthread + 4
)
How do i analyse the log? Like What do those number tags mean,"+ 148" "+ 56"...? How to detect the code that have invoked this exception.
Is this a crash from a release build of the app, or do you have it in Xcode? If in Xcode please provide the code causing the crash?
Looking at your report, the line
Can't cancel on a touch that isn't already active!
seems very telling. I would look through your code for anywhere you are interacting with a UITouch object, or perhaps a UIGestureRecognizer. My guess would be that somewhere you are manually calling to cancel an interaction that you should not be, and there is a race condition where that can sometimes happen after the system has already cancelled the touch (or vice versa, I guess).
I am having a testflight user reporting random crashes which I cannot seem to replicate. The relevant section of their crash log is here:
Thread 0 name:
Thread 0 Crashed:
0 iMavlink 0x00000001001045a4 0x10009c000 + 427428
1 iMavlink 0x00000001001049fc 0x10009c000 + 428540
2 iMavlink 0x00000001000ee54c 0x10009c000 + 337228
3 iMavlink 0x00000001000b9354 0x10009c000 + 119636
4 libdispatch.dylib 0x0000000182a894bc _dispatch_call_block_and_release + 24 (init.c:760)
5 libdispatch.dylib 0x0000000182a8947c _dispatch_client_callout + 16 (object.m:506)
6 libdispatch.dylib 0x0000000182a8eb84 _dispatch_main_queue_callback_4CF + 1844 (inline_internal.h:1063)
7 CoreFoundation 0x0000000182ff4d50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1613)
8 CoreFoundation 0x0000000182ff2bb8 __CFRunLoopRun + 1628 (CFRunLoop.c:2718)
9 CoreFoundation 0x0000000182f1cc50 CFRunLoopRunSpecific + 384 (CFRunLoop.c:2814)
10 GraphicsServices 0x0000000184804088 GSEventRunModal + 180 (GSEvent.c:2245)
11 UIKit 0x0000000188206088 UIApplicationMain + 204 (UIApplication.m:3772)
12 iMavlink 0x00000001000dbc94 0x10009c000 + 261268
13 libdyld.dylib 0x0000000182aba8b8 start + 4 (start_glue.s:78)
Im not sure where to even begin with this. It dosent seem to have any reference to my code which I can see, but I am new to debugging in Xcode using testflight so I am probably missing something really obvious.
Can anyone help?
Thanks!
Tom
I'm experimenting this error only when I'm using saveEventually (iOS 8), and the Object I'm modifying is not PFUser:
var myObj = PFObject(className: "MyClass")
myObj["val"] = 100
myObj.saveEventually()
<- Crash with the error:
'NSInternalInconsistencyException', reason: 'User cannot be deleted unless they have been authenticated via logIn or signUp'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107182f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000109510bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000107182e6d +[NSException raise:format:] + 205
3 AAA 0x0000000105a7a85c -[PFUser(Private) checkDeleteParams] + 71
4 AAA 0x0000000105a3b6e9 -[PFObject(Private) _constructDeleteCommand:sessionToken:] + 81
5 AAA 0x0000000105a45c5c -[PFPinningEventuallyQueue _commandWithIdentifier:error:] + 147
6 AAA 0x0000000105a71b7b -[PFEventuallyQueue _runCommandsWithRetriesCount:] + 951
7 libdispatch.dylib 0x0000000109cb57f4 _dispatch_client_callout + 8
8 libdispatch.dylib 0x0000000109cac09a _dispatch_source_latch_and_call + 852
9 libdispatch.dylib 0x0000000109ca46d2 _dispatch_source_invoke + 412
10 libdispatch.dylib 0x0000000109c9d9ae _dispatch_queue_drain + 1045
11 libdispatch.dylib 0x0000000109c9d432 _dispatch_queue_invoke + 235
12 libdispatch.dylib 0x0000000109c9ffc1 _dispatch_root_queue_drain + 685
13 libdispatch.dylib 0x0000000109ca15d9 _dispatch_worker_thread3 + 111
14 libsystem_pthread.dylib 0x000000010a039637 _pthread_wqthread + 729
15 libsystem_pthread.dylib 0x000000010a03740d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
The same if I'm using:
myObj.saveEventually{(success: Bool!, error: NSError!) -> Void in
The error is not nil neither has something, saveEventually is just crashing.
But if I use just saveInBackgroundWithBlock or save() is working just fine...
any ideas?
I'm completely sure was working yesterday, I'm using saveEventually for almost everything in my project, but the error doesnt make sense for me, because I'm not mofifying a PFUser. Using the last SDK.
Thanks in advance!
OK...the solution was quite simple:
In the simulator: Reset Content & Settings
In XCode: Product -> Clean && Build
Close Xcode
rm -rf ~/library/Developer/Xcode/DerivedData/
Open XCode
Definitely the error looked like a bug or something like that, but probably some Cache or ...whatever... was around somewhere.
Hope this helps
Cheers
I am currently developing an app in Spritekit with Swift. The app worked perfectly on device and in the simulator until I updated to Xcode 6 Beata 3 and iOS 8 Beta 3. When I run the app in the simulator everything still works perfect. But running the app on the device causes a exc_bad_acces when I create a SKTextureAtlas. Is anyone facing a similar problem or can anyone help me how to solve this.
I've alredy tried to run it on a device with iOS8 Beta 2 but I run into the same error here. I also deleted the app but that also didn't solve my problem when running the app on a device.
Here is the place it crashes:
var atlas = SKTextureAtlas(named: "ImageSet")
and that is the log from the device:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0xfffffffc
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libswift_stdlib_core.dylib 0x003a737e 0x286000 + 1184638
1 My Game 0x000f6900 Swift._doesImplicitlyUnwrappedOptionalHaveValue <A>(#inout A!) -> Builtin.Int1 (ComputerPlayer.swift:0)
2 My Game 0x0011c0a0 #!objc ObjectiveC.SKTextureAtlas.__allocating_init (ObjectiveC.SKTextureAtlas.Type)(named : Swift.String!) -> ObjectiveC.SKTextureAtlas (SpriteKit-1CMA4777KYE20.pcm:1)
3 My Game 0x0010e010 My_Game.GameScene.didMoveToView (My_Game.GameScene)(ObjectiveC.SKView) -> () (GameScene.swift:132)
4 My Game 0x00113218 #objc My_Game.GameScene.didMoveToView (My_Game.GameScene)(ObjectiveC.SKView) -> () (GameScene.swift:0)
5 SpriteKit 0x2e6d6340 SKGenerateNormalMap + 65680
6 SpriteKit 0x2e6f02de SKGenerateNormalMap + 172078
7 My Game 0x0011fd38 My_Game.GameViewController.viewWillLayoutSubviews (My_Game.GameViewController)() -> () (GameViewController.swift:71)
8 My Game 0x00121468 #objc My_Game.GameViewController.viewWillLayoutSubviews (My_Game.GameViewController)() -> () (GameViewController.swift:0)
9 UIKit 0x2e844266 0x2e837000 + 53862
10 QuartzCore 0x2e2804c0 CABackingStoreGetTypeID + 892
11 QuartzCore 0x2e27bea0 CARenderServerGetServerPort + 5364
12 QuartzCore 0x2e27bd28 CARenderServerGetServerPort + 4988
13 QuartzCore 0x2e27b70c CARenderServerGetServerPort + 3424
14 QuartzCore 0x2e27b510 CARenderServerGetServerPort + 2916
15 UIKit 0x2eaa6cf8 _UIApplicationIsExtension + 4936
16 UIKit 0x2eaa79e0 _UIApplicationIsExtension + 8240
17 UIKit 0x2eab1a68 _UIApplicationUsesAlternateUI + 38388
18 UIKit 0x2eaa5ec8 _UIApplicationIsExtension + 1304
19 FrontBoardServices 0x319bd04e _FBSLog + 2198
20 CoreFoundation 0x2b1692d2 CFRunLoopTimerSetTolerance + 5878
21 CoreFoundation 0x2b168594 CFRunLoopTimerSetTolerance + 2488
22 CoreFoundation 0x2b166d16 _CFRunLoopGet2b + 2174
23 CoreFoundation 0x2b0b624c CFRunLoopRunSpecific + 472
24 CoreFoundation 0x2b0b605e CFRunLoopRunInMode + 102
25 UIKit 0x2e8ab5ba _UISharedImageSetLoadFactor + 3906
26 UIKit 0x2e8a6844 UIApplicationMain + 1436
27 My Game 0x0012a940 top_level_code (AppDelegate.swift:0)
28 My Game 0x0012a97c main (AppDelegate.swift:0)
29 libdyld.dylib 0x385aaaac _tlv_atexit + 8
Thank you
Try running Clean on the project, a few people had problems with bad access, me included, when updating. Some resolved it with clean and some withe a fresh copy of the project.