{"action":"created","issue":{"url":"https://api.github.com/repos/nicklockwood/FXForms/issues/278","labels_url":"https://api.github.com/repos/nicklockwood/FXForms/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/nicklockwood/FXForms/issues/278/comments","events_url":"https://api.github.com/repos/nicklockwood/FXForms/issues/278/events","html_url":"https://github.com/nicklockwood/FXForms/issues/278","id":52809596,"number":278,"title":"When selecting cancel in image field action sheet it opens photo library image picker","user":{"login":"abbasmousavi","id":1249875,"avatar_url":"https://avatars.githubusercontent.com/u/1249875?v=3","gravatar_id":"","url":"https://api.github.com/users/abbasmousavi","html_url":"https://github.com/abbasmousavi","followers_url":"https://api.github.com/users/abbasmousavi/followers","following_url":"https://api.github.com/users/abbasmousavi/following{/other_user}","gists_url":"https://api.github.com/users/abbasmousavi/gists{/gist_id}","starred_url":"https://api.github.com/users/abbasmousavi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abbasmousavi/subscriptions","organizations_url":"https://api.github.com/users/abbasmousavi/orgs","repos_url":"https://api.github.com/users/abbasmousavi/repos","events_url":"https://api.github.com/users/abbasmousavi/events{/privacy}","received_events_url":"https://api.github.com/users/abbasmousavi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-12-24T10:10:45Z","updated_at":"2015-02-12T09:16:51Z","closed_at":null,"body":"It opens UIImagePickerControllerSourceTypePhotoLibrary even if the user selects Cancel button.\r\nline:3476 in FXForms.m\r\n\r\n```\r\n- (void)actionSheet:(__unused UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex\r\n{\r\n    UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypePhotoLibrary;\r\n    switch (buttonIndex)\r\n    {\r\n        case 0:\r\n        {\r\n            sourceType = UIImagePickerControllerSourceTypeCamera;\r\n            break;\r\n        }\r\n        case 1:\r\n        {\r\n            sourceType = UIImagePickerControllerSourceTypePhotoLibrary;\r\n            break;\r\n        }\r\n    }\r\n    \r\n    if ([UIImagePickerController isSourceTypeAvailable:sourceType])\r\n    {\r\n        self.imagePickerController.sourceType = sourceType;\r\n        [self.controller presentViewController:self.imagePickerController animated:YES completion:nil];\r\n    }\r\n    \r\n    self.controller = nil;\r\n}\r\n\r\n```\r\n\r\nShould be something like:\r\n\r\n```\r\n- (void)actionSheet:(__unused UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex\r\n{\r\n    if (buttonIndex != 2) {\r\n    UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypePhotoLibrary;\r\n    switch (buttonIndex)\r\n    {\r\n        case 0:\r\n        {\r\n            sourceType = UIImagePickerControllerSourceTypeCamera;\r\n            break;\r\n        }\r\n        case 1:\r\n        {\r\n            sourceType = UIImagePickerControllerSourceTypePhotoLibrary;\r\n            break;\r\n        }\r\n    }\r\n    \r\n    if ([UIImagePickerController isSourceTypeAvailable:sourceType])\r\n    {\r\n        self.imagePickerController.sourceType = sourceType;\r\n        [self.controller presentViewController:self.imagePickerController animated:YES completion:nil];\r\n    }\r\n    \r\n    self.controller = nil;\r\n    }\r\n}\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/nicklockwood/FXForms/issues/comments/74039811","html_url":"https://github.com/nicklockwood/FXForms/issues/278#issuecomment-74039811","issue_url":"https://api.github.com/repos/nicklockwood/FXForms/issues/278","id":74039811,"user":{"login":"kegan","id":21737,"avatar_url":"https://avatars.githubusercontent.com/u/21737?v=3","gravatar_id":"","url":"https://api.github.com/users/kegan","html_url":"https://github.com/kegan","followers_url":"https://api.github.com/users/kegan/followers","following_url":"https://api.github.com/users/kegan/following{/other_user}","gists_url":"https://api.github.com/users/kegan/gists{/gist_id}","starred_url":"https://api.github.com/users/kegan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kegan/subscriptions","organizations_url":"https://api.github.com/users/kegan/orgs","repos_url":"https://api.github.com/users/kegan/repos","events_url":"https://api.github.com/users/kegan/events{/privacy}","received_events_url":"https://api.github.com/users/kegan/received_events","type":"User","site_admin":false},"created_at":"2015-02-12T09:16:51Z","updated_at":"2015-02-12T09:16:51Z","body":"+1 I am having the same issue."}}