I have a strange problem with TestFlight SDK. On iPhone5 I get this exception, app crashed.
Here is backtrace:
Reason: -[__NSArrayM length]: unrecognized selector sent to instance 0x20c76d80
UserInfo: (null)
Backtrace: (0x3abbc2a3 0x34aab97f 0x3abbfe07 0x3abbe531 0x3ab15f68 0x3591b0c1 0x996eb 0xb2b83 0x97b21 0x973ed 0x75913 0x83657 0x839e7 0x38eaf11f 0x38eb3961 0x38eb3ac1 0x35c18a11 0x35c188a4)
Stack symbols: (
0 CoreFoundation 0x3abbc2bb <redacted> + 186
1 libobjc.A.dylib 0x34aab97f objc_exception_throw + 30
2 CoreFoundation 0x3abbfe07 <redacted> + 170
3 CoreFoundation 0x3abbe531 <redacted> + 392
4 CoreFoundation 0x3ab15f68 _CF_forwarding_prep_0 + 24
5 Foundation 0x3591b0c1 <redacted> + 160
6 FlyerApp 0x000996eb +[TFAirTrafficController logPath] + 102
7 FlyerApp 0x000b2b83 -[TFMessagePackLogOperation writeLogData] + 50
8 FlyerApp 0x00097b21 TFLogv + 92
9 FlyerApp 0x000973ed TFLog + 60
10 FlyerApp 0x00075913 -[KFRemoteLoadManager changesRequestFromDate:forDelegate:] + 834
11 FlyerApp 0x00083657 -[KFSyncManager _startSync] + 574
12 FlyerApp 0x000839e7 __31-[KFSyncManager tryToStartSync]_block_invoke_0132 + 54
13 libdispatch.dylib 0x38eaf11f <redacted> + 10
14 libdispatch.dylib 0x38eb3961 <redacted> + 252
15 libdispatch.dylib 0x38eb3ac1 <redacted> + 84
16 libsystem_c.dylib 0x35c18a11 <redacted> + 360
17 libsystem_c.dylib 0x35c188a4 start_wqthread + 8
)
I suggest that code which cause this exception is next:
NSString *urlString = [NSString stringWithFormat:BASE_URL, [[KFLocalDataManager sharedManager] serverName]];
urlString = [[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] stringByAppendingString:methodName];
NSURL *url = [NSURL URLWithString:urlString];
TTLog(#"Request URL - '%#'", url);
Where TTLog is
#define TTLog(__FORMAT__, ...) TFLog((#"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
url string is url to server like this:
https://xxxxxx.xxxxxxx.com/xxxxx_xxxx/xxxx
This error occurs not every time but always in this place. I have several crash but I cannot see some similar environment for all same crash issues.
Also this code running in not main app thread and sometimes in iOS background.
Maybe TFLog have some restrictions for incoming parameters or somebody receive same or similar exception with TestFlight?
I work at TestFlight on the SDK. #Nevir is correct. Unfortunately, TFLog is not thread safe. This issue has been recently brought to our attention. I'm working on an update that will fix this issue and hope to have a beta out soon. I'll keep you updated.
There is a new beta that fixes this issue: 1.3.0-beta. Get it here: https://testflightapp.com/sdk/download/ (look for "Feeling Adventurous?")
Related
I am unable to reproduce the issue. One of my user sent the crash log and the issue seem to point to NSUserDefault setBool:forKey method.
Not working for user Device iPhone 6, iOS version: 12.4.4. For now only one user contacted due to the App crash.
Working on the devices I tested. (iPad Air 2, iPhone XS, iOS version 13.3)
This is the method I am using.
- (void) saveToDefaults:(NSString*)productId
{
[ [ NSUserDefaults standardUserDefaults ] setBool:YES forKey:productId ];
[ [ NSUserDefaults standardUserDefaults ] synchronize];
}
Crash dump
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000020eae32e4
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [15897]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 CoreFoundation 0x000000020eae32e4 CFHash + 372 (CFRuntime.c:1147)
1 CoreFoundation 0x000000020eb75a38 CFBasicHashFindBucket + 224 (CFBasicHash.c:465)
2 CoreFoundation 0x000000020eb75a38 CFBasicHashFindBucket + 224 (CFBasicHash.c:465)
3 CoreFoundation 0x000000020eaada40 CFDictionaryGetValue + 120 (CFDictionary.c:413)
4 CoreFoundation 0x000000020eaca938 -[CFPrefsSearchListSource alreadylocked_setPrecopiedValues:forKeys:count:from:] + 496 (CFPrefsSearchListSource.m:632)
5 CoreFoundation 0x000000020eb81230 -[CFPrefsSource setValues:forKeys:count:copyValues:removeValuesForKeys:count:from:] + 372 (CFPrefsSource.m:742)
6 CoreFoundation 0x000000020eb81524 -[CFPrefsSource setValues:forKeys:count:copyValues:from:] + 36 (CFPrefsSource.m:766)
7 CoreFoundation 0x000000020ea3e3dc -[CFPrefsSource setValue:forKey:from:] + 64 (CFPrefsSource.m:772)
8 CoreFoundation 0x000000020eaccc54 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurat... + 272 (CFPrefsSearchListSource.m:1553)
9 CoreFoundation 0x000000020eacc698 normalizeQuintuplet + 340 (CFPrefsSearchListSource.m:63)
10 CoreFoundation 0x000000020ea3ad64 -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationUR... + 108 (CFPrefsSearchListSource.m:1433)
11 CoreFoundation 0x000000020ea3dd7c -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 92 (CFXPreferences.m:759)
12 CoreFoundation 0x000000020eb8b360 _CFPreferencesSetAppValueWithContainerAndConfiguration + 132 (CFXPreferences.m:1867)
13 Foundation 0x000000020f4eb3b8 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 64 (NSUserDefaults.m:228)
14 MyApp 0x00000001004adb14 -[IAPHelper saveToDefaults:] + 88 (IAPHelper.m:206)
15 MyApp 0x00000001004adc3c -[IAPHelper restoreTransaction:] + 224 (IAPHelper.m:223)
16 MyApp 0x00000001004ad928 -[IAPHelper paymentQueue:updatedTransactions:] + 264 (IAPHelper.m:0)
17 libdispatch.dylib 0x000000020e58ca38 _dispatch_call_block_and_release + 24 (init.c:1372)
18 libdispatch.dylib 0x000000020e58d7d4 _dispatch_client_callout + 16 (object.m:511)
19 libdispatch.dylib 0x000000020e53b008 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1068 (inline_internal.h:2441)
20 CoreFoundation 0x000000020eae0b20 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1813)
21 CoreFoundation 0x000000020eadba58 __CFRunLoopRun + 1924 (CFRunLoop.c:3113)
22 CoreFoundation 0x000000020eadafb4 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
23 GraphicsServices 0x0000000210cdc79c GSEventRunModal + 104 (GSEvent.c:2245)
24 UIKitCore 0x000000023b33cc38 UIApplicationMain + 212 (UIApplication.m:4353)
25 MyApp 0x00000001004e9cec main + 88 (main.m:14)
26 libdyld.dylib 0x000000020e59e8e0 start + 4
How can I handle this exception to avoid this problem in the future.
Following up comments discussion and this answer indicating synchronize is not required (as per Apple's iOS 12 release notes):
My target iOS is from 11.2, guess I cannot use it for now.
Yes you can.
Wrapping up my suggestion in comment :
if (#available(iOS 12, *)) {
// don't need to synchronize
} else {
[NSUserDefaults.standardUserDefaults synchronize];
}
The above code #available Swift-like syntax assumes you're using Xcode 9 or higher. Which given the targeted iOS is pretty much a must.
Just to make myself 100% clear I cannot guarantee this will solve this particular crash issue, but it is worth trying as a very low effort fix candidate.
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.
I am using UIWebViews in some of the screens, because I need a perfect Html text parsing.
According to crash reports a huge number of crashes, called WTF Crash, occur on these screens. Here is a trace of that crash
Crashed: WebThread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000bbadbeef
Thread : Crashed: WebThread
0 JavaScriptCore 0x184fd2710 WTFCrash + 72
1 JavaScriptCore 0x184fd2708 WTFCrash + 64
2 WebCore 0x1852b7d78 <redacted> + 362
3 WebCore 0x1852b7bec <redacted> + 44
4 CoreFoundation 0x1817d8588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
5 CoreFoundation 0x1817d632c __CFRunLoopDoObservers + 372
6 CoreFoundation 0x1817d6674 __CFRunLoopRun + 696
7 CoreFoundation 0x181705680 CFRunLoopRunSpecific + 384
8 WebCore 0x1852b5998 <redacted> + 456
9 libsystem_pthread.dylib 0x18148bb28 <redacted> + 156
10 libsystem_pthread.dylib 0x18148ba8c _pthread_start + 154
11 libsystem_pthread.dylib 0x181489028 thread_start + 4
There is no OS version, or device relation on this crash.
I am not doing anything fancy on using UIWebView as well. It is added to nib like every other component, and in the implementation file I use it like the following
self.webView.scrollView.scrollEnabled = NO;
self.webView.scrollView.bounces = NO;
self.webView.opaque = NO;
self.webView.backgroundColor = [UIColor clearColor];
self.webView.delegate = self;
[self.webView loadHTMLString:htmlString baseURL:nil];
Any suggestions on how to solve WTF Crash?
Edit: Here is how htmlString looks like
Printing description of htmlString:
<html><body style="font-family:HelveticaNeue; font-size:10; background-color:#E5E4E4; text-align:left; color:#696969 ">test string</body></html>
I don't know how you are creating your UIWebView. But I was having a similiar issue with a WTFCrash and I was able to solve it by making sure that the UIWebView was being created on the main thread:
- (void)createWebView{
if (![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self createWebView];
});
return;
}
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
//Rest of my code
}
Are you debugging your web view with Safari? If yes, the crash should be gone after you quit Safari.
I was facing a similar crash with WKWebView, and I was sure the same code worked happily 3 days ago. hlung's comments saved me, you can find it HERE.
For your reference, following is a piece of the crash log in my case.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000dbbdfb10
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 Crashed:
0 JavaScriptCore 0x225d74c6 WTF::HashSet<JSC::MarkedArgumentBuffer*, WTF::PtrHash<JSC::MarkedArgumentBuffer*>, WTF::HashTraits<JSC::MarkedArgumentBuffer*> >::remove(JSC::MarkedArgumentBuffer* const&) + 54
1 JavaScriptCore 0x22620b41 JSC::VM::~VM() + 211
2 JavaScriptCore 0x22197e57 JSC::JSLockHolder::~JSLockHolder() + 73
3 JavaScriptCore 0x2248defd JSContextGroupRelease + 61
4 JavaScriptCore 0x2250e37d -[JSVirtualMachine dealloc] + 27
5 libobjc.A.dylib 0x1dac5195 objc_object::sidetable_release(bool) + 239
6 JavaScriptCore 0x2248d261 -[JSContext dealloc] + 125
7 libobjc.A.dylib 0x1dac5195 objc_object::sidetable_release(bool) + 239
8 JavaScriptCore 0x226470af WTF::RunLoop::TimerBase::timerFired(__CFRunLoopTimer*, void*) + 25
9 CoreFoundation 0x1e807357 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 15
10 CoreFoundation 0x1e807029 __CFRunLoopDoTimer + 897
11 CoreFoundation 0x1e8069e1 __CFRunLoopDoTimers + 221
12 CoreFoundation 0x1e804cc5 __CFRunLoopRun + 1365
13 CoreFoundation 0x1e754073 CFRunLoopRunSpecific + 487
14 CoreFoundation 0x1e753e81 CFRunLoopRunInMode + 105
15 GraphicsServices 0x1ff00bfd GSEventRunModal + 157
16 UIKit 0x2390e82f -[UIApplication _run] + 575
17 UIKit 0x23908f61 UIApplicationMain + 151
18 MyApp 0x00488b29 0x2c000 + 4573993
19 libdyld.dylib 0x1df1e50b start + 3
WebKit, the engine behind Web Views, can raise a crash when it sees a memory problem.
These are identified by the special Hex Word 0x00000000bbadbeef as you have found.
The web page you are visiting seems trivial, so it is a surprise that you are having problems. I recommend you follow the WebKit debugging facilities described at:
https://webkit.org/debugging-webkit/#ios-simulator
Please update your question with any logs or insights this reveals.
It was a Google Ads issue, already fixed for sure on version 7.35.0 of October, 17 and newer versions.
You should be able to fix the issue updating your pod.
From the Google Mobile Ads SDK Developers Team mailing:
"The issue has been fixed by the team and it should go live in an upcoming SDK release (release notes)." (August, 20)
"Issue has been fixed and live already." (October, 17)
Source: https://groups.google.com/d/msg/google-admob-ads-sdk/XL35wo6mQts/R2LlGZDxBwAJ
Release Notes: https://developers.google.com/admob/ios/rel-notes
I am getting this error when I compile successfully and the app launches, 1 time out of 3:
2015-03-26 12:39:32.294 Cleverly[1689:136981] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid class name. Class names cannot start with an underscore.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109943a75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001095dcbb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001099439ad +[NSException raise:format:] + 205
3 Cleverly 0x0000000104f0f50d +[PFObject(Private) _assertValidInstanceClassName:] + 128
4 Cleverly 0x0000000104f0974a -[PFObject(Private) initWithClassName:isPointer:] + 74
5 Cleverly 0x0000000104f09b82 +[PFObject(Private) objectWithClassName:isPointer:] + 151
6 Cleverly 0x0000000104f17163 +[PFObject objectWithoutDataWithClassName:objectId:] + 158
7 Cleverly 0x0000000104f0facf +[PFObject(Private) _objectFromDataFile:error:] + 571
8 Cleverly 0x0000000104f66b34 +[PFUser currentUser] + 581
9 Cleverly 0x0000000104f2e26d -[PFQuery _user] + 43
10 Cleverly 0x0000000104f2e83d -[PFQuery _findObjectsAsync:after:] + 104
11 Cleverly 0x0000000104f30860 -[PFQuery findObjectsInBackgroundWithBlock:] + 288
12 Cleverly 0x0000000104dc873e -[ServerManager uploadOrDeleteMyUserMissingSyncFiles] + 318
13 Cleverly 0x0000000104dce7e6 +[ServerManager uploadOrDeleteMyUserMissingSyncFiles] + 102
14 Cleverly 0x0000000104d8d593 __57-[AppDelegate application:didFinishLaunchingWithOptions:]_block_invoke + 35
15 libdispatch.dylib 0x0000000109e21186 _dispatch_call_block_and_release + 12
16 libdispatch.dylib 0x0000000109e40614 _dispatch_client_callout + 8
17 libdispatch.dylib 0x0000000109e2a552 _dispatch_root_queue_drain + 1768
18 libdispatch.dylib 0x0000000109e2bb17 _dispatch_worker_thread3 + 111
19 libsystem_pthread.dylib 0x000000010a1c5637 _pthread_wqthread + 729
20 libsystem_pthread.dylib 0x000000010a1c340d start_wqthread + 13
)
I think it has something to do with adding ParseSDK with CocoaPods. Any ideas? Would it crash even if it was on the store?
It occurs when you make an asynchronous request and try to use data before finishing request. Put for example a loader to see exactly when your async call finished loading data. Also make sure you put/ set parse appid and key [Parse setApplicationId:clientKey:], before any call to parse operations (such as PFUser user). It can crash even in App Store due async not finished loading full data. I think that is the reason you get exception random.
I'm having a pretty consistent issue here, and have literally searched everywhere to no avail. I've been having a ton of problems with CocoaLibSpotify, and this error is just more hours being wasted of my employer, but anyways.
Whenever I attempt to login or do an SPSearch I get an unrecognized selector and the application crashes. Here's the code below. Thanks for your patience!
SPDispatchAsync(^{
NSError *error = nil;
//[SPSession class];
[SPSession initializeSharedSessionWithApplicationKey:[NSData dataWithBytes:&g_appkey length:g_appkey_size]
userAgent:#"com.mattie.montgomery.listenin"
loadingPolicy:SPAsyncLoadingManual
error:&error];
if (error != nil) {
NSLog(#"CocoaLibSpotify init failed: %#", error);
abort();
}
[[SPSession sharedSession] setDelegate:self];
[[SPSession sharedSession] attemptLoginWithUserName:#"USERNAME" password:#"PASSWORD"];
// playbackManager = [[SPPlaybackManager alloc] initWithPlaybackSession:[SPSession sharedSession]];
//[search addObserver:self forKeyPath:#"searchInProgress" options:NSKeyValueObservingOptionNew context:NULL];
// search = [SPSearch searchWithSearchQuery:#"What is love" inSession:[SPSession sharedSession]];
});
Here's the exception:
2014-01-13 13:24:48.890 ListenIn[47201:4303] +[NSError spotifyErrorWithCode:]: unrecognized selector sent to class 0x2cd8298
2014-01-13 13:24:48.979 ListenIn[47201:4303] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSError spotifyErrorWithCode:]: unrecognized selector sent to class 0x2cd8298'
* First throw call stack:
(
0 CoreFoundation 0x030835e4 exceptionPreprocess + 180
1 libobjc.A.dylib 0x02e068b6 objc_exception_throw + 44
2 CoreFoundation 0x031207a3 +[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0307390b __forwarding + 1019
4 CoreFoundation 0x030734ee _CF_forwarding_prep_0 + 14
5 ListenIn 0x00039a6b logged_in + 139
6 ListenIn 0x0018c1de sp_session_set_private_session + 538
7 ListenIn 0x000f0cf7 -[SPClientUpsellViewController .cxx_destruct] + 639639
8 ListenIn 0x0009c277 -[SPClientUpsellViewController .cxx_destruct] + 292887
9 ListenIn 0x0018af5f sp_session_process_events + 80
10 ListenIn 0x0003854c -[SPSession prodSessionForcefully] + 332
11 ListenIn 0x0003cf2c notify_main_thread_block_invoke + 44
12 ListenIn 0x0002b63d __54+[SPSession dispatchToLibSpotifyThread:waitUntilDone:]_block_invoke + 93
13 CoreFoundation 0x030421c0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 16
14 CoreFoundation 0x0300b3f9 CFRunLoopDoBlocks + 361
15 CoreFoundation 0x03029843 __CFRunLoopRun + 2355
16 CoreFoundation 0x03028ac3 CFRunLoopRunSpecific + 467
17 CoreFoundation 0x03033e61 CFRunLoopRun + 129
18 ListenIn 0x0002b905 +[SPSession runBackgroundRunloop:] + 437
19 Foundation 0x02a5e597 -[NSThread main] + 76
20 Foundation 0x02a5e4f6 _NSThread_main + 1275
21 libsystem_pthread.dylib 0x05dc15fb _pthread_body + 144
22 libsystem_pthread.dylib 0x05dc1485 _pthread_struct_init + 0
23 libsystem_pthread.dylib 0x05dc6cf2 thread_start + 34
)
libc++abi.dylib: terminating with uncaught exception of type NSException
First, don't put account credentials like your username and password on the public internet.
As for your problem, pasting in a big block of code isn't very helpful - which line actually generates the error?
Your commented out code at the bottom is in the wrong order - you can't add an observer to something until after you've created it.
Finally, please re-read the readme, specifically the part about threading. You only need to use SPDispatchAsync in very specific circumstances, and you should never be using it in normal usage like this.
The answer was to add the -ObjC linker flag and add the Facebook API to the project. Thanks to iKenndac for the suggestion.