{"action":"created","issue":{"url":"https://api.github.com/repos/parse-community/Parse-SDK-iOS-OSX/issues/1275","repository_url":"https://api.github.com/repos/parse-community/Parse-SDK-iOS-OSX","labels_url":"https://api.github.com/repos/parse-community/Parse-SDK-iOS-OSX/issues/1275/labels{/name}","comments_url":"https://api.github.com/repos/parse-community/Parse-SDK-iOS-OSX/issues/1275/comments","events_url":"https://api.github.com/repos/parse-community/Parse-SDK-iOS-OSX/issues/1275/events","html_url":"https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/1275","id":302184313,"node_id":"MDU6SXNzdWUzMDIxODQzMTM=","number":1275,"title":"Closures passed to Parse functions stop mysteriously","user":{"login":"timgianitsos","id":14189758,"node_id":"MDQ6VXNlcjE0MTg5NzU4","avatar_url":"https://avatars0.githubusercontent.com/u/14189758?v=4","gravatar_id":"","url":"https://api.github.com/users/timgianitsos","html_url":"https://github.com/timgianitsos","followers_url":"https://api.github.com/users/timgianitsos/followers","following_url":"https://api.github.com/users/timgianitsos/following{/other_user}","gists_url":"https://api.github.com/users/timgianitsos/gists{/gist_id}","starred_url":"https://api.github.com/users/timgianitsos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timgianitsos/subscriptions","organizations_url":"https://api.github.com/users/timgianitsos/orgs","repos_url":"https://api.github.com/users/timgianitsos/repos","events_url":"https://api.github.com/users/timgianitsos/events{/privacy}","received_events_url":"https://api.github.com/users/timgianitsos/received_events","type":"User","site_admin":false},"labels":[{"id":769775539,"node_id":"MDU6TGFiZWw3Njk3NzU1Mzk=","url":"https://api.github.com/repos/parse-community/Parse-SDK-iOS-OSX/labels/troubleshooting","name":"troubleshooting","color":"bf801a","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-03-05T06:20:48Z","updated_at":"2018-08-28T17:02:21Z","closed_at":null,"author_association":"NONE","body":"### Issue Description\r\n\r\nIn my Swift code, functions that are passed closures as \"block\" parameters sometimes stop mysteriously at the moment one of the closure parameters is used.\r\n\r\n### Steps to reproduce\r\nObserve the following function.\r\n\r\n    PFCloud.callFunction(inBackground: \"someFunction\", withParameters: [\"blah\": someVar], block: { (object: Any?, error: Error?) in\r\n        print(\"foo\")\r\n        print(error!.localizedDescription)\r\n        print(\"bar\")\r\n    })\r\n\r\nIt may be worth mentioning that this function call _itself_ is inside a closure (namely, its in the closure passed to `saveInBackground()`)\r\n#### Results\r\n\r\nThe program prints \"foo\" but then it prints \"-[__NSDictionaryI length]: unrecognized selector sent to instance 0x1c02ec000\". It never prints \"bar\", nor does it throw an error - there is only debugger output.\r\n\r\nI know for a fact that `error` is not nil, but even if it was nil, it should be throwing a nil unwrapping exception - it shouldn't just stop dead in its tracks.\r\n\r\nWhen I use print(error) with no nil unwrapping, I get the following:\r\n\r\n    Optional(Error Domain=Parse Code=141 \"{\r\n    code = 21608;\r\n    message = \"Some message\";\r\n    moreInfo = \"Some info\";\r\n    status = 400;\r\n    }\" UserInfo={code=141, temporary=0, error={\r\n    code = 21608;\r\n    message = \"Some message\";\r\n    moreInfo = \"Some info\";\r\n    status = 400;\r\n    }, NSLocalizedDescription={\r\n    code = 21608;\r\n    message = \"Some messgage\";\r\n    moreInfo = \"Some info\";\r\n    status = 400;\r\n    }})\r\n\r\nI've encountered a problem almost exactly like this in the past, but with the `object` variable. Check out the post [here](https://stackoverflow.com/questions/48474818/not-throwing-index-out-of-bounds-in-swift-closure). Something unusual is going on with the `object` variable and the `error` variable."},"comment":{"url":"https://api.github.com/repos/parse-community/Parse-SDK-iOS-OSX/issues/comments/416663793","html_url":"https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/1275#issuecomment-416663793","issue_url":"https://api.github.com/repos/parse-community/Parse-SDK-iOS-OSX/issues/1275","id":416663793,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjY2Mzc5Mw==","user":{"login":"flovilmart","id":364568,"node_id":"MDQ6VXNlcjM2NDU2OA==","avatar_url":"https://avatars3.githubusercontent.com/u/364568?v=4","gravatar_id":"","url":"https://api.github.com/users/flovilmart","html_url":"https://github.com/flovilmart","followers_url":"https://api.github.com/users/flovilmart/followers","following_url":"https://api.github.com/users/flovilmart/following{/other_user}","gists_url":"https://api.github.com/users/flovilmart/gists{/gist_id}","starred_url":"https://api.github.com/users/flovilmart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flovilmart/subscriptions","organizations_url":"https://api.github.com/users/flovilmart/orgs","repos_url":"https://api.github.com/users/flovilmart/repos","events_url":"https://api.github.com/users/flovilmart/events{/privacy}","received_events_url":"https://api.github.com/users/flovilmart/received_events","type":"User","site_admin":false},"created_at":"2018-08-28T17:02:21Z","updated_at":"2018-08-28T17:02:21Z","author_association":"MEMBER","body":"Isn’t it just because there’s an array instead of a string inside the localizedDescription key that it breaks? I mean the crash is clear saying something tries to send the `length` message to an array like object. `length` is a valid selector on `String` and your workaround implies reading the first object of an array.\r\n\r\nThe fix is to find where in the code, an array is passed into an NSError and makes it crash after"}}
{"actor":{"display_login":"flovilmart"}}