{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/3239","repository_url":"https://api.github.com/repos/realm/realm-cocoa","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3239/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3239/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3239/events","html_url":"https://github.com/realm/realm-cocoa/issues/3239","id":134577214,"number":3239,"title":"Realm syncronization after background transaction","user":{"login":"dave-trudes","id":1378152,"avatar_url":"https://avatars.githubusercontent.com/u/1378152?v=3","gravatar_id":"","url":"https://api.github.com/users/dave-trudes","html_url":"https://github.com/dave-trudes","followers_url":"https://api.github.com/users/dave-trudes/followers","following_url":"https://api.github.com/users/dave-trudes/following{/other_user}","gists_url":"https://api.github.com/users/dave-trudes/gists{/gist_id}","starred_url":"https://api.github.com/users/dave-trudes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dave-trudes/subscriptions","organizations_url":"https://api.github.com/users/dave-trudes/orgs","repos_url":"https://api.github.com/users/dave-trudes/repos","events_url":"https://api.github.com/users/dave-trudes/events{/privacy}","received_events_url":"https://api.github.com/users/dave-trudes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-cocoa/labels/S:Waiting%20For%20User","name":"S:Waiting For User","color":"ededed"},{"url":"https://api.github.com/repos/realm/realm-cocoa/labels/T:Help","name":"T:Help","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"mrackwitz","id":1389011,"avatar_url":"https://avatars.githubusercontent.com/u/1389011?v=3","gravatar_id":"","url":"https://api.github.com/users/mrackwitz","html_url":"https://github.com/mrackwitz","followers_url":"https://api.github.com/users/mrackwitz/followers","following_url":"https://api.github.com/users/mrackwitz/following{/other_user}","gists_url":"https://api.github.com/users/mrackwitz/gists{/gist_id}","starred_url":"https://api.github.com/users/mrackwitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrackwitz/subscriptions","organizations_url":"https://api.github.com/users/mrackwitz/orgs","repos_url":"https://api.github.com/users/mrackwitz/repos","events_url":"https://api.github.com/users/mrackwitz/events{/privacy}","received_events_url":"https://api.github.com/users/mrackwitz/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-02-18T13:13:15Z","updated_at":"2016-03-10T10:47:31Z","closed_at":"2016-03-10T10:47:31Z","body":"I want to use Realm transactions in combination with promises (eg. PromiseKit).\r\nFollowing example:\r\n\r\n```swift\r\n func sync() -> Promise<Void> {\r\n\treturn Promise { fulfill, reject in\r\n\t\tdispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)) {\r\n\t\t\t\r\n\t\t\t// Retrieve realm instance for background thread \r\n\t\t\t// Execute realm transaction\r\n\t\t\t\r\n\t\t\tdispatch_async(dispatch_get_main_queue()) {\r\n\t\t\t\t// How to make sure realms are syncronized before fulfilling the promise?\r\n\t\t\t\tfulfill()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments/194787456","html_url":"https://github.com/realm/realm-cocoa/issues/3239#issuecomment-194787456","issue_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3239","id":194787456,"user":{"login":"mrackwitz","id":1389011,"avatar_url":"https://avatars.githubusercontent.com/u/1389011?v=3","gravatar_id":"","url":"https://api.github.com/users/mrackwitz","html_url":"https://github.com/mrackwitz","followers_url":"https://api.github.com/users/mrackwitz/followers","following_url":"https://api.github.com/users/mrackwitz/following{/other_user}","gists_url":"https://api.github.com/users/mrackwitz/gists{/gist_id}","starred_url":"https://api.github.com/users/mrackwitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrackwitz/subscriptions","organizations_url":"https://api.github.com/users/mrackwitz/orgs","repos_url":"https://api.github.com/users/mrackwitz/repos","events_url":"https://api.github.com/users/mrackwitz/events{/privacy}","received_events_url":"https://api.github.com/users/mrackwitz/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T10:47:31Z","updated_at":"2016-03-10T10:47:31Z","body":"Closing this now, assuming this could be resolved. If you have any questions left, feel free though to comment again or ask on StackOverflow, what we prefer in general for Help related questions."}}