I want to make a new object from string access_token.
I've made a Token:NSObject (.h + .m) and I'm trying to setAccessToken and show it in the NSLog. This is the code in my LoginViewController.m:
NSString *token = responseObject[#"access_token"];
Token *t = [[Token alloc]init];
[t setAccessToken:token];
NSLog(t);
And this is the error i get:
Create[29485:770358] -[Token _fastCStringContents:]: unrecognized
selector sent to instance 0x7f8e815d0780
Create[29485:770358] * Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[Token _fastCStringContents:]:
unrecognized selector sent to instance 0x7f8e815d0780'
* First throw call stack: ( 0 CoreFoundation 0x000000010149ff45 exceptionPreprocess + 165 1 libobjc.A.dylib
0x0000000100f19deb objc_exception_throw + 48 2 CoreFoundation
0x00000001014a856d -[NSObject(NSObject) doesNotRecognizeSelector:] +
205 3 CoreFoundation 0x00000001013f5eea
___forwarding_ + 970 4 CoreFoundation 0x00000001013f5a98 _CF_forwarding_prep_0 + 120 5
libsystem_trace.dylib 0x00000001036e8327
os_log_shim_with_CFString + 120 6 CoreFoundation
0x000000010148ef24 _CFLogvEx3 + 132 7 Foundation
0x0000000100b9489e _NSLogv + 117 8 Foundation
0x0000000100ae40f2 NSLog + 152 9 Create
0x00000001004d665b 21-[LoginVC UserLogin:]_block_invoke + 203 10
Create 0x00000001004d7f18
__64-[AFHTTPRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke49 + 40 11
libdispatch.dylib 0x00000001033fde5d
_dispatch_call_block_and_release + 12 12 libdispatch.dylib 0x000000010341e49b _dispatch_client_callout + 8 13 libdispatch.dylib
0x00000001034062af _dispatch_main_queue_callback_4CF + 1738 14
CoreFoundation 0x00000001014002e9
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 15 CoreFoundation 0x00000001013c18a9 __CFRunLoopRun
+ 2073 16 CoreFoundation 0x00000001013c0e08 CFRunLoopRunSpecific + 488 17 GraphicsServices
0x00000001056dcad2 GSEventRunModal + 161 18 UIKit
0x000000010184c30d UIApplicationMain + 171 19 Create
0x00000001004d6a2f main + 111 20 libdyld.dylib
0x000000010345292d start + 1 21 ???
0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with
uncaught exception of type NSException
Hope somebody can help me out!
NSLog(...) function assumes the first argument is an instance of NSString. If you want to use a different object, either use:
NSLog([t description]) or a format string NSLog(#"%#", t).
Related
Seeing a strange crash while listening
NotificationCenter.default.addObserver(self, selector: #selector(contextDidSave(_:)), name: .NSManagedObjectContextDidSave, object: nil)
#objc private func contextDidSave(_ notification: Notification) {
print(notification)
}
However, keeping below line and calling something else inside it not causing any issues.
Below code will work fine as we are not printing or consuming objects
if let updatedObjects = notification.userInfo?[NSUpdatedObjectsKey] as? Set<User>, !updatedObjects.isEmpty {
myMethod()
}
Already debugged by using NSZombiesEnabled, InstrumentsWithCoreData, Exception Breakpoints,ThreadSanatizer, "Arguments Passed on Launch" in -com.apple.CoreData.ConcurrencyDebug 1
Unable to get why it's happening. However i thought it's of property so I printed all property 1 by 1 it worked fine for me.
As per as my knowledge it's happening because of combination of Swift and Obj-C
It's a huge project so I am not sure what can be done?
Is there a way that I can get more info about object via it's reference mat be object name or another information, Somehow?
** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean objectID]: unrecognized selector sent to instance 0x7fff80634470'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3de6e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff512539b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e5eb94 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23e4286c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23e44b58 _CF_forwarding_prep_0 + 120
5 CoreData 0x00007fff23a816c9 -[NSManagedObject _descriptionValues] + 1566
6 CoreData 0x00007fff23a819f1 -[NSManagedObject description] + 261
7 CoreFoundation 0x00007fff23e60600 -[NSSet descriptionWithLocale:indent:] + 416
8 CoreFoundation 0x00007fff23e37858 -[NSDictionary descriptionWithLocale:indent:] + 1416
9 Foundation 0x00007fff259698c9 _NSDescriptionWithLocaleFunc + 55
10 CoreFoundation 0x00007fff23dc7281 __CFStringAppendFormatCore + 12737
11 CoreFoundation 0x00007fff23dc8ea5 _CFStringCreateWithFormatAndArgumentsAux2 + 133
12 CoreData 0x00007fff23a324a4 _NSCoreDataLog + 248
13 CoreData 0x00007fff239f7e80 -[NSManagedObjectContext(_NSInternalAdditions) _didSaveChanges] + 2893
14 CoreData 0x00007fff239ee7d6 -[NSManagedObjectContext save:] + 4166
15 *********** 0x00000001076e8db3 __31-[MyStorageManager saveContext]_block_invoke + 83
16 CoreData 0x00007fff23a0338d developerSubmittedBlockToNSManagedObjectContextPerform + 154
17 libdispatch.dylib 0x000000010f252e8e _dispatch_client_callout + 8
18 libdispatch.dylib 0x000000010f260d97 _dispatch_main_queue_callback_4CF + 1149
19 CoreFoundation 0x00007fff23da1869 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
20 CoreFoundation 0x00007fff23d9c3b9 __CFRunLoopRun + 2041
21 CoreFoundation 0x00007fff23d9b8a4 CFRunLoopRunSpecific + 404
22 GraphicsServices 0x00007fff38c39bbe GSEventRunModal + 139
23 UIKitCore 0x00007fff49325968 UIApplicationMain + 1605
24 *********** 0x00000001074dc882 main + 146
25 libdyld.dylib 0x00007fff520ce1fd start + 1
26 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
this is my first time implementing Braintree and I've been following the documentation clearly. I've integrated it with CocoaPods but I have an issue in BTDropInViewController. It throws an error
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIColor bt_colorWithBytesR:G:B:]: unrecognized selector sent to class 0x10fd17948
In this line
BTDropInViewController *dropInViewController = [[BTDropInViewController alloc]
initWithAPIClient:self.braintreeClient];
I've tried to import these 3 headers just to be sure, but still the same result
#import <Braintree/UIColor+BTUI.h>
#import "BraintreeUI.h"
#import <Braintree/BTUI.h>
And here is the full error
2016-11-16 15:56:35.418 Projc[43766:2236752] +[UIColor bt_colorWithBytesR:G:B:]: unrecognized selector sent to class 0x10fd17948
2016-11-16 15:56:35.504 Projc[43766:2236752] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIColor bt_colorWithBytesR:G:B:]: unrecognized selector sent to class 0x10fd17948'
*** First throw call stack:
(
0 CoreFoundation 0x00000001116aaf45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000110998deb objc_exception_throw + 48
2 CoreFoundation 0x00000001116b346d +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000111600eea ___forwarding___ + 970
4 CoreFoundation 0x0000000111600a98 _CF_forwarding_prep_0 + 120
5 Projc 0x000000010ccb95b0 -[BTUI borderColor] + 64
6 Projc 0x000000010cc9abf4 -[BTDropInContentView initWithFrame:] + 964
7 UIKit 0x000000010f0abe3d -[UIView init] + 62
8 Projc 0x000000010ccc329e -[BTUIThemedView init] + 62
9 Projc 0x000000010cca5fed -[BTDropInViewController initWithAPIClient:] + 285
10 Projc 0x000000010cb0998b __51-[RegisterController basicPlanClicked]_block_invoke + 411
11 Projc 0x000000010cac1a66 __59-[downloadJson:endPointString:WithHandler:]_block_invoke + 214
12 CFNetwork 0x000000010d4f5b3d __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 19
13 CFNetwork 0x000000010d507fb6 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 302
14 Foundation 0x000000011060c3b8 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
15 Foundation 0x00000001105480e5 -[NSBlockOperation main] + 101
16 Foundation 0x000000011052b036 -[__NSOperationInternal _start:] + 646
17 Foundation 0x000000011052ac47 __NSOQSchedule_f + 194
18 libdispatch.dylib 0x0000000111e0649b _dispatch_client_callout + 8
19 libdispatch.dylib 0x0000000111dee2af _dispatch_main_queue_callback_4CF + 1738
20 CoreFoundation 0x000000011160b2e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
21 CoreFoundation 0x00000001115cc8a9 __CFRunLoopRun + 2073
22 CoreFoundation 0x00000001115cbe08 CFRunLoopRunSpecific + 488
23 GraphicsServices 0x0000000112291ad2 GSEventRunModal + 161
24 UIKit 0x000000010f01f30d UIApplicationMain + 171
25 Projc 0x000000010cba86bf main + 111
26 libdyld.dylib 0x0000000111e3b92d start + 1
27 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I am trying to work with Core Data and iCloud.
It worked once and it did not again.
I got this error below :
2015-05-19 12:11:13.695 Student Notebook App[34617:992535] -[Student_Notebook_App.NotebookTableView persistentStoreWillChange]: unrecognized selector sent to instance 0x7f86495514b0
2015-05-19 12:11:13.737 Student Notebook App[34617:992535] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Student_Notebook_App.NotebookTableView persistentStoreWillChange]: unrecognized selector sent to instance 0x7f86495514b0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000110638c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010ff15bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001106400ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000011059613c ___forwarding___ + 988
4 CoreFoundation 0x0000000110595cd8 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x000000011060854c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
6 CoreFoundation 0x0000000110506a04 _CFXNotificationPost + 2484
7 Foundation 0x000000010fa6c968 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
8 CoreData 0x0000000110303d5b __81-[PFUbiquitySetupAssistant tryToReplaceLocalStore:withStoreSideLoadedByImporter:]_block_invoke + 283
9 libdispatch.dylib 0x00000001131f5614 _dispatch_client_callout + 8
10 libdispatch.dylib 0x00000001131e02fa _dispatch_barrier_sync_f_slow_invoke + 275
11 libdispatch.dylib 0x00000001131f5614 _dispatch_client_callout + 8
12 libdispatch.dylib 0x00000001131dda1c _dispatch_main_queue_callback_4CF + 1664
13 CoreFoundation 0x00000001105a01f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
14 CoreFoundation 0x0000000110561dcb __CFRunLoopRun + 2043
15 CoreFoundation 0x0000000110561366 CFRunLoopRunSpecific + 470
16 GraphicsServices 0x0000000114e91a3e GSEventRunModal + 161
17 UIKit 0x0000000110c73900 UIApplicationMain + 1282
18 Student Notebook App 0x000000010f923aa7 main + 135
19 libdyld.dylib 0x0000000113229145 start + 1
20 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Please, anyone can help me??
Thanks in Advance
The error is pretty clear:
-[Student_Notebook_App.NotebookTableView persistentStoreWillChange]: unrecognized selector sent to instance 0x7f86495514b0
This says that your code is trying to call a method named persistentStoreWillChange on a class that doesn't have that method.
The stack trace indicates that this happened when a notification was posted. It doesn't say which one. What happened is:
You registered to observe a notification with a method named persistentStoreWillChange.
Later that notification was posted. The notification system tried to call persistentStoreWillChange, but the method did not exist.
When you register for a notification, the callback method name that you provide must exist.
I am really confused as to why this is happening.
Since this happened randomly
Here is the stacktrace, I have not been able to figure it out.
Please help
Thanks
2015-03-30 15:12:50.817 MarcoApp[1857:23629] -[NSIBPrototypingLayoutConstraint finishedLoading]: unrecognized selector sent to instance 0x7f929ccc8cf0
2015-03-30 15:12:50.908 MarcoApp[1857:23629] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSIBPrototypingLayoutConstraint finishedLoading]: unrecognized selector sent to instance 0x7f929ccc8cf0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010aa74a75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010a333bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010aa7bd1d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010a9d39dc ___forwarding___ + 988
4 CoreFoundation 0x000000010a9d3578 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x000000010aa447fc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
6 CoreFoundation 0x000000010a944204 _CFXNotificationPost + 2484
7 Foundation 0x0000000109e8ddf8 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
8 UIKit 0x000000010b73baa7 -[UIApplication _handleApplicationDectivationWithScene:shouldForceExit:transitionContext:completion:] + 1054
9 UIKit 0x000000010b748833 __88-[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke + 87
10 UIKit 0x000000010b7487cd -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 349
11 UIKit 0x000000010b73345a -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 486
12 FrontBoardServices 0x00000001115ae243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
13 CoreFoundation 0x000000010a9a9c7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
14 CoreFoundation 0x000000010a99f9c5 __CFRunLoopDoBlocks + 341
15 CoreFoundation 0x000000010a99f785 __CFRunLoopRun + 2389
16 CoreFoundation 0x000000010a99ebc6 CFRunLoopRunSpecific + 470
17 GraphicsServices 0x000000010e89ca58 GSEventRunModal + 161
18 UIKit 0x000000010b735580 UIApplicationMain + 1282
19 MarcoApp 0x0000000109184afe top_level_code + 78
20 MarcoApp 0x0000000109184bda main + 42
21 libdyld.dylib 0x000000010ee2b145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
hard to tell without seeing your code but "unrecognized selector sent to instance" implies you have a method the requires a selector (name of a function) as a parameter and that methods got an invalid selector (the name of the function is wrong).
not sure but ther is any method in
- (void)applicationWillResignActive:(UIApplication *)application
which does not have selector thats why you app crash
I am trying to debug this crash. It seems to be inside Apple's framework in description method but I don't know what it's causing it.
I'm using Restkit and Core Data. I get the crash as soon as the API returns a new model "Category" with array "products" empty.
Thank you
RRCategory + RRProduct models
https://gist.github.com/imton/6f7ff91bc3f3ac25a490
Mappings
https://gist.github.com/imton/33236e0ddefef0d50a35
https://gist.github.com/imton/9baa6a35a4a8f71aa440
Api Json https://gist.github.com/imton/118736e59c1a1092dc1b
{
"categories": [
{
"token": "6G1RKVMcfNdcbAX",
"title": "Cat3",
"picture_token": "ASDFASDF",
"products": []
}
]
}
Backstack
2014-12-07 10:55:30.838 Riderr[91164:34420246] -[__NSCFBoolean length]: unrecognized selector sent to instance 0x10375c970
2014-12-07 10:55:30.862 Riderr[91164:34420246] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean length]: unrecognized selector sent to instance 0x10375c970'
*** First throw call stack:
(
0 CoreFoundation 0x00000001034b1b75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010314abb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001034b8c8d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001034106fc ___forwarding___ + 988
4 CoreFoundation 0x0000000103410298 _CF_forwarding_prep_0 + 120
5 CoreData 0x0000000100d3135c -[NSManagedObject _descriptionValues] + 620
6 CoreData 0x0000000100d3195b -[NSManagedObject description] + 267
7 Riderr 0x000000010037393b -[NSManagedObject(FixCrashBug) description_swizzle] + 43
8 CoreFoundation 0x00000001034a3ea6 -[NSArray descriptionWithLocale:indent:] + 358
9 Foundation 0x00000001014f3524 _NSDescriptionWithLocaleFunc + 64
10 CoreFoundation 0x00000001033ac97d __CFStringAppendFormatCore + 9645
11 CoreFoundation 0x00000001034922f0 _CFStringCreateWithFormatAndArgumentsAux2 + 256
12 Foundation 0x00000001014f34b8 -[NSPlaceholderString initWithFormat:locale:arguments:] + 153
13 Riderr 0x00000001003ad29c +[DDLog log:level:flag:context:file:function:line:tag:format:] + 588
14 Riderr 0x0000000100373b6d __21-[RRHomeTableVC sync]_block_invoke + 205
15 Riderr 0x00000001003770be __72-[RRRiderrClient getAllCategoriesWithProductsSuccessBlock:failureBlock:]_block_invoke + 142
16 Riderr 0x000000010051b92b __66-[RKObjectRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke244 + 91
17 libdispatch.dylib 0x00000001041b4b06 _dispatch_call_block_and_release + 12
18 libdispatch.dylib 0x00000001041d2794 _dispatch_client_callout + 8
19 libdispatch.dylib 0x00000001041bb89b _dispatch_main_queue_callback_4CF + 949
20 CoreFoundation 0x0000000103419469 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
21 CoreFoundation 0x00000001033dc36b __CFRunLoopRun + 2043
22 CoreFoundation 0x00000001033db906 CFRunLoopRunSpecific + 470
23 GraphicsServices 0x00000001076de9f0 GSEventRunModal + 161
24 UIKit 0x0000000101e901a0 UIApplicationMain + 1282
25 Riderr 0x0000000100370fbc main + 140
26 libdyld.dylib 0x0000000104207145 start + 1
27 ??? 0x0000000000000001 0x0 + 1
)
It means that you give an NSNumber-wrapped Boolean to CoreData when it expects a string.
Then apparently you use method swizzling which is a pretty bad idea and may lead to such crashes.