{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/4479","repository_url":"https://api.github.com/repos/realm/realm-cocoa","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4479/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4479/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4479/events","html_url":"https://github.com/realm/realm-cocoa/issues/4479","id":197176053,"number":4479,"title":"iOS app crashing","user":{"login":"vipindhangar","id":2247243,"avatar_url":"https://avatars.githubusercontent.com/u/2247243?v=3","gravatar_id":"","url":"https://api.github.com/users/vipindhangar","html_url":"https://github.com/vipindhangar","followers_url":"https://api.github.com/users/vipindhangar/followers","following_url":"https://api.github.com/users/vipindhangar/following{/other_user}","gists_url":"https://api.github.com/users/vipindhangar/gists{/gist_id}","starred_url":"https://api.github.com/users/vipindhangar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vipindhangar/subscriptions","organizations_url":"https://api.github.com/users/vipindhangar/orgs","repos_url":"https://api.github.com/users/vipindhangar/repos","events_url":"https://api.github.com/users/vipindhangar/events{/privacy}","received_events_url":"https://api.github.com/users/vipindhangar/received_events","type":"User","site_admin":false},"labels":[{"id":3303146,"url":"https://api.github.com/repos/realm/realm-cocoa/labels/T:Help","name":"T:Help","color":"cc317c","default":false}],"state":"open","locked":false,"assignee":{"login":"TimOliver","id":429119,"avatar_url":"https://avatars.githubusercontent.com/u/429119?v=3","gravatar_id":"","url":"https://api.github.com/users/TimOliver","html_url":"https://github.com/TimOliver","followers_url":"https://api.github.com/users/TimOliver/followers","following_url":"https://api.github.com/users/TimOliver/following{/other_user}","gists_url":"https://api.github.com/users/TimOliver/gists{/gist_id}","starred_url":"https://api.github.com/users/TimOliver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimOliver/subscriptions","organizations_url":"https://api.github.com/users/TimOliver/orgs","repos_url":"https://api.github.com/users/TimOliver/repos","events_url":"https://api.github.com/users/TimOliver/events{/privacy}","received_events_url":"https://api.github.com/users/TimOliver/received_events","type":"User","site_admin":false},"assignees":[{"login":"TimOliver","id":429119,"avatar_url":"https://avatars.githubusercontent.com/u/429119?v=3","gravatar_id":"","url":"https://api.github.com/users/TimOliver","html_url":"https://github.com/TimOliver","followers_url":"https://api.github.com/users/TimOliver/followers","following_url":"https://api.github.com/users/TimOliver/following{/other_user}","gists_url":"https://api.github.com/users/TimOliver/gists{/gist_id}","starred_url":"https://api.github.com/users/TimOliver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimOliver/subscriptions","organizations_url":"https://api.github.com/users/TimOliver/orgs","repos_url":"https://api.github.com/users/TimOliver/repos","events_url":"https://api.github.com/users/TimOliver/events{/privacy}","received_events_url":"https://api.github.com/users/TimOliver/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2016-12-22T13:36:59Z","updated_at":"2016-12-24T01:49:23Z","closed_at":null,"body":"Hi,\r\n\r\nI'm using Firebase for chat messaging feature and Realm is used in it internally. \r\nThe issue is :- \r\nThe app is crashing when I start chat (User A) with another user (User B). The case is :-\r\n\r\n1. When User A chats with User B.\r\n2. Now both users switch the devices, (means now User B is using User A's device and vice versa) app crashes first time and if same scenario is repeated then it works fine.\r\n\r\nI have found the below code snippet which crashes the app.\r\n\r\n```\r\nstatic NSUInteger getRowForObjectWithPrimaryKey(RLMClassInfo const& info, id primaryValue) {\r\n\tREALM_ASSERT_DEBUG(info.propertyForPrimaryKey());\r\n\r\n\tRLMProperty *const primaryProperty = info.propertyForPrimaryKey();\r\n\tconst NSUInteger primaryPropertyColumn = info.tableColumn(primaryProperty);\r\n\r\n\tswitch (primaryProperty.type) {\r\n\t\tcase RLMPropertyTypeString:\r\n\t\t\treturn info.table()->find_first_string(primaryPropertyColumn, RLMStringDataWithNSString(primaryValue)); //At this point the app crashes\r\n\r\n\t\tcase RLMPropertyTypeInt:\r\n\t\t\tif (primaryValue) {\r\n\t\t\t\treturn info.table()->find_first_int(primaryPropertyColumn, [primaryValue longLongValue]);\r\n\t\t\t} else {\r\n\t\t\t\treturn info.table()->find_first_null(primaryPropertyColumn);\r\n\t\t\t}\r\n\r\n\t\tdefault:\r\n\t\t\tREALM_UNREACHABLE();\r\n\t}\r\n}\r\n\r\nstatic inline realm::StringData RLMStringDataWithNSString(__unsafe_unretained NSString *const string) {\r\n\tstatic_assert(sizeof(size_t) >= sizeof(NSUInteger),\r\n\t\"Need runtime overflow check for NSUInteger to size_t conversion\");\r\n\treturn realm::StringData(string.UTF8String,\r\n\t[string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments/269063444","html_url":"https://github.com/realm/realm-cocoa/issues/4479#issuecomment-269063444","issue_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4479","id":269063444,"user":{"login":"TimOliver","id":429119,"avatar_url":"https://avatars.githubusercontent.com/u/429119?v=3","gravatar_id":"","url":"https://api.github.com/users/TimOliver","html_url":"https://github.com/TimOliver","followers_url":"https://api.github.com/users/TimOliver/followers","following_url":"https://api.github.com/users/TimOliver/following{/other_user}","gists_url":"https://api.github.com/users/TimOliver/gists{/gist_id}","starred_url":"https://api.github.com/users/TimOliver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimOliver/subscriptions","organizations_url":"https://api.github.com/users/TimOliver/orgs","repos_url":"https://api.github.com/users/TimOliver/repos","events_url":"https://api.github.com/users/TimOliver/events{/privacy}","received_events_url":"https://api.github.com/users/TimOliver/received_events","type":"User","site_admin":false},"created_at":"2016-12-24T01:49:23Z","updated_at":"2016-12-24T01:49:23Z","body":"Hi @vipindhangar!\r\n\r\nCool okay. Please send us the code when you get the chance. Most of Realm will be going on holidays next week, so it might be a little while before we can address it, but we'll try our best.\r\n\r\nHappy holidays!"}}
{"actor":{"display_login":"TimOliver"}}