{"action":"created","issue":{"url":"https://api.github.com/repos/spotify/ios-sdk/issues/759","repository_url":"https://api.github.com/repos/spotify/ios-sdk","labels_url":"https://api.github.com/repos/spotify/ios-sdk/issues/759/labels{/name}","comments_url":"https://api.github.com/repos/spotify/ios-sdk/issues/759/comments","events_url":"https://api.github.com/repos/spotify/ios-sdk/issues/759/events","html_url":"https://github.com/spotify/ios-sdk/issues/759","id":178733524,"node_id":"MDU6SXNzdWUxNzg3MzM1MjQ=","number":759,"title":"Unable to retrieve SPTSession from NSKeyedUnarchiver (swift 3)","user":{"login":"ksinghal","id":4765829,"node_id":"MDQ6VXNlcjQ3NjU4Mjk=","avatar_url":"https://avatars3.githubusercontent.com/u/4765829?v=4","gravatar_id":"","url":"https://api.github.com/users/ksinghal","html_url":"https://github.com/ksinghal","followers_url":"https://api.github.com/users/ksinghal/followers","following_url":"https://api.github.com/users/ksinghal/following{/other_user}","gists_url":"https://api.github.com/users/ksinghal/gists{/gist_id}","starred_url":"https://api.github.com/users/ksinghal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksinghal/subscriptions","organizations_url":"https://api.github.com/users/ksinghal/orgs","repos_url":"https://api.github.com/users/ksinghal/repos","events_url":"https://api.github.com/users/ksinghal/events{/privacy}","received_events_url":"https://api.github.com/users/ksinghal/received_events","type":"User","site_admin":false},"labels":[{"id":378725371,"node_id":"MDU6TGFiZWwzNzg3MjUzNzE=","url":"https://api.github.com/repos/spotify/ios-sdk/labels/authentication","name":"authentication","color":"c2e0c6","default":false},{"id":83951151,"node_id":"MDU6TGFiZWw4Mzk1MTE1MQ==","url":"https://api.github.com/repos/spotify/ios-sdk/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":465610909,"node_id":"MDU6TGFiZWw0NjU2MTA5MDk=","url":"https://api.github.com/repos/spotify/ios-sdk/labels/swift","name":"swift","color":"e99695","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-09-22T22:09:25Z","updated_at":"2018-06-11T13:04:32Z","closed_at":null,"author_association":"NONE","body":"I am getting the following error when trying to unarchive an SPTSession\n\n`Could not cast value of type 'SPTSession' (0x1014617e8) to 'SPTSession' (0x100364468).`\n\nI believe this may have something to do with swift 3 changes. My code is as follows:\n\n```\nfunc attemptReconnect() {\n        if let sessionData = UserDefaults.standard.object(forKey: SpotifyAuth.sessionUserDefaultsKey) as? Data {\n            if let session = NSKeyedUnarchiver.unarchiveObject(with: sessionData) {\n                if (session as! SPTSession).isValid() { // crashes on this line because the retrieved object is of the wrong type\n                    enableAudioPlaybackWithSession(session as! SPTSession)\n                }\n                else {\n                    renewTokenAndEnablePlayback()\n                }\n                return\n            }\n        }\n}\n```\n\nHere is a related SO post from another user (no answers yet): http://stackoverflow.com/questions/39598976/could-not-cast-value-of-type-sptsession-0x110afab98-to-sptsession-0x10f17\n"},"comment":{"url":"https://api.github.com/repos/spotify/ios-sdk/issues/comments/396236019","html_url":"https://github.com/spotify/ios-sdk/issues/759#issuecomment-396236019","issue_url":"https://api.github.com/repos/spotify/ios-sdk/issues/759","id":396236019,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjIzNjAxOQ==","user":{"login":"saru2020","id":1034916,"node_id":"MDQ6VXNlcjEwMzQ5MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/1034916?v=4","gravatar_id":"","url":"https://api.github.com/users/saru2020","html_url":"https://github.com/saru2020","followers_url":"https://api.github.com/users/saru2020/followers","following_url":"https://api.github.com/users/saru2020/following{/other_user}","gists_url":"https://api.github.com/users/saru2020/gists{/gist_id}","starred_url":"https://api.github.com/users/saru2020/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saru2020/subscriptions","organizations_url":"https://api.github.com/users/saru2020/orgs","repos_url":"https://api.github.com/users/saru2020/repos","events_url":"https://api.github.com/users/saru2020/events{/privacy}","received_events_url":"https://api.github.com/users/saru2020/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T13:04:32Z","updated_at":"2018-06-11T13:04:32Z","author_association":"NONE","body":"This is working now for me:\r\n`if let sessionObj = WMUserDefaults.sharedInstance[sessionUserDefaultsKey] as? SPTSession {\r\n}`"}}
{"actor":{"display_login":"saru2020"}}