Last active
September 15, 2015 18:40
-
-
Save vgdub/2d4fa35e630f6c332cc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func selectAvatar(sender: XLFormRowDescriptor){ | |
let fpController:FPPickerController = FPPickerController() | |
fpController.fpdelegate = self | |
fpController.dataTypes = ["image/*"] | |
fpController.sourceNames = NSArray(objects: FPSourceCamera, FPSourceCameraRoll, FPSourceFacebook, FPSourceInstagram, FPSourceImagesearch) as [AnyObject] | |
fpController.allowsEditing = true | |
fpController.modalPresentationStyle = UIModalPresentationStyle.Popover | |
self.fpSave = FPSaveController() | |
self.fpSave.fpdelegate = self | |
self.fpSave.dataType = "image/*" | |
let presentationController:UIPopoverPresentationController = fpController.popoverPresentationController! | |
presentationController.permittedArrowDirections = UIPopoverArrowDirection.Any | |
self.presentViewController(fpController, animated: true, completion: nil) | |
} | |
func fpPickerController(pickerController: FPPickerController!, didFinishPickingMediaWithInfo info: FPMediaInfo!) { | |
NSLog("File Chosen: %@", info) | |
if info != nil { | |
if info.containsImageAtMediaURL() { | |
let image:UIImage = UIImage(contentsOfFile: info.mediaURL.path!)! | |
let imgData:NSData = UIImagePNGRepresentation(image) | |
self.fpSave.data = imgData | |
self.fpSave.proposedFilename = info.key | |
self.fpSave.saveFileName(info.filename, to: "https://\(S3_BUCKET_NAME).s3.amazonaws.com/uploads/users/2015-09-14/") | |
} | |
self.dismissViewControllerAnimated(true, completion: nil) | |
} else { | |
NSLog("Nothing Picked") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FP Error: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: not found (404)" UserInfo=0x7fa15e4bc490 {NSUnderlyingError=0x7fa15e440a00 "Request failed: unacceptable content-type: text/html", com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7fa1608c00a0> { URL: https://dialog.filepicker.io/api/pathhttps%3A%2F%2Fmatchup-io-dev.s3.amazonaws.com%2Fuploads%2Fusers%2F2015-09-14%2F10103881160450198.jpg } { status code: 404, headers { | |
"Content-Encoding" = gzip; | |
"Content-Type" = "text/html; charset=utf-8"; | |
Date = "Mon, 14 Sep 2015 23:30:01 GMT"; | |
Server = nginx; | |
"Set-Cookie" = "session=\"Q0agqTmnI5EUlhFWI3l3kEPa9gk=?_expires=STE0NDQ5NTE4MDEKLg==&_fresh=STAwCi4=&_id=UyckXHgwZlx4Y2ZceDkzXHg5Mlx4ZjVceDBjXHg5Zlx4OWMsXHhkMXk0XHhjN1x4OWJceGZhJwpwMQou&_permanent=STAxCi4=&cmux_rd=Ti4=&facebook_request_token=UydlbXB0eScKcDEKLg==&recent_path=Vi9GYWNlYm9vay90YWdnZWQvCnAxCi4=&user_auth_id=STQ2MTMyMjIKLg==\"; Domain=dialog.filepicker.io; expires=Thu, 15-Oct-2015 23:30:01 GMT; Path=/; HttpOnly"; | |
"Transfer-Encoding" = Identity; | |
} }, NSErrorFailingURLKey=https://dialog.filepicker.io/api/pathhttps%3A%2F%2Fmatchup-io-dev.s3.amazonaws.com%2Fuploads%2Fusers%2F2015-09-14%2F10103881160450198.jpg, com.alamofire.serialization.response.error.data=<.....>, NSLocalizedDescription=Request failed: not found (404)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment