{"action":"opened","number":488,"pull_request":{"url":"https://api.github.com/repos/segmentio/analytics-ios/pulls/488","id":52354823,"html_url":"https://github.com/segmentio/analytics-ios/pull/488","diff_url":"https://github.com/segmentio/analytics-ios/pull/488.diff","patch_url":"https://github.com/segmentio/analytics-ios/pull/488.patch","issue_url":"https://api.github.com/repos/segmentio/analytics-ios/issues/488","number":488,"state":"open","locked":false,"title":"Store `userId` and `anonymousId` in NSUserDefaults","user":{"login":"mootpointer","id":126967,"avatar_url":"https://avatars.githubusercontent.com/u/126967?v=3","gravatar_id":"","url":"https://api.github.com/users/mootpointer","html_url":"https://github.com/mootpointer","followers_url":"https://api.github.com/users/mootpointer/followers","following_url":"https://api.github.com/users/mootpointer/following{/other_user}","gists_url":"https://api.github.com/users/mootpointer/gists{/gist_id}","starred_url":"https://api.github.com/users/mootpointer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mootpointer/subscriptions","organizations_url":"https://api.github.com/users/mootpointer/orgs","repos_url":"https://api.github.com/users/mootpointer/repos","events_url":"https://api.github.com/users/mootpointer/events{/privacy}","received_events_url":"https://api.github.com/users/mootpointer/received_events","type":"User","site_admin":false},"body":"When looking for the `userId` and `anonymousId`, look first in\n`NSUserDefaults`, then in the stored file. The stored file is persistent\nin most cases, but on tvOS, the file system should be treated as\ntemporary. That means we lose the identity of the user is lost as soon\nas the file system is cleared on the Apple TV.\n\nThis solution does not replace these file, but simply augments them,\nusing `NSUserDefaults` as a cache in front of the files. The only\nrationale I can think of for using files is that sometimes apps blow\naway their defaults.\n\nThere is probably another approach here which finds a happy medium, but\n`NSUserDefaults` is all we've really got (unless you want to play with\nthe keychain, and I sure don't) on tvOS.","created_at":"2015-12-02T05:17:50Z","updated_at":"2015-12-02T05:17:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/segmentio/analytics-ios/pulls/488/commits","review_comments_url":"https://api.github.com/repos/segmentio/analytics-ios/pulls/488/comments","review_comment_url":"https://api.github.com/repos/segmentio/analytics-ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/segmentio/analytics-ios/issues/488/comments","statuses_url":"https://api.github.com/repos/segmentio/analytics-ios/statuses/438c7d97ab80c5705c0b244e7ee81e160f4e49ab","head":{"label":"zovafit:store_ids_in_defaults","ref":"store_ids_in_defaults","sha":"438c7d97ab80c5705c0b244e7ee81e160f4e49ab","user":{"login":"zovafit","id":7120969,"avatar_url":"https://avatars.githubusercontent.com/u/7120969?v=3","gravatar_id":"","url":"https://api.github.com/users/zovafit","html_url":"https://github.com/zovafit","followers_url":"https://api.github.com/users/zovafit/followers","following_url":"https://api.github.com/users/zovafit/following{/other_user}","gists_url":"https://api.github.com/users/zovafit/gists{/gist_id}","starred_url":"https://api.github.com/users/zovafit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zovafit/subscriptions","organizations_url":"https://api.github.com/users/zovafit/orgs","repos_url":"https://api.github.com/users/zovafit/repos","events_url":"https://api.github.com/users/zovafit/events{/privacy}","received_events_url":"https://api.github.com/users/zovafit/received_events","type":"Organization","site_admin":false},"repo":{"id":47235211,"name":"analytics-ios","full_name":"zovafit/analytics-ios","owner":{"login":"zovafit","id":7120969,"avatar_url":"https://avatars.githubusercontent.com/u/7120969?v=3","gravatar_id":"","url":"https://api.github.com/users/zovafit","html_url":"https://github.com/zovafit","followers_url":"https://api.github.com/users/zovafit/followers","following_url":"https://api.github.com/users/zovafit/following{/other_user}","gists_url":"https://api.github.com/users/zovafit/gists{/gist_id}","starred_url":"https://api.github.com/users/zovafit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zovafit/subscriptions","organizations_url":"https://api.github.com/users/zovafit/orgs","repos_url":"https://api.github.com/users/zovafit/repos","events_url":"https://api.github.com/users/zovafit/events{/privacy}","received_events_url":"https://api.github.com/users/zovafit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zovafit/analytics-ios","description":"The hassle-free way to integrate analytics into any iOS application. ","fork":true,"url":"https://api.github.com/repos/zovafit/analytics-ios","forks_url":"https://api.github.com/repos/zovafit/analytics-ios/forks","keys_url":"https://api.github.com/repos/zovafit/analytics-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zovafit/analytics-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zovafit/analytics-ios/teams","hooks_url":"https://api.github.com/repos/zovafit/analytics-ios/hooks","issue_events_url":"https://api.github.com/repos/zovafit/analytics-ios/issues/events{/number}","events_url":"https://api.github.com/repos/zovafit/analytics-ios/events","assignees_url":"https://api.github.com/repos/zovafit/analytics-ios/assignees{/user}","branches_url":"https://api.github.com/repos/zovafit/analytics-ios/branches{/branch}","tags_url":"https://api.github.com/repos/zovafit/analytics-ios/tags","blobs_url":"https://api.github.com/repos/zovafit/analytics-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zovafit/analytics-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zovafit/analytics-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/zovafit/analytics-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zovafit/analytics-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/zovafit/analytics-ios/languages","stargazers_url":"https://api.github.com/repos/zovafit/analytics-ios/stargazers","contributors_url":"https://api.github.com/repos/zovafit/analytics-ios/contributors","subscribers_url":"https://api.github.com/repos/zovafit/analytics-ios/subscribers","subscription_url":"https://api.github.com/repos/zovafit/analytics-ios/subscription","commits_url":"https://api.github.com/repos/zovafit/analytics-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/zovafit/analytics-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/zovafit/analytics-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/zovafit/analytics-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/zovafit/analytics-ios/contents/{+path}","compare_url":"https://api.github.com/repos/zovafit/analytics-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zovafit/analytics-ios/merges","archive_url":"https://api.github.com/repos/zovafit/analytics-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zovafit/analytics-ios/downloads","issues_url":"https://api.github.com/repos/zovafit/analytics-ios/issues{/number}","pulls_url":"https://api.github.com/repos/zovafit/analytics-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/zovafit/analytics-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/zovafit/analytics-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zovafit/analytics-ios/labels{/name}","releases_url":"https://api.github.com/repos/zovafit/analytics-ios/releases{/id}","created_at":"2015-12-02T03:40:28Z","updated_at":"2015-12-02T03:40:37Z","pushed_at":"2015-12-02T05:14:45Z","git_url":"git://github.com/zovafit/analytics-ios.git","ssh_url":"git@github.com:zovafit/analytics-ios.git","clone_url":"https://github.com/zovafit/analytics-ios.git","svn_url":"https://github.com/zovafit/analytics-ios","homepage":"https://segment.com/libraries/ios","size":187143,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"segmentio:master","ref":"master","sha":"791780ad02c7f3a518b94fc8a6180c35ac56cb56","user":{"login":"segmentio","id":819518,"avatar_url":"https://avatars.githubusercontent.com/u/819518?v=3","gravatar_id":"","url":"https://api.github.com/users/segmentio","html_url":"https://github.com/segmentio","followers_url":"https://api.github.com/users/segmentio/followers","following_url":"https://api.github.com/users/segmentio/following{/other_user}","gists_url":"https://api.github.com/users/segmentio/gists{/gist_id}","starred_url":"https://api.github.com/users/segmentio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segmentio/subscriptions","organizations_url":"https://api.github.com/users/segmentio/orgs","repos_url":"https://api.github.com/users/segmentio/repos","events_url":"https://api.github.com/users/segmentio/events{/privacy}","received_events_url":"https://api.github.com/users/segmentio/received_events","type":"Organization","site_admin":false},"repo":{"id":8664152,"name":"analytics-ios","full_name":"segmentio/analytics-ios","owner":{"login":"segmentio","id":819518,"avatar_url":"https://avatars.githubusercontent.com/u/819518?v=3","gravatar_id":"","url":"https://api.github.com/users/segmentio","html_url":"https://github.com/segmentio","followers_url":"https://api.github.com/users/segmentio/followers","following_url":"https://api.github.com/users/segmentio/following{/other_user}","gists_url":"https://api.github.com/users/segmentio/gists{/gist_id}","starred_url":"https://api.github.com/users/segmentio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segmentio/subscriptions","organizations_url":"https://api.github.com/users/segmentio/orgs","repos_url":"https://api.github.com/users/segmentio/repos","events_url":"https://api.github.com/users/segmentio/events{/privacy}","received_events_url":"https://api.github.com/users/segmentio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/segmentio/analytics-ios","description":"The hassle-free way to integrate analytics into any iOS application. ","fork":false,"url":"https://api.github.com/repos/segmentio/analytics-ios","forks_url":"https://api.github.com/repos/segmentio/analytics-ios/forks","keys_url":"https://api.github.com/repos/segmentio/analytics-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/segmentio/analytics-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/segmentio/analytics-ios/teams","hooks_url":"https://api.github.com/repos/segmentio/analytics-ios/hooks","issue_events_url":"https://api.github.com/repos/segmentio/analytics-ios/issues/events{/number}","events_url":"https://api.github.com/repos/segmentio/analytics-ios/events","assignees_url":"https://api.github.com/repos/segmentio/analytics-ios/assignees{/user}","branches_url":"https://api.github.com/repos/segmentio/analytics-ios/branches{/branch}","tags_url":"https://api.github.com/repos/segmentio/analytics-ios/tags","blobs_url":"https://api.github.com/repos/segmentio/analytics-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/segmentio/analytics-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/segmentio/analytics-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/segmentio/analytics-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/segmentio/analytics-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/segmentio/analytics-ios/languages","stargazers_url":"https://api.github.com/repos/segmentio/analytics-ios/stargazers","contributors_url":"https://api.github.com/repos/segmentio/analytics-ios/contributors","subscribers_url":"https://api.github.com/repos/segmentio/analytics-ios/subscribers","subscription_url":"https://api.github.com/repos/segmentio/analytics-ios/subscription","commits_url":"https://api.github.com/repos/segmentio/analytics-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/segmentio/analytics-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/segmentio/analytics-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/segmentio/analytics-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/segmentio/analytics-ios/contents/{+path}","compare_url":"https://api.github.com/repos/segmentio/analytics-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/segmentio/analytics-ios/merges","archive_url":"https://api.github.com/repos/segmentio/analytics-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/segmentio/analytics-ios/downloads","issues_url":"https://api.github.com/repos/segmentio/analytics-ios/issues{/number}","pulls_url":"https://api.github.com/repos/segmentio/analytics-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/segmentio/analytics-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/segmentio/analytics-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/segmentio/analytics-ios/labels{/name}","releases_url":"https://api.github.com/repos/segmentio/analytics-ios/releases{/id}","created_at":"2013-03-09T02:46:59Z","updated_at":"2015-12-01T04:41:14Z","pushed_at":"2015-12-02T01:27:55Z","git_url":"git://github.com/segmentio/analytics-ios.git","ssh_url":"git@github.com:segmentio/analytics-ios.git","clone_url":"https://github.com/segmentio/analytics-ios.git","svn_url":"https://github.com/segmentio/analytics-ios","homepage":"https://segment.com/libraries/ios","size":187325,"stargazers_count":142,"watchers_count":142,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":111,"mirror_url":null,"open_issues_count":28,"forks":111,"open_issues":28,"watchers":142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/segmentio/analytics-ios/pulls/488"},"html":{"href":"https://github.com/segmentio/analytics-ios/pull/488"},"issue":{"href":"https://api.github.com/repos/segmentio/analytics-ios/issues/488"},"comments":{"href":"https://api.github.com/repos/segmentio/analytics-ios/issues/488/comments"},"review_comments":{"href":"https://api.github.com/repos/segmentio/analytics-ios/pulls/488/comments"},"review_comment":{"href":"https://api.github.com/repos/segmentio/analytics-ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/segmentio/analytics-ios/pulls/488/commits"},"statuses":{"href":"https://api.github.com/repos/segmentio/analytics-ios/statuses/438c7d97ab80c5705c0b244e7ee81e160f4e49ab"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":13,"deletions":2,"changed_files":1}}