Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Exception: NSInvalidArgumentException *** setObjectForKey: object cannot be nil (key: v_Data) #961 #1064

Closed
tomjtobin opened this issue Jun 19, 2015 · 3 comments
Labels

Comments

@tomjtobin
Copy link

I'm guessing it's hard to reopen or something. So here's the whole thing again

brad36 commented on Mar 18
Got the following error running SDK3.0 on iOS7.1.2

Fatal Exception: NSInvalidArgumentException *** setObjectForKey: object cannot be nil (key: v_Data)

0 CoreFoundation 0x2eda6ecb exceptionPreprocess + 130
1 libobjc.A.dylib 0x39980ce7 objc_exception_throw + 38
2 CoreFoundation 0x2ece217f -[__NSDictionaryM setObject:forKey:] + 818
3 iPath 0x001f4699 -[SFKeychainItemWrapper setObject:forKey:]
4 iPath 0x001f5189 -[SFKeychainItemWrapper setValueData:]
5 iPath 0x00325bd7 +SFSecurityLockout writeLockoutTimeToKeychain:
6 iPath 0x00322483 +SFSecurityLockout upgradeSettings
7 iPath 0x00321ed3 +SFSecurityLockout initialize
8 libobjc.A.dylib 0x39981559 _class_initialize + 572
9 libobjc.A.dylib 0x39985a0f lookUpImpOrForward + 130
10 libobjc.A.dylib 0x39985983 _class_lookupMethodAndLoadCache3 + 34
11 libobjc.A.dylib 0x3998a8b9 _objc_msgSend_uncached + 24
12 iPath 0x0034c8e9 -SalesforceSDKManager savePasscodeActivityInfo
13 iPath 0x0034bfbb -SalesforceSDKManager handleAppBackground:
14 CoreFoundation 0x2ed68f01 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12
15 CoreFoundation 0x2ecdcd69 CFXNotificationPost + 1720
16 Foundation 0x2f6c8cc5 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
17 UIKit 0x3165b511 -[UIApplication handleApplicationSuspend:eventInfo:] + 912
18 UIKit 0x315dd213 -[UIApplication handleEvent:withNewEvent:] + 890
19 UIKit 0x315dcdd9 -[UIApplication sendEvent:] + 72
20 iPath 0x0030bead -SFApplication sendEvent:
21 UIKit 0x316413e5 _UIApplicationHandleEvent + 616
22 GraphicsServices 0x33c14b55 _PurpleEventCallback + 608
23 GraphicsServices 0x33c1473f PurpleEventCallback + 34
24 CoreFoundation 0x2ed71807 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 34
25 CoreFoundation 0x2ed717a3 __CFRunLoopDoSource1 + 346
26 CoreFoundation 0x2ed6ff6f __CFRunLoopRun + 1406
27 CoreFoundation 0x2ecda729 CFRunLoopRunSpecific + 524
28 CoreFoundation 0x2ecda50b CFRunLoopRunInMode + 106
29 GraphicsServices 0x33c136d3 GSEventRunModal + 138
30 UIKit 0x3163b871 UIApplicationMain + 1136
31 iPath 0x0010fc0b main (main.m:33)
32 libdyld.dylib 0x39e7eab7 start + 2
@bhariharan
Owner
bhariharan commented on May 20
@brad36 Are you able to reproduce this on Mobile SDK 3.2?
@brad36
brad36 commented on May 20
Hi Bharath, no not yet, haven't really tried, or had 3.2 in production. We are planning to upgrade to 3.2 within the next couple of months, so when that goes into production, if its still an issue, we should see it come up in Crashlytics eventually
@bhariharan
Owner
bhariharan commented 29 days ago
@brad36 Thanks for checking. We've made some bug fixes in that area in 3.1 and 3.2, so if this issue exists in 3.2, feel free to reopen this issue.
@bhariharanbhariharan closed this 29 days ago
@tomjtobin

tomjtobin commented 18 days ago
We are still seeing this in 3.2, stacktrace is eerily similar, so it looks like the problem is still there:

3

App 0x0000000100be3a78 -[SFKeychainItemWrapper setObject:forKey:] + 432
4

App 0x0000000100be43b4 -[SFKeychainItemWrapper setValueData:] + 56
5

App 0x0000000100a74004 +SFSecurityLockout writeLockoutTimeToKeychain:
6

App 0x0000000100a71d60 +SFSecurityLockout upgradeSettings
7

App 0x0000000100a71950 +SFSecurityLockout initialize
@carlcarter
carlcarter commented 17 days ago
Can confirm this also happens on 3.2.

I have typically seen this when a user has logged in successfully and then used the logout switch in settings.

On next launch the app attempts to set the lockout to 0 and fails with exc_bad_access
@carlcarter
carlcarter commented 17 days ago
#0 0x00000001973dbbd0 in objc_msgSend ()
#1 0x000000018619504c in -__NSDictionaryM setObject:forKey:
#2 0x00000001006b2e88 in -SFKeychainItemWrapper setObject:forKey:
#3 0x00000001006b37c4 in -SFKeychainItemWrapper setValueData:
#4 0x00000001005df780 in +[SFSecurityLockout writeLockoutTimeToKeychain:] at /Users/e01944579/Dev/iOS/Salesforce_MyClient/Pods/SalesforceMobileSDK-iOS/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Security/SFSecurityLockout.m:691
#5 0x00000001005dcf0c in +[SFSecurityLockout setSecurityLockoutTime:] at /Users/e01944579/Dev/iOS/Salesforce_MyClient/Pods/SalesforceMobileSDK-iOS/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Security/SFSecurityLockout.m:258
#6 0x00000001005dd310 in +[SFSecurityLockout clearAllPasscodeState] at /Users/e01944579/Dev/iOS/Salesforce_MyClient/Pods/SalesforceMobileSDK-iOS/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Security/SFSecurityLockout.m:294
#7 0x00000001005dd290 in +[SFSecurityLockout clearPasscodeState] at /Users/e01944579/Dev/iOS/Salesforce_MyClient/Pods/SalesforceMobileSDK-iOS/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Security/SFSecurityLockout.m:283
#8 0x000000010058ea18 in -[SFAuthenticationManager clearAccountState:] at /Users/e01944579/Dev/iOS/Salesforce_MyClient/Pods/SalesforceMobileSDK-iOS/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Security/SFAuthenticationManager.m:820
#9 0x000000010058a4ec in -[SFAuthenticationManager logoutUser:] at /Users/e01944579/Dev/iOS/Salesforce_MyClient/Pods/SalesforceMobileSDK-iOS/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Security/SFAuthenticationManager.m:468
#10 0x000000010058a014 in -[SFAuthenticationManager logout] at /Users/e01944579/Dev/iOS/Salesforce_MyClient/Pods/SalesforceMobileSDK-iOS/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Security/SFAuthenticationManager.m:424
#11 0x00000001006327a0 in -[SalesforceSDKManager processLogoutAndUserSwitchSettings] at /Users/e01944579/Dev/iOS/Salesforce_MyClient/Pods/SalesforceMobileSDK-iOS/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Common/SalesforceSDKManager.m:453
#12 0x0000000100631870 in -[SalesforceSDKManager handleAppForeground:] at /Users/e01944579/Dev/iOS/Salesforce_MyClient/Pods/SalesforceMobileSDK-iOS/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Common/SalesforceSDKManager.m:337
#13 0x0000000186250ddc in CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER ()
#14 0x000000018618f370 in CFXNotificationPost ()
#15 0x00000001870b3520 in -NSNotificationCenter postNotificationName:object:userInfo:
#16 0x000000018ad4fb14 in -UIApplication _handleApplicationActivationWithScene:transitionContext:completion:
#17 0x000000018ad4f0b4 in __88-[UIApplication handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke ()
#18 0x000000018ad4f00c in -UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:
#19 0x000000018ad426a8 in -UIApplication scene:didUpdateWithDiff:transitionContext:completion:
#20 0x000000018e679604 in __31-[FBSSerialQueue performAsync:]_block_invoke ()
#21 0x0000000186262d70 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK ()
#22 0x0000000186261e78 in __CFRunLoopDoBlocks ()
#23 0x000000018626049c in __CFRunLoopRun ()
#24 0x000000018618d1f4 in CFRunLoopRunSpecific ()
#25 0x000000018f4bf6fc in GSEventRunModal ()
#26 0x000000018ab1e10c in UIApplicationMain ()
#27 0x00000001000b69e4 in main at /Users/e01944579/Dev/iOS/Salesforce_MyClient/myClient/main.m:33
#28 0x0000000197a46a08 in start ()

@tomjtobin

tomjtobin commented 17 days ago
@bhariharan should we file as a new issue? or you can re-open this one?
@carlcarter
carlcarter commented 11 days ago
@akhileshgupta as requested

I’ve added more debugging and it only seems to happen when the real device (iPad Air A1475, iOS 8.2) is connected to Xcode and running in debug. Even then, it does not always happen but it once it happens, it tends to keep happening for a period of time until I give up scratching my head and delete the container from the device.

I have enabled SFLogger and gone through multiple login/logout cycles with the device running on it’s own and detached from Xcode (6.2) and I haven’t seen the error since. Very odd and it may well be Xcode related but I’m not 100%. What I do know is, when it crashes, the value passed to writeLockoutTimeToKeychain is always 0 and is converted to an NSData value of <0000 0000>. It crashes at the point where it tries to execute the following step:

if (data != nil)
[keychainWrapper setValueData:data];
@tomjtobin

tomjtobin commented 8 days ago
We've seen it only when not connected to Xcode. It seems to be on install when there is no salesforce login there.

tomjtobin commented 3 days ago
Also, it seems to happen more on devices that are not logged into salesforce (and have not been) and where the app is running in the background (e.g. Background Fetch)

@sk29110
Copy link

sk29110 commented Oct 7, 2015

Is it been fixed or not?

@bhariharan
Copy link
Contributor

I can't reproduce this on the latest Mobile SDK (4.0.2)? Feel free to reopen this issue if you have repro steps.

@nkuttipravan
Copy link

nkuttipravan commented Mar 27, 2017

The crash occurs in 4.2.0 version as well but we couldn't reproduce it. Could you please help us on this?

Here is the log:
Fatal Exception: com.salesforce.security.keychainException
0 CoreFoundation 0x23b6a2eb __exceptionPreprocess
1 libobjc.A.dylib 0x23336dff objc_exception_throw
2 360ONE 0x4df747 -[SFKeychainItemWrapper accessibleAttribute] (SFKeychainItemWrapper.m:162)
3 360ONE 0x4dfd4d -[SFKeychainItemWrapper dictionaryItemFromKeychain] (SFKeychainItemWrapper.m:235)
4 360ONE 0x4df4ff -[SFKeychainItemWrapper initWithIdentifier:account:] (SFKeychainItemWrapper.m:125)
5 360ONE 0x4df2eb +[SFKeychainItemWrapper itemWithIdentifier:account:] (SFKeychainItemWrapper.m:100)
6 360ONE 0x4f1fb1 -[SFOAuthKeychainCredentials tokenForService:] (SFOAuthKeychainCredentials.m:115)
7 360ONE 0x4f2715 -[SFOAuthKeychainCredentials refreshTokenWithSFEncryptionKey:] (SFOAuthKeychainCredentials.m:203)
8 360ONE 0x4f1cd5 -[SFOAuthKeychainCredentials refreshToken] (SFOAuthKeychainCredentials.m:75)
9 360ONE 0x4ea0e5 -[SFOAuthCoordinator authenticate] (SFOAuthCoordinator.m:181)
10 360ONE 0x4cf307 -[SFAuthenticationManager loginWithUser:] (SFAuthenticationManager.m:788)
11 360ONE 0x4cc7d9 -[SFAuthenticationManager loginWithCompletion:failure:account:] (SFAuthenticationManager.m:376)
12 360ONE 0x4cc4bd -[SFAuthenticationManager loginWithCompletion:failure:] (SFAuthenticationManager.m:349)
13 360ONE 0x14af3b -[TSOAuthViewController showLoginScreen] (TSOAuthViewController.m:252)
14 libdispatch.dylib 0x23707dd7 _dispatch_call_block_and_release
15 libdispatch.dylib 0x237114e7 _dispatch_after_timer_callback
16 libdispatch.dylib 0x23707dc3 _dispatch_client_callout
17 libdispatch.dylib 0x2371a6d3 _dispatch_source_latch_and_call
18 libdispatch.dylib 0x23709d17 _dispatch_source_invoke
19 libdispatch.dylib 0x2370c1ff _dispatch_main_queue_callback_4CF
20 CoreFoundation 0x23b2cfc5 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
21 CoreFoundation 0x23b2b4bf __CFRunLoopRun
22 CoreFoundation 0x23a7dbb9 CFRunLoopRunSpecific
23 CoreFoundation 0x23a7d9ad CFRunLoopRunInMode
24 GraphicsServices 0x24cf7af9 GSEventRunModal
25 UIKit 0x27d69fb5 UIApplicationMain
26 360ONE 0xe3863 main (main.m:19)
27 libdyld.dylib 0x23730873 start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants