{"action":"created","issue":{"url":"https://api.github.com/repos/watson-developer-cloud/ios-sdk/issues/450","repository_url":"https://api.github.com/repos/watson-developer-cloud/ios-sdk","labels_url":"https://api.github.com/repos/watson-developer-cloud/ios-sdk/issues/450/labels{/name}","comments_url":"https://api.github.com/repos/watson-developer-cloud/ios-sdk/issues/450/comments","events_url":"https://api.github.com/repos/watson-developer-cloud/ios-sdk/issues/450/events","html_url":"https://github.com/watson-developer-cloud/ios-sdk/issues/450","id":177871075,"number":450,"title":"[VisualRecognition] Error when attempting to classify local image (NSURL) in Swift","user":{"login":"jaalger","id":4974364,"avatar_url":"https://avatars.githubusercontent.com/u/4974364?v=3","gravatar_id":"","url":"https://api.github.com/users/jaalger","html_url":"https://github.com/jaalger","followers_url":"https://api.github.com/users/jaalger/followers","following_url":"https://api.github.com/users/jaalger/following{/other_user}","gists_url":"https://api.github.com/users/jaalger/gists{/gist_id}","starred_url":"https://api.github.com/users/jaalger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaalger/subscriptions","organizations_url":"https://api.github.com/users/jaalger/orgs","repos_url":"https://api.github.com/users/jaalger/repos","events_url":"https://api.github.com/users/jaalger/events{/privacy}","received_events_url":"https://api.github.com/users/jaalger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-09-19T19:13:46Z","updated_at":"2016-09-21T18:54:36Z","closed_at":null,"body":"I am writing a visual recognition application that uses VisualRecognition.classify in order to classify images. I have configured my Swift environment and have been able to classify images when including a URL from the internet:\r\n\r\nExample:\r\n\r\n```\r\n visualRecognition.classify(\"http://blog.fashionsealhealthcare.com/sites/default/files/styles/blog_image_display/public/field/image/blogs/ibm_watson.png\", failure: visualRecongnitionDidFail){\r\n            classifiedImages in\r\n            print(classifiedImages)\r\n}\r\n\r\n```\r\n\r\nI have now created an application that uses the camera and photo library to allow users to take photos and have them classified. I am running into issues when passing along an NSURL from the device to the VisualRecognition service though. \r\n\r\nExample:\r\n\r\nI create and save an image to the local device and then pass the NSURL to a simple classify function:\r\n\r\n```\r\nfunc classifyImage(imagePath: NSURL){\r\n                visualRecognition.classify(imagePath, failure: visualRecongnitionDidFail){\r\n            classifiedImages in\r\n            print(classifiedImages)\r\n        }\r\n    \r\n    }\r\n\r\n```\r\nThe NSURL that I have been attempting to pass is as follows:\r\n\r\nfile:///var/mobile/Containers/Data/Application/C30D220F-699C-441E-A29B-6320391C96BD/Documents/temptest.png\r\n\r\nwhen running the classify command with this NSURL I receive the following error:\r\n\r\nError Domain=com.alamofire.error Code=-6004 \"Data could not be serialized. Failed to parse JSON response. No error information was provided during serialization.\" UserInfo={NSLocalizedFailureReason=Data could not be serialized. Failed to parse JSON response. No error information was provided during serialization.}\r\n\r\nI have even attempted to include the NSURL directly into the classify call as I have done with the working external URL, but still run into the same error. Would really like to see how to use a local image from the device in order to classify it successfully "},"comment":{"url":"https://api.github.com/repos/watson-developer-cloud/ios-sdk/issues/comments/248707846","html_url":"https://github.com/watson-developer-cloud/ios-sdk/issues/450#issuecomment-248707846","issue_url":"https://api.github.com/repos/watson-developer-cloud/ios-sdk/issues/450","id":248707846,"user":{"login":"jaalger","id":4974364,"avatar_url":"https://avatars.githubusercontent.com/u/4974364?v=3","gravatar_id":"","url":"https://api.github.com/users/jaalger","html_url":"https://github.com/jaalger","followers_url":"https://api.github.com/users/jaalger/followers","following_url":"https://api.github.com/users/jaalger/following{/other_user}","gists_url":"https://api.github.com/users/jaalger/gists{/gist_id}","starred_url":"https://api.github.com/users/jaalger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaalger/subscriptions","organizations_url":"https://api.github.com/users/jaalger/orgs","repos_url":"https://api.github.com/users/jaalger/repos","events_url":"https://api.github.com/users/jaalger/events{/privacy}","received_events_url":"https://api.github.com/users/jaalger/received_events","type":"User","site_admin":false},"created_at":"2016-09-21T18:54:36Z","updated_at":"2016-09-21T18:54:36Z","body":"I just verified that I could use the classify function with a jpg instead of a png that I grabbed from the camera roll. "}}
{"actor":{"display_login":"jaalger"}}