Firebase initWitURL crashes [FRepo initTransactions]: unrecognized selector - ios

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:

Related

Plugin should use a background thread ( Terminating app due to uncaught exception 'NSInvalidArgumentException' )

i am trying to use cordova keychain [plugin][1] for ios, inside my ionic application. but facing this error
6:48 PM2020-07-14 18:44:32.456726+0500 Farsh[1817:53270] THREAD
WARNING: ['Keychain'] took '14.635986' ms. Plugin should use a
background thread. 2020-07-14 18:44:32.456767+0500 Farsh[1817:55957]
-[NSNull boolValue]: unrecognized selector sent to instance 0x7fff8062d9d0 2020-07-14 18:44:32.614153+0500 Farsh[1817:55957] ***
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[NSNull boolValue]:
unrecognized selector sent to instance 0x7fff8062d9d0'
*** First throw call stack: ( 0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48 2 CoreFoundation 0x00007fff23e5dc34
-[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 CoreFoundation 0x00007fff23e4190c forwarding + 1436 4 CoreFoundation
0x00007fff23e43bf8 _CF_forwarding_prep_0 + 120 5 Farsh
0x000000010e66aac0 __19-[CDVKeychain set:]_block_invoke + 432 6
libdispatch.dylib 0x000000010e9c7f11 _dispatch_call_block_and_release
12 7 libdispatch.dylib 0x000000010e9c8e8e _dispatch_client_callout + 8 8 libdispatch.dylib 0x000000010e9cb2d8
_dispatch_queue_override_invoke + 1022 9 libdispatch.dylib 0x000000010e9da399 _dispatch_root_queue_drain + 351 10
libdispatch.dylib 0x000000010e9daca6 _dispatch_worker_thread2 + 135 11
libsystem_pthread.dylib 0x00007fff51c089f7 _pthread_wqthread + 220 12
libsystem_pthread.dylib 0x00007fff51c07b77 start_wqthread + 15 )
libc++abi.dylib: terminating with uncaught exception of type
NSException (lldb)
and my application crashed after this. Is there anyone know how to solve this problem ??
Please answer
Thanks in advance.
[1]: https://ionicframework.com/docs/native/keychain
Solution
I had the same problem and the issue was that I didn't explicitly set a value for the useTouchId parameter. This bug is known since 2018 and still not fixed. Shows you how good ionic is as an ecosystem and how much the people care 😤 Worse is that even the official docs(!) have an incorrect example:
Wrong
this.keychain.set(key, value).then(() => { ... }
Correct
this.keychain.set(key, value, false).then(() => { ... }
Adding the third parameter should fix your issues.

FACEBOOK LOGIN: Terminating app due to uncaught exception 'NSInvalidArgumentException'

I've followed the iOS sdk guide on facebook. But when I click on the login with facebook icon, and im getting the page up. But when I click "Continue" on facebook the app closes and I get kicked out from it.
019-03-18 22:39:46.552355+0100 APPNAME[75124:2466803]
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:' -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]'
First throw call stack:
(
0 CoreFoundation 0x0000000111c2b1bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010fdf5735 objc_exception_throw + 48
2 CoreFoundation 0x0000000111b774ec _CFThrowFormattedException + 194
3 CoreFoundation 0x0000000111c9a541 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 321
4 CoreFoundation 0x0000000111c26c9b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
5 APPNAME 0x000000010e481d90 -[ViewController Callfb_LoginService:] + 576
6 APPNAME 0x000000010e480a3f __33-[ViewController GetFBUserDetail]_block_invoke + 1999
7 APPNAME 0x000000010e6d2d20 -[FBSDKGraphRequestMetadata invokeCompletionHandlerForConnection:withResults:error:] + 146
8 APPNAME 0x000000010e6d9532 __82-[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:]_block_invoke396 + 141
9 APPNAME 0x000000010e6d92d6 -[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:] + 1065
This is just a part of the error log.
Would appreciate it if anyone could help me out here!
Thanks

Exact line for exception in Xcode

I am new to Xcode and Objective-C. Unlike Android Java exceptions, I didn't find any exact line number where the exception occurred, though function name can be known from the crash log. Following is the crash log:
2014-07-28 17:44:53.814 ExampleApp[82720:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x034b25e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x028bc8b6 objc_exception_throw + 44
2 CoreFoundation 0x03464bcc -[__NSArrayM insertObject:atIndex:] + 844
3 CoreFoundation 0x03464870 -[__NSArrayM addObject:] + 64
4 ExampleApp 0x0017f99e +[ReportGenerator prepareReportList:] + 5486
5 ExampleApp 0x0017db99 +[ReportGenerator generateReportContent:viewController:] + 73
6 ExampleApp 0x0017b682 +[ReportGenerator generateReport:viewController:style:] + 322
7 ExampleApp 0x000a68fd -[ReportsViewController showReport] + 189
8 libobjc.A.dylib 0x028ce81f -[NSObject performSelector:withObject:] + 70
9 Foundation 0x01fa29d8 __NSThreadPerformPerform + 285
10 CoreFoundation 0x0343b83f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
11 CoreFoundation 0x0343b1cb __CFRunLoopDoSources0 + 235
12 CoreFoundation 0x0345829e __CFRunLoopRun + 910
13 CoreFoundation 0x03457ac3 CFRunLoopRunSpecific + 467
14 CoreFoundation 0x034578db CFRunLoopRunInMode + 123
15 GraphicsServices 0x046949e2 GSEventRunModal + 192
16 GraphicsServices 0x04694809 GSEventRun + 104
17 UIKit 0x010bbd3b UIApplicationMain + 1225
18 ExampleApp 0x0011679d main + 125
19 libdyld.dylib 0x0300a701 start + 1)libc++abi.dylib: terminating with uncaught exception of type NSException
You can add a breakpoint to stop on all exceptions.
From Apple Docs
In the bottom-left corner of the breakpoints navigator, click the Add button.
Choose Add Exception Breakpoint.
In the Exception pop-up menu, choose the type of exception on which you want execution to stop:
All. Stops on all exceptions.
Objective-C. Stops on Objective-C exceptions.
C++. Stops on C++ exceptions.
To stop on a particular C++ exception, specify the exception name.
Choose the phase of the exception handling process at which you want program execution to stop.
Click Done.
The crash is happening in your +[ReportGenerator prepareReportList:] method. Specifically, when attempting to add an object to an array.
Only, the object is nil. Which is why the log starts with object cannot be nil.
(Note: As you come from the world of Java exceptions, don't make the mistake of thinking that ObjC exceptions are designed to be caught and recovered from. They aren't.)

Core data exception: initWithCoder:]: unrecognized selector sent

I'm experiencing this issue using Core Data.
CoreData: error: exception during fetchRowForObjectID: -[PharmaceuticalComp initWithCoder:]: unrecognized selector sent to instance 0x9ab1920 with userInfo of (null)
2014-08-18 07:56:55.784 HorizonMemory[1357:60b] CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. -[PharmaceuticalComp initWithCoder:]: unrecognized selector sent to instance 0x9ab1920 with userInfo (null)
2014-08-18 07:56:55.786 HorizonMemory[1357:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PharmaceuticalComp initWithCoder:]: unrecognized selector sent to instance 0x9ab1920'
*** First throw call stack:
(
0 CoreFoundation 0x021981e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01f178e5 objc_exception_throw + 44
2 CoreFoundation 0x02235243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0218850b ___forwarding___ + 1019
4 CoreFoundation 0x021880ee _CF_forwarding_prep_0 + 14
5 Foundation 0x01b2a01a _decodeObjectBinary + 3498
6 Foundation 0x01b2b4d7 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 2204
7 Foundation 0x01b2b746 -[NSArray(NSArray) initWithCoder:] + 255
8 Foundation 0x01b2a01a _decodeObjectBinary + 3498
9 Foundation 0x01b2b4d7 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 2204
10 Foundation 0x01b37ff1 -[NSDictionary(NSDictionary) initWithCoder:] + 261
11 Foundation 0x01b2a01a _decodeObjectBinary + 3498
12 Foundation 0x01b29106 _decodeObject + 340
13 Foundation 0x01b28faa -[NSKeyedUnarchiver decodeObjectForKey:] + 181
14 Foundation 0x01b9aa86 +[NSKeyedUnarchiver unarchiveObjectWithData:] + 106
15 Foundation 0x01b197d5 -[_NSKeyedUnarchiveFromDataTransformer transformedValue:] + 47
16 CoreData 0x024205b9 _prepareResultsFromResultSet + 4105
17 CoreData 0x0241de33 newFetchedRowsForFetchPlan_MT + 1
PharmaComp is an NSManaged subclass linked to another entity User by a transient property -linkedPharma. User has this property in readonly mode. Every time I call linkedPharma it starts a fetch request that provides me the PharmaComp instance. When I try to delete User, i get this exception. the strange fact is that linkedPharma is a property not listed in the Model, thus PharmaComp shouldn't be involved in any sort of operation.The other fact is that it seems to try to use NSKeyedUnarchivier on it, but I don't understand why.
No object is hearing for NSManagedObjectContextObjectsDidChangeNotification.
I have no idea about where it came from.
The solution was pretty simple.
User had also another relationship with a transformable container (NSArray) which was holding (for a bug) a PharmaComp instance.

_NSInlineData base64EncodedString - unrecognized selector sent to instance

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.

Resources