_NSInlineData base64EncodedString - unrecognized selector sent to instance - ios

I created an ipad project in XCode based on the Evernote SDK sample. The method for testing OAuth worked. I switched from direct sources in project to CocoaPods pod 'Evernote-SDK-iOS', '~> 1.3' and now I'm getting following exception.
When it stopped working I noticed that I was running the simulator for "iPad" unintentionally. I used "iPad Retina 64bit" before when it worked in the beginning. When I switched to 64bit it worked. I tried it in the version with direct sources instead of pods and for "iPad" version it opened Authorizing popup, when I logged in I was able to log in for "iPad" in the CocoaPods version too.... seems that in the CocoaPods version there is a problem with the authorization and not in the difference between simulators... it just works when I first authorize my app using my old code...
Any idea where could be a difference between direct source code in project and using CocoaPods?
I get the exception on row 153: return [data base64EncodedString]; in file ENGCOAuth.m
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSInlineData base64EncodedString]: unrecognized selector sent to instance 0x958ca10'
*** First throw call stack:
(
0 CoreFoundation 0x01b001e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x009538e5 objc_exception_throw + 44
2 CoreFoundation 0x01b9d243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01af050b ___forwarding___ + 1019
4 CoreFoundation 0x01af00ee _CF_forwarding_prep_0 + 14
5 MemloNotepad 0x001d378a -[ENGCOAuth signature] + 618
6 MemloNotepad 0x001d3187 -[ENGCOAuth authorizationHeader] + 167
7 MemloNotepad 0x001d2fb5 -[ENGCOAuth request] + 245
8 MemloNotepad 0x001d4dba +[ENGCOAuth URLRequestForPath:GETParameters:scheme:host:consumerKey:consumerSecret:accessToken:tokenSecret:] + 1082
9 MemloNotepad 0x001eb38c -[EvernoteSession startOauthAuthentication] + 348
10 MemloNotepad 0x001ead7e __68-[EvernoteSession authenticateWithViewController:completionHandler:]_block_invoke + 558
11 MemloNotepad 0x001cfec7 __44-[ENAPI invokeAsyncIdBlock:success:failure:]_block_invoke_2 + 55
Note: I already asked this question in Evernote forum but I didn't get any reply for almost one month.

Another StackOverflow question helped me to solve the problem.
I had to add $(inherited) in Other Linker Flags in Build Settings. I had it in one of the targets but not in all of them.

Related

App crash when using test flight

Finally I finish my application so it is time to make some beta test. So I upload my application to itunes connect to test it out with test flight, but it keep crashing when I perform few task.
When I try to open the app from downloaded menu in test flight app.
When I try make a http request with AFnetworking
When I insert new record to CoreData
Sometime when i open the app from test flight it did not crash but show me a black screen after lauch screen.
I have been searching for 5 day without any clue. I been test it out with both release and debug mode running from xcode it doesn't crash at all. The problem only occur on if the app install from testflight. I think might be some memory allocated issues. It is a bug from testflight? How can I make the same behaviour happening at test flight happen in my xcode as well to know and fix the error.
I'm targeting ios 8.0 ++
Testing on iphone 7 plus(ios 10.2) and iphone 5s(ios 9.3).
Xcode 8.3.2
I get alot of difference crash report but most of it similiar to this one. Maybe I insert some nil value into dictionary? But why does it not happen when I build it from xcode.
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Filtered syslog:
None found
Last Exception Backtrace:
0 CoreFoundation 0x18319ee38 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x182803f80 objc_exception_throw + 56
2 CoreFoundation 0x183084554 -[__NSDictionaryM setObject:forKey:] + 924
3 Cellecter 0x1001db19c 0x100040000 + 1683868
4 Cellecter 0x1001dafe4 0x100040000 + 1683428
5 CoreFoundation 0x183140eac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
6 CoreFoundation 0x1831406cc _CFXRegistrationPost + 396
7 CoreFoundation 0x18314044c ___CFXNotificationPost_block_invoke + 60
8 CoreFoundation 0x1831a9494 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1532
9 CoreFoundation 0x18307e788 _CFXNotificationPost + 368
10 Foundation 0x183adfd1c postQueueNotifications + 684
11 CoreFoundation 0x1831547b0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
12 CoreFoundation 0x183152554 __CFRunLoopDoObservers + 372
13 CoreFoundation 0x183152884 __CFRunLoopRun + 672
14 CoreFoundation 0x18307cd10 CFRunLoopRunSpecific + 384
15 GraphicsServices 0x184964088 GSEventRunModal + 180
16 UIKit 0x188351f70 UIApplicationMain + 204
17 Cellecter 0x1001e8834 0x100040000 + 1738804
18 libdyld.dylib 0x182c1a8b8 start + 4
Updated: some how the my first and fourth question have been fix Now my question narrow it down to crashing when try to insert record into afnetworking.
This could be a lot of things.
It can be a migration issue with CoreData, a ManagedObjectContext issue.
The blackscreen could be a view issue.
Your question is too broad, we don't have code, we don't know your recent development.
Are you using real devices ? Emulators ? Which version of Xcode ? iOS deployment target ?
Please refer to this post next time you ask a question.
How to Ask
I finally manage to fix the issues. Actually the issues is quite simple, I will not be able to fix the issues if I don't symbolicate my crash report, actually the issues is on FCM, From here specifically say I need a production push certificate in order to receive the device token. Which the device token return nil every time and I attempt save the token to core data.

NSInvalidArgumentException in windowsWithKeyWindow running KIF test from XCODE

I'm using KIF 3.3.0 and XCODE 7.1. I've setup KIF using cocoaPods using https://github.com/kif-framework/KIF#installation-with-cocoapods
As soon as I run my tests in XCODE (CMD-U), it tried to run my KIF test but it doesn't launch the application (instead it opens another empty window) which leads to the exception below because the window is nil. But I'm not sure what configuration I'm missing. I know this must be a setup issue. I've already looked at the SO answers All KIF test steps are throwing the same error, what am I doing wrong? and others but they don't tell you what's wrong in the configuration. What am I missing?
Please someone help.
.../Pods/KIF/Additions/UIApplication-KIFAdditions.m:110: error:
-[Mobile_iOSUITests testSuccessfulRegistration] : failed: caught "NSInvalidArgumentException", "*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil" (
0 CoreFoundation 0x000000010e6d1f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010e14bdeb objc_exception_throw + 48
2 CoreFoundation 0x000000010e598ea5 -[__NSArrayM insertObject:atIndex:] + 901
3 Mobile-iOSUITests 0x000000011808fb41
-[UIApplication(KIFAdditions) windowsWithKeyWindow] + 193
4 Mobile-iOSUITests 0x000000011808edc4
-[UIApplication(KIFAdditions) accessibilityElementWithLabel:accessibilityValue:traits:] + 180
5 Mobile-iOSUITests 0x000000011808e06e
+[UIAccessibilityElement(KIFAdditions) accessibilityElementWithLabel:value:traits:error:] + 158
6 Mobile-iOSUITests 0x000000011808db32
+[UIAccessibilityElement(KIFAdditions) accessibilityElement:view:withLabel:value:traits:tappable:error:] + 178
7 Mobile-iOSUITests 0x000000011807f9ca
__83-[KIFUITestActor waitForAccessibilityElement:view:withLabel:value:traits:tappable:]_block_invoke
+ 106
8 Mobile-iOSUITests 0x000000011807c067 -[KIFTestActor tryRunningBlock:complete:timeout:error:] + 167
9 Mobile-iOSUITests 0x000000011807c379 -[KIFTestActor runBlock:complete:timeout:] + 137
10 Mobile-iOSUITests 0x000000011807c484 -[KIFTestActor runBlock:complete:] + 148
11 Mobile-iOSUITests 0x000000011807c560 -[KIFTestActor runBlock:] + 64
12 Mobile-iOSUITests 0x000000011807f901 -[KIFUITestActor waitForAccessibilityElement:view:withLabel:value:traits:tappable:] + 337
13 Mobile-iOSUITests 0x000000011807f731
-[KIFUITestActor waitForViewWithAccessibilityLabel:value:traits:tappable:] + 209
14 Mobile-iOSUITests 0x000000011807f283 -[KIFUITestActor waitForViewWithAccessibilityLabel:] + 99
15 Mobile-iOSUITests 0x0000000118079740 -[Mobile_iOSUITests testSuccessfulRegistration] + 144
This was answered by a developer on github KIF https://github.com/kif-framework/KIF/issues/732
Basically issue was when you create your test target for KIF, make sure to choose IOS Unit Testing Bundle and NOT IOS UI Testing Bundle.

+[UIPasteboard _accessibilityUseQuickSpeakPasteBoard]: unrecognized selector sent to class

I asked this question on Apple Dev forum, but still didn't get an answer.
We expirience 100% iOS 8 devices crash:
+[UIPasteboard _accessibilityUseQuickSpeakPasteBoard]: unrecognized selector sent to class
The stack trace is:
Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x2889ec1f __exceptionPreprocess + 126
1 libobjc.A.dylib 0x36049c8b objc_exception_throw + 38
2 CoreFoundation 0x288a3f55 __CFExceptionProem
3 CoreFoundation 0x288a1def ___forwarding___ + 354
4 CoreFoundation 0x287d3df8 _CF_forwarding_prep_0 + 24
5 UIAccessibility 0x331fc157 +[UIPasteboard_QSExtras pasteboardWithName:create:] + 30
6 MyApp 0x002eb507 -[TJEventOptimizer .cxx_destruct]
7 MyApp 0x002eb28b -[TJEventOptimizer .cxx_destruct]
8 MyApp 0x002f0c2b -[TJEventOptimizer .cxx_destruct]
9 MyApp 0x002eeedb -[TJEventOptimizer .cxx_destruct]
10 Foundation 0x295adb5b __NSThread__main__ + 1118
11 libsystem_pthread.dylib 0x3670ce93 _pthread_body + 138
12 libsystem_pthread.dylib 0x3670ce07 _pthread_start + 118
13 libsystem_pthread.dylib 0x3670ab90 thread_start + 8
Despite the fact, TapJoy is captured in the stack trace, their FAQ says it is ocaisonally wrong and has nothing to do with TapJoy's code, but rather iOS 8 bug.
Is it correct?
What accessibility setting related to the crash?
This problem appears because TapJoy has used categories in static library (that's UIPasteboard_QSExtras)
The solution is super simple, you need to notify linker about that
1) Click on the project
2) Click on the target
3) Open Build Settings tab
4) Search for Other Linker Flags
5) Double click on Other Linker Flags
6) Add -ObjC and -all_load flags
7)
Remove binary (delete from device/simulator),
Clean project (hitting cmd+shift+k) and
build again (hitting cmd+b).
You're ready to go!
the solution suggested by I0gg3r unfortunately does not work.. I tested this on 3 apps, and still find the UIPasteboard crash as most frequent crash.. Any other suggestions? Is there a way to disable the accessibility settings in the app?
Update: Tapjoy has released an update (10.2.1) which solves this issue. Please download their latest SDK

Firebase initWitURL crashes [FRepo initTransactions]: unrecognized selector

I have set up two similar firebase applications.
In both cases I call
self.firebase = [[Firebase alloc] initWithUrl:kFirebaseRoot];
in one case everything works fine.
In the other case I get a crash
2014-05-19 11:18:59.726 MyApp[28041:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FRepo initTransactions]: unrecognized selector sent to instance 0x8f50c10'
First throw call stack:*
0 CoreFoundation 0x023131e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x020928e5 objc_exception_throw + 44
2 CoreFoundation 0x023b0243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0230350b ___forwarding___ + 1019
4 CoreFoundation 0x023030ee _CF_forwarding_prep_0 + 14
5 MyApp 0x0002b63b -[FRepo initWithRepoInfo:] + 187
6 MyApp 0x0002ab05 -[FRepoManager getLocalRepo:] + 597
7 MyApp 0x0002b3ff +[FRepoManager getRepo:] + 111
8 MyApp 0x000544dc -[Firebase initWithUrl:] + 204
9 MyApp 0x000172f2 -[FLPresenceManager initFirebase] + 194
This appears to be something going on within Firebase, so I presume there must be something different in the way I have set up the app in the two cases. However, I cannot see a difference.
Can anyone offer any clues?
This answer was posted in the comments of the question.
The problem seems to be having -objC instead of -ObjC in the linker flags.
Just for completion sake for the next person, this is exactly where it can be found:

How is this error possible: Unrecognized Selected (screenFontWithRenderingMode) in iOS?

This one doesn't make any sense to me. My app crashes with the following error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType screenFontWithRenderingMode:]: unrecognized selector sent to instance 0x209bb200'
This is an iOS app. From what I can see, screenFontWithRenderingMode is an NSFont method for Mac OS X, not iOS. So how can this error even be occurring?
I am building the app with the newly released Xcode 5. The app will support iOS version 6.1 and 7.0 (and higher). This error ONLY occurs when running the app on a 6.1 device (and simulator).
EDIT:
I wasn't able to produce the crash log by running the app in debug mode. By creating an Ad Hoc build I was able to load the app, run it, crash, and retrieve the crash log:
0 CoreFoundation 0x3220a29e __exceptionPreprocess + 158
1 libobjc.A.dylib 0x3a06e97a objc_exception_throw + 26
2 CoreFoundation 0x3220de02 -[NSObject(NSObject) doesNotRecognizeSelector:] + 166
3 CoreFoundation 0x3220c52c ___forwarding___ + 388
4 CoreFoundation 0x32163f64 __forwarding_prep_0___ + 20
5 UIFoundation 0x37da15c8 +[NSStringDrawingTextStorage _fastDrawString:attributes:length:inRect:graphicsContext:baselineRendering:usesFontLeading:usesScreenFont:typesetterBehavior:paragraphStyle:lineBreakMode:boundingRect:padding:scrollable:baselineOffset:] + 344
6 UIFoundation 0x37da0184 -[NSAttributedString(NSExtendedStringDrawing) _doBoundingRectWithSize:options:context:baselineOffset:] + 676
7 UIFoundation 0x37d9fc8c -[NSAttributedString(NSExtendedStringDrawing) boundingRectWithSize:options:context:] + 2492
I was able to track down the offending line:
CGRect rect = [[MLFeedCell attributedBodyForItem:item].attributedString boundingRectWithSize:CGSizeMake(labelWidth, 10000) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil];
I'm not sure what's wrong with this call.
The error is because you are trying to use:
[NSString boundingRectWithSize:options:attributes:context:]
That method was added in IOS 7.0 in the NSStringDrawing.h category.
source:
IOS7 API Diffs

Resources