{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/4485","repository_url":"https://api.github.com/repos/realm/realm-cocoa","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4485/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4485/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4485/events","html_url":"https://github.com/realm/realm-cocoa/issues/4485","id":197467579,"number":4485,"title":"Synced Realm Not Created Locally - File Not Found","user":{"login":"jarrodparkes","id":1331063,"avatar_url":"https://avatars.githubusercontent.com/u/1331063?v=3","gravatar_id":"","url":"https://api.github.com/users/jarrodparkes","html_url":"https://github.com/jarrodparkes","followers_url":"https://api.github.com/users/jarrodparkes/followers","following_url":"https://api.github.com/users/jarrodparkes/following{/other_user}","gists_url":"https://api.github.com/users/jarrodparkes/gists{/gist_id}","starred_url":"https://api.github.com/users/jarrodparkes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarrodparkes/subscriptions","organizations_url":"https://api.github.com/users/jarrodparkes/orgs","repos_url":"https://api.github.com/users/jarrodparkes/repos","events_url":"https://api.github.com/users/jarrodparkes/events{/privacy}","received_events_url":"https://api.github.com/users/jarrodparkes/received_events","type":"User","site_admin":false},"labels":[{"id":320261835,"url":"https://api.github.com/repos/realm/realm-cocoa/labels/S:In%20Progress","name":"S:In Progress","color":"ededed","default":false},{"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":"austinzheng","id":3687054,"avatar_url":"https://avatars.githubusercontent.com/u/3687054?v=3","gravatar_id":"","url":"https://api.github.com/users/austinzheng","html_url":"https://github.com/austinzheng","followers_url":"https://api.github.com/users/austinzheng/followers","following_url":"https://api.github.com/users/austinzheng/following{/other_user}","gists_url":"https://api.github.com/users/austinzheng/gists{/gist_id}","starred_url":"https://api.github.com/users/austinzheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/austinzheng/subscriptions","organizations_url":"https://api.github.com/users/austinzheng/orgs","repos_url":"https://api.github.com/users/austinzheng/repos","events_url":"https://api.github.com/users/austinzheng/events{/privacy}","received_events_url":"https://api.github.com/users/austinzheng/received_events","type":"User","site_admin":false},"assignees":[{"login":"austinzheng","id":3687054,"avatar_url":"https://avatars.githubusercontent.com/u/3687054?v=3","gravatar_id":"","url":"https://api.github.com/users/austinzheng","html_url":"https://github.com/austinzheng","followers_url":"https://api.github.com/users/austinzheng/followers","following_url":"https://api.github.com/users/austinzheng/following{/other_user}","gists_url":"https://api.github.com/users/austinzheng/gists{/gist_id}","starred_url":"https://api.github.com/users/austinzheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/austinzheng/subscriptions","organizations_url":"https://api.github.com/users/austinzheng/orgs","repos_url":"https://api.github.com/users/austinzheng/repos","events_url":"https://api.github.com/users/austinzheng/events{/privacy}","received_events_url":"https://api.github.com/users/austinzheng/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2016-12-24T15:33:46Z","updated_at":"2016-12-28T14:24:47Z","closed_at":null,"body":"## Goals\r\n\r\nWhat do you want to achieve?\r\n\r\n- iOS app connects to Realm Object Server using an account with readonly permissions for the realm called `realm://[server-ip]:9080/[user-id-string]/banjo`\r\n- iOS app syncs/downloads the contents of the `banjo` realm\r\n\r\n## Expected Results\r\n\r\nWhat did you expected to happen?\r\n\r\n- iOS app/simulator is able to download contents of `banjo` realm so that I can display view controller that allows me to search over it\r\n- when looking at the simulator's documents directory, i cannot find the `banjo` realm; granted, I'm unsure this is what I am expected to see\r\n\r\n![File Not Found](https://github.com/jarrodparkes/images/blob/master/banjo-file-not-found.png?raw=true)\r\n\r\n## Actual Results\r\n\r\nWhat did happened instead?  \r\n\r\n`fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=5 \"Directory at path '/Users/jarrodparkes/Library/Developer/CoreSimulator/Devices/B4854B46-966F-4EF1-8D36-32390701C371/data/Containers/Data/Application/6C798B08-FB44-45BD-8DE2-E98CFB0E9CDA/Documents/realm-object-server/6e8ba4335322f219d8cac5682457e206/realm%3A%2F%2F45.55.65.37%3A9080%2F19ebf526e022f8aec47c6c30eb8149c6%2Fbanjo' does not exist.\" UserInfo={Error Code=5, NSFilePath=/Users/jarrodparkes/Library/Developer/CoreSimulator/Devices/B4854B46-966F-4EF1-8D36-32390701C371/data/Containers/Data/Application/6C798B08-FB44-45BD-8DE2-E98CFB0E9CDA/Documents/realm-object-server/6e8ba4335322f219d8cac5682457e206/realm%3A%2F%2F45.55.65.37%3A9080%2F19ebf526e022f8aec47c6c30eb8149c6%2Fbanjo, Underlying=open(\"/Users/jarrodparkes/Library/Developer/CoreSimulator/Devices/B4854B46-966F-4EF1-8D36-32390701C371/data/Containers/Data/Application/6C798B08-FB44-45BD-8DE2-E98CFB0E9CDA/Documents/realm-object-server/6e8ba4335322f219d8cac5682457e206/realm%3A%2F%2F45.55.65.37%3A9080%2F19ebf526e022f8aec47c6c30eb8149c6%2Fbanjo\") failed: No such file or directory, NSLocalizedDescription=Directory at path '/Users/jarrodparkes/Library/Developer/CoreSimulator/Devices/B4854B46-966F-4EF1-8D36-32390701C371/data/Containers/Data/Application/6C798B08-FB44-45BD-8DE2-E98CFB0E9CDA/Documents/realm-object-server/6e8ba4335322f219d8cac5682457e206/realm%3A%2F%2F45.55.65.37%3A9080%2F19ebf526e022f8aec47c6c30eb8149c6%2Fbanjo' does not exist.}: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-800.0.58.6/src/swift/stdlib/public/core/ErrorType.swift, line 178`\r\n\r\n![Crash Image](https://github.com/jarrodparkes/images/blob/master/banjo-realm-crash.png?raw=true)\r\n\r\n## Steps to Reproduce\r\n\r\nWhat are steps we can follow to reproduce this issue?\r\n\r\n- Try connecting to my ROS using the following code (Swift)\r\n\r\n```swift\r\nlet username = \"readonly@parkestwins.com\"\r\nlet password = \"readonly\"\r\n\r\nSyncUser.logIn(with: .usernamePassword(username: username, password: password, register: false), server: URL(string: \"http://45.55.65.37:9080\")!) { user, error in\r\n    guard let user = user else {\r\n        fatalError(String(describing: error))\r\n    }\r\n    \r\n    DispatchQueue.main.async {\r\n        Realm.Configuration.defaultConfiguration = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: URL(string: \"realm://45.55.65.37:9080/19ebf526e022f8aec47c6c30eb8149c6/banjo\")!), readOnly: true)\r\n        self.performSegue(withIdentifier: \"login\", sender: self)\r\n    }\r\n}\r\n```\r\n\r\n- Once connected, try creating Realm using the sync configuration\r\n\r\n```swift\r\nlet configuration = toRLMConfiguration(configuration: Realm.Configuration.defaultConfiguration)\r\nreturn try! RLMRealm(configuration: configuration)\r\n```\r\n\r\n## Code Sample\r\n\r\nWill send email to `help@realm.io` to provide access to Xcode project.\r\n\r\n## Version of Realm and Tooling\r\n\r\nRealm version: realm-cocoa_2.1.0, using embedded iOS Realm frameworks (swift-3.0.1)\r\n\r\nXcode version: Xcode 8.1, Build version 8B62\r\n\r\niOS/OSX version: Mac OS X, ProductVersion: 10.12.2, BuildVersion: 16C67\r\n\r\nDependency manager + version: Cocoapods 1.1.1"},"comment":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments/269483605","html_url":"https://github.com/realm/realm-cocoa/issues/4485#issuecomment-269483605","issue_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4485","id":269483605,"user":{"login":"jarrodparkes","id":1331063,"avatar_url":"https://avatars.githubusercontent.com/u/1331063?v=3","gravatar_id":"","url":"https://api.github.com/users/jarrodparkes","html_url":"https://github.com/jarrodparkes","followers_url":"https://api.github.com/users/jarrodparkes/followers","following_url":"https://api.github.com/users/jarrodparkes/following{/other_user}","gists_url":"https://api.github.com/users/jarrodparkes/gists{/gist_id}","starred_url":"https://api.github.com/users/jarrodparkes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarrodparkes/subscriptions","organizations_url":"https://api.github.com/users/jarrodparkes/orgs","repos_url":"https://api.github.com/users/jarrodparkes/repos","events_url":"https://api.github.com/users/jarrodparkes/events{/privacy}","received_events_url":"https://api.github.com/users/jarrodparkes/received_events","type":"User","site_admin":false},"created_at":"2016-12-28T14:24:47Z","updated_at":"2016-12-28T14:24:47Z","body":"@austinzheng I've looked more into the project's single view controller — the only place where Realm is mentioned, and _I'm not finding any evidence of code that results in an upload/write_. So, if it is happening, then it must be happening behind the scenes unbeknownst to me.\r\n\r\n```swift\r\nimport UIKit\r\nimport RealmSwift\r\n\r\n// MARK: - RealmTestVC: UITableViewController\r\n\r\nclass RealmTestVC: UITableViewController {\r\n    \r\n    // MARK: Property\r\n    \r\n    var games = List<Game>()\r\n    var notificationToken: NotificationToken!\r\n    var realm: Realm!\r\n    \r\n    // MARK: Life Cycle\r\n    \r\n    override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n        setupUI()\r\n        setupRealm()\r\n    }\r\n    \r\n    // MARK: Setup\r\n    \r\n    func setupUI() {\r\n        title = \"Games\"\r\n        tableView.register(UITableViewCell.self, forCellReuseIdentifier: \"gameCell\")\r\n    }\r\n    \r\n    func setupRealm() {\r\n        let username = \"readonly@parkestwins.com\"\r\n        let password = \"readonly\"\r\n        \r\n        SyncUser.logIn(with: .usernamePassword(username: username, password: password, register: false), server: URL(string: \"http://45.55.65.37:9080\")!) { user, error in\r\n            guard let user = user else {\r\n                fatalError(String(describing: error))\r\n            }\r\n            \r\n            DispatchQueue.main.async {\r\n                // Open Realm\r\n                var configuration = Realm.Configuration(\r\n                    syncConfiguration: SyncConfiguration(user: user, realmURL: URL(string: \"realm://45.55.65.37:9080/19ebf526e022f8aec47c6c30eb8149c6/banjo\")!)                    \r\n                )\r\n                self.realm = try! Realm(configuration: configuration)\r\n                \r\n                // Show initial tasks\r\n                func updateGames() {\r\n                    if self.games.realm == nil, let platform = self.realm.objects(Platform.self).first {\r\n                        self.games = platform.games\r\n                    }\r\n                    self.tableView.reloadData()\r\n                }\r\n                updateGames()\r\n                \r\n                // Notify us when Realm changes\r\n                self.notificationToken = self.realm.addNotificationBlock { _ in\r\n                    updateGames()\r\n                }\r\n            }\r\n        }\r\n    }\r\n    \r\n    deinit {\r\n        notificationToken.stop()\r\n    }\r\n    \r\n    // MARK: UITableViewDataSource\r\n    \r\n    override func tableView(_ tableView: UITableView?, numberOfRowsInSection section: Int) -> Int {\r\n        return games.count\r\n    }\r\n    \r\n    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\r\n        let cell = tableView.dequeueReusableCell(withIdentifier: \"gameCell\", for: indexPath)\r\n        let game = games[indexPath.row]\r\n        cell.textLabel?.text = game.title\r\n        return cell\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"jarrodparkes"}}