I think it is from userDefaults, but not sure why?
-[__NSCFData _getCString:maxLength:encoding:]: unrecognized selector sent to instance 0x61100002ffc0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFData _getCString:maxLength:encoding:]: unrecognized selector sent to instance 0x61100002ffc0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000103a69d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000102fc721e objc_exception_throw + 48
2 CoreFoundation 0x0000000103ad9f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00000001039ef005 ___forwarding___ + 1013
4 CoreFoundation 0x00000001039eeb88 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x00000001039a389b CFStringGetCString + 171
6 CoreFoundation 0x00000001039b377d CFLocaleCreateCanonicalLocaleIdentifierFromString + 77
7 CoreFoundation 0x00000001039b3327 _CFLocaleCopyCurrentGuts + 487
8 CoreFoundation 0x00000001039b3109 +[NSLocale currentLocale] + 9
9 Foundation 0x0000000102a8a376 -[NSUserDefaults(NSUserDefaults) init] + 1637
10 Foundation 0x0000000102a89cb5 +[NSUserDefaults(NSUserDefaults) standardUserDefaults] + 81
11 UIKit 0x00000001048098df ___UIApplicationMainPreparations_block_invoke_2 + 53
12 libclang_rt.asan_iossim_dynamic.dylib 0x0000000101d582b4 __wrap_dispatch_async_block_invoke + 260
13 libdispatch.dylib 0x00000001078e8978 _dispatch_call_block_and_release + 12
14 libdispatch.dylib 0x00000001079120cd _dispatch_client_callout + 8
15 libdispatch.dylib 0x00000001078f365f _dispatch_root_queue_drain + 1450
16 libdispatch.dylib 0x00000001078f3059 _dispatch_worker_thread3 + 123
17 libsystem_pthread.dylib 0x0000000107cbb4de _pthread_wqthread + 1129
18 libsystem_pthread.dylib 0x0000000107cb9341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
// Storing my keys as
struct user {
static let shared = user()
let username:String = "user_username"
let password:String = "user_password"
let mobile:String = "user_mobile"
let email:String = "user_email"
let fname:String = "user_fname"
let lname:String = "user_lname"
let lastSync:String = "user_sync"
let id:String = "user_employeeId"
let empRole:String = "user_role"
let empManager:String = "user_manager"
let empFinance:String = "user_finance"
}
Thanks in Advance
Related
Here is the log in Xcode
2017-09-05 11:12:06.477 AppDemo[5064:29077] -[NSTaggedPointerString unsignedIntValue]: unrecognized selector sent to instance 0xa303036383231327
2017-09-05 11:12:06.642 AppDemo[5064:29077] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString unsignedIntValue]: unrecognized selector sent to instance 0xa303036383231327'
*** First throw call stack:
(
0 CoreFoundation 0x0000000110564b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010f41a141 objc_exception_throw + 48
2 CoreFoundation 0x00000001105d4134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00000001104eb840 ___forwarding___ + 1024
4 CoreFoundation 0x00000001104eb3b8 _CF_forwarding_prep_0 + 120
5 AppDemo 0x000000010e7cfc94 -[RCTMultipartStreamReader emitProgress:contentLength:final:callback:] + 244
6 AppDemo 0x000000010e7d048a -[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:] + 1610
7 AppDemo 0x000000010e81fdbc -[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:] + 444
8 CFNetwork 0x000000010ffc4c51 __88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke + 51
9 Foundation 0x000000010ef243b7 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
10 Foundation 0x000000010ef240bb -[NSBlockOperation main] + 101
11 Foundation 0x000000010ef22877 -[__NSOperationInternal _start:] + 627
12 Foundation 0x000000010ef1e5fc __NSOQSchedule_f + 198
13 libdispatch.dylib 0x000000011424605c _dispatch_client_callout + 8
14 libdispatch.dylib 0x000000011422494f _dispatch_queue_serial_drain + 221
15 libdispatch.dylib 0x0000000114225669 _dispatch_queue_invoke + 1084
16 libdispatch.dylib 0x0000000114227ec4 _dispatch_root_queue_drain + 634
17 libdispatch.dylib 0x0000000114227bef _dispatch_worker_thread3 + 123
18 libsystem_pthread.dylib 0x00000001145dd712 _pthread_wqthread + 1299
19 libsystem_pthread.dylib 0x00000001145dd1ed start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
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).
2015-08-17 06:18:50.281 testcrash WatchKit Extension[1050:29694] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<InterfaceController 0x7d248f80> valueForUndefinedKey:]: this class is not key value coding-compliant for the key (null).'
*** First throw call stack:
(
0 CoreFoundation 0x02f882c4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00682df4 objc_exception_throw + 50
2 CoreFoundation 0x02f87ee1 -[NSException raise] + 17
3 Foundation 0x002c4696 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 282
4 Foundation 0x00205870 _NSGetUsingKeyValueGetter + 105
5 Foundation 0x002057ff -[NSObject(NSKeyValueCoding) valueForKey:] + 288
6 WatchKit 0x0014d454 __48-[SPRemoteInterface handlePlist:fromIdentifier:]_block_invoke905 + 46
7 libdispatch.dylib 0x03db8837 _dispatch_call_block_and_release + 15
8 libdispatch.dylib 0x03dd641d _dispatch_client_callout + 14
9 libdispatch.dylib 0x03dbf0da _dispatch_main_queue_callback_4CF + 689
10 CoreFoundation 0x02eda46e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
11 CoreFoundation 0x02e981e4 __CFRunLoopRun + 2356
12 CoreFoundation 0x02e975f6 CFRunLoopRunSpecific + 470
13 CoreFoundation 0x02e9740b CFRunLoopRunInMode + 123
14 Foundation 0x00241e11 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 308
15 Foundation 0x002e7f6d -[NSRunLoop(NSRunLoop) run] + 82
16 libxpc.dylib 0x040d30c7 _xpc_objc_main + 486
17 libxpc.dylib 0x040d5e26 xpc_main + 215
18 Foundation 0x00410fb5 service_connection_handler + 0
19 PlugInKit 0x02e001f4 -[PKService run] + 582
20 WatchKit 0x00171509 main + 146
21 libdyld.dylib 0x03dfbae1 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I get this crash with a clean, new project. Drag an WKPicker into the storyboard and try to simulate the program.
(native watchos2 app)
The problem here seems to be the picker stays empty.
var foodList: [(String, String)] = [
("Broccoli", "Gross"),
("Brussel Sprouts", "Gross"),
("Soup", "Delicious"),
("Steak", "Delicious"),
("Ramen", "Delicious"),
("Pizza", "Delicious") ]
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
let pickerItems: [WKPickerItem] = foodList.map {
let pickerItem = WKPickerItem()
pickerItem.title = $0.0
pickerItem.caption = $0.1
return pickerItem
}
serverPicker.setItems(pickerItems)
}
Resolves that problem.
Copied from: http://www.sneakycrab.com/blog/2015/6/12/wkinterfacepicker-in-watchkit-20-using-the-digital-crown
I realize this question has been asked many times, but it seems to be caused by many different things and is very situational.
My trace:
2015-02-27 16:20:06.289 RTApp[43486:1122681] -[RTApp.conversationVC keyboardWasShown]: unrecognized selector sent to instance 0x7f866a766830
2015-02-27 16:20:06.291 RTApp[43486:1122681] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RTApp.conversationVC keyboardWasShown]: unrecognized selector sent to instance 0x7f866a766830'
*** First throw call stack:
(
0 CoreFoundation 0x00000001071b8f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000106e51bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001071c004d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010711827c ___forwarding___ + 988
4 CoreFoundation 0x0000000107117e18 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x0000000107188cec __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
6 CoreFoundation 0x00000001070888a4 _CFXNotificationPost + 2484
7 Foundation 0x00000001069af6b8 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
8 UIKit 0x0000000107c75eb8 -[UIInputWindowController postEndNotifications:withInfo:] + 527
9 UIKit 0x0000000107c77725 __77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke572 + 354
10 UIKit 0x0000000107617113 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 326
11 UIKit 0x00000001075fee6a -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 209
12 UIKit 0x00000001075ff1a0 -[UIViewAnimationState animationDidStop:finished:] + 76
13 QuartzCore 0x0000000105c4c7ee _ZN2CA5Layer23run_animation_callbacksEPv + 308
14 libdispatch.dylib 0x0000000108de57f4 _dispatch_client_callout + 8
15 libdispatch.dylib 0x0000000108dce8fb _dispatch_main_queue_callback_4CF + 949
16 CoreFoundation 0x0000000107120fe9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
17 CoreFoundation 0x00000001070e3eeb __CFRunLoopRun + 2043
18 CoreFoundation 0x00000001070e3486 CFRunLoopRunSpecific + 470
19 GraphicsServices 0x000000010aa0f9f0 GSEventRunModal + 161
20 UIKit 0x00000001075a5420 UIApplicationMain + 1282
21 RTApp 0x000000010563623e top_level_code + 78
22 RTApp 0x000000010563627a main + 42
23 libdyld.dylib 0x0000000108e1a145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
And the function in question:
func keyboardWasShown(notification: NSNotification){
let dict:NSDictionary = notification.userInfo!
let s:NSValue = dict.valueForKey(UIKeyboardFrameEndUserInfoKey) as NSValue
let rect:CGRect = s.CGRectValue()
UIView.animateWithDuration(0.3, delay: 0, options: .CurveLinear, animations: {
self.resultsScrollView.frame.origin.y = self.scrollViewOriginalY - rect.height
self.frameMessageView.frame.origin.y = self.frameMessageOriginalY - rect.height
var bottomOffset:CGPoint = CGPointMake(0, self.resultsScrollView.contentSize.height - self.resultsScrollView.bounds.size.height)
self.resultsScrollView.setContentOffset(bottomOffset, animated: false)
}, completion: {
(finished:Bool) in
})
}
So this should just be pushing the view up so it's not covered by the keyboard as you type. But as soon as I pull the keyboard up, it crashes. It would be great if Xcode told you what line the error is on, but that would be too easy..
Does this mean the function doesn't recognizer the parameter I'm passing in to it? Or why can't it recognize the 'selector'?
Judging by the error message reason: '-[RTApp.conversationVC keyboardWasShown]: unrecognized selector you used the wrong selector when you added the Notification Observer.
You should use Selector("keyboardWasShown:") instead of Selector("keyboardWasShown") because your method has one parameter.
I'm using Local Notification plugin for a phonegap iOS app. When I try to add a new Notification, the app throw a NSInvalidArgumentException.
Here is the code when i add a notification:
var now = new Date().getTime(),
_60_seconds_from_now = new Date(now + 60*1000);
window.plugin.notification.local.add({
id: 1,
title: 'Reminder',
message: 'Dont forget to buy some flowers.',
repeat: false,
date: _60_seconds_from_now
});
And here is the output
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xa26c650'
*** First throw call stack:
(
0 CoreFoundation 0x000dd1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x021948e5 objc_exception_throw + 44
2 CoreFoundation 0x0017a243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x000cd50b ___forwarding___ + 1019
4 CoreFoundation 0x000cd0ee _CF_forwarding_prep_0 + 14
5 OPS 0x000276e9 -[APPLocalNotification notificationWithId:] + 521
6 OPS 0x00027246 -[APPLocalNotification isNotificationScheduledWithId:] + 86
7 OPS 0x00023458 __28-[APPLocalNotification add:]_block_invoke + 200
8 libdispatch.dylib 0x027527b8 _dispatch_call_block_and_release + 15
9 libdispatch.dylib 0x027674d0 _dispatch_client_callout + 14
10 libdispatch.dylib 0x02755eb7 _dispatch_root_queue_drain + 291
11 libdispatch.dylib 0x02756127 _dispatch_worker_thread2 + 39
12 libsystem_pthread.dylib 0x02a96dab _pthread_wqthread + 336
13 libsystem_pthread.dylib 0x02a9acce start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type NSException
any idea? Thank you.
Your id param is not string, but the plugin seem to require a string value for id.
I find the solution. If you are using iOS 7.1, you must replace this line
NSString* notId =[notification.userInfo objectForKey:#"id"];
for this
NSString* notId =[NSString stringWithFormat:#"%#", [notification.userInfo objectForKey:#"id"]];
in the method notificationWithId.
Thanks for the help!