{"action":"created","issue":{"url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/1834","repository_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS","labels_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/1834/labels{/name}","comments_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/1834/comments","events_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/1834/events","html_url":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS/issues/1834","id":190720691,"number":1834,"title":"UserAccount.plist file is removed from app library container automatically when data is stored and fetched from smartstore to associated watch app and when iPhone app is not running and device is locked","user":{"login":"abinaya001","id":20622260,"avatar_url":"https://avatars.githubusercontent.com/u/20622260?v=3","gravatar_id":"","url":"https://api.github.com/users/abinaya001","html_url":"https://github.com/abinaya001","followers_url":"https://api.github.com/users/abinaya001/followers","following_url":"https://api.github.com/users/abinaya001/following{/other_user}","gists_url":"https://api.github.com/users/abinaya001/gists{/gist_id}","starred_url":"https://api.github.com/users/abinaya001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abinaya001/subscriptions","organizations_url":"https://api.github.com/users/abinaya001/orgs","repos_url":"https://api.github.com/users/abinaya001/repos","events_url":"https://api.github.com/users/abinaya001/events{/privacy}","received_events_url":"https://api.github.com/users/abinaya001/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-21T13:44:24Z","updated_at":"2016-12-20T07:23:43Z","closed_at":null,"body":"Please fill out the following details:\r\n\r\n1. Version of Mobile SDK Used:  4.3.1\r\n2. Issue found in Native App or Hybrid App: Native App\r\n3. OS Version: iOS 10 and Watch OS 3\r\n4. Device: iPhone 5C\r\n5. Steps to reproduce: \r\n   1. Have a iPhone and iWatch app.\r\n   2.Have iPhone app is not running state and the device is locked.\r\n   3. set the local notification. since the device is locked,local notification will be received to iWatch.\r\n   4. Open the notification on iWatch.(When user opens the notification on iWatch, internally watch connectivity delegate method will be called on iPhone side)\r\n   5.Launch iPhone app.\r\n   5. User will be asked to login again as salesforce Sdk removes the useraccount.plist file from the app's library container. \r\n6. Actual behavior: User is asked to login the app every time connected app launches from not running state and user opens the notification from iWatch app.\r\n7. Expected Behavior: User account file should be available even after user respond to the notification from iWatch app.\r\n8. Error Log:\r\nNov 23 13:23:22 (CocoaLumberjack)[704] <Notice>: Could not retrieve user account data from '/var/mobile/Containers/Data/Application/4C4F582C-6869-44CE-A515-A44686CDB2E2/Library/{app bundle id}/00D36000000JflBEAS/00536000001pQxu/UserAccount.plist'\r\nNov 23 13:23:22(CocoaLumberjack)[704] <Notice>: Error deserializing the user account data: Error Domain=SFUserAccountManager Code=10002 \"User account data could not be decrypted. Can't load account.\" UserInfo={NSLocalizedDescription=User account data could not be decrypted. Can't load account.}\r\n\r\nSeems like there is a change in encryption/decryption key when session(session: WCSession, didReceiveMessage message: [String : AnyObject], replyHandler: ([String : AnyObject]) -> Void) method is called on iOS app when the app is not running and the device is locked.\r\n\r\nSince encryption/decryption key is getting changed, user account.plist file is failed to get decrypted which leads the file getting deleted.\r\n\r\nThe application is in live now.  Many users are experiencing the issue due to which they are not able to use iWatch app itself.  Could you please look on the issue and update me ?\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/comments/268173351","html_url":"https://github.com/forcedotcom/SalesforceMobileSDK-iOS/issues/1834#issuecomment-268173351","issue_url":"https://api.github.com/repos/forcedotcom/SalesforceMobileSDK-iOS/issues/1834","id":268173351,"user":{"login":"abinaya001","id":20622260,"avatar_url":"https://avatars.githubusercontent.com/u/20622260?v=3","gravatar_id":"","url":"https://api.github.com/users/abinaya001","html_url":"https://github.com/abinaya001","followers_url":"https://api.github.com/users/abinaya001/followers","following_url":"https://api.github.com/users/abinaya001/following{/other_user}","gists_url":"https://api.github.com/users/abinaya001/gists{/gist_id}","starred_url":"https://api.github.com/users/abinaya001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abinaya001/subscriptions","organizations_url":"https://api.github.com/users/abinaya001/orgs","repos_url":"https://api.github.com/users/abinaya001/repos","events_url":"https://api.github.com/users/abinaya001/events{/privacy}","received_events_url":"https://api.github.com/users/abinaya001/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T07:23:43Z","updated_at":"2016-12-20T07:23:43Z","body":"@trooper2013 : keychain sharing and app groups are not being used.  I tried with latest sdk(5.0).  It didn't solve the issue.  I also tried with the below code which didnt solve the issue: \r\n[SFKeychainItemWrapper setAccessibleAttribute: kSecAttrAccessibleAfterFirstUnlock];\r\n\r\nPlease find the below error log:\r\n\r\n20/12/16, 12:27:39 AppName(CocoaLumberjack)[461]: Could not retrieve user account data from '/path/to/UserAccount.plist'\r\n20/12/16, 12:27:39 AppName(CocoaLumberjack)[461]: Error deserializing the user account data: Error Domain=SFUserAccountManager Code=10002 \"User account data could not be decrypted. Can't load account.\" UserInfo={NSLocalizedDescription=User account data could not be decrypted. Can't load account.}\r\n\r\nI get the log when i click on notification received to iWatch and iPhone is locked and iPhone app is not running on the device.  When i debugged through it,  I could find the below method calls.\r\n\r\nThe method \"- (SFUserAccount *)loadUserAccountFromFile:(NSString *)filePath\" is getting called which internally calls the method \"[self loadUserAccountFromFile:filePath encrypted:YES account:&user error:nil]\".\r\n\r\nSince the later method returns \"NO\", system is trying to get the user account file by calling the method with the parameter encrypted to \"NO\". \r\n\r\nI assume that there is an issue with encryption system which deletes the useraccount.file which is stored in the library directory when user responds to notification from iWatch.\r\n\r\nCould you please have a look at the issue ?  Please let me know if you need more inputs with regards to the issue.\r\n"}}
{"actor":{"display_login":"abinaya001"}}