Sharing Video to Facebook - Swift IOS -


i'm writing app try , post video facebook. ideally i'd pull video parse, , convert nsurl. right trying use imagepicker pick photo used share.

right have imagepicker showing up, i'm getting 2 errors. 1)only photos showing in roll , 2) i'm getting 'found nil while unwrapping optional value' in didfinishpickingmediawithinfo function. issue 1, have changed uiimagepickercontrollersourcetype .photolibrary still omitted videos.

  override func viewwillappear(animated: bool) {      let profilebutton = uibarbuttonitem(image: img, style: .done, target: self, action: "videobtnclicked")      self.navigationitem.setrightbarbuttonitem(profilebutton, animated: true)    func videobtnclicked(){       if uiimagepickercontroller.issourcetypeavailable(uiimagepickercontrollersourcetype.savedphotosalbum){           print("video capture")           imagepicker.delegate = self           imagepicker.sourcetype = uiimagepickercontrollersourcetype.savedphotosalbum           imagepicker.allowsediting = false           self.presentviewcontroller(imagepicker, animated: true, completion: nil)         }     }    func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : anyobject]) {       let video : fbsdksharevideo = fbsdksharevideo()           //error occurs line below here                  video.videourl = info[uiimagepickercontrollermediaurl] as! nsurl       let content : fbsdksharevideocontent = fbsdksharevideocontent()       content.video = video     } 

  1. for photo question
func videobtnclicked(){   if uiimagepickercontroller.issourcetypeavailable(uiimagepickercontrollersourcetype.savedphotosalbum){       print("video capture")       imagepicker.delegate = self       imagepicker.sourcetype = uiimagepickercontrollersourcetype.savedphotosalbum       **imagepicker.mediatypes = ["public.movie"]**       imagepicker.allowsediting = false       self.presentviewcontroller(imagepicker, animated: true, completion: nil)     } } 
  1. for second question,you should check url first
func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : anyobject]) {         let video : fbsdksharevideo = fbsdksharevideo()       //error occurs line below here          if let url = video.videourl{       video.videourl = info[uiimagepickercontrollermediaurl] as? nsurl       let content : fbsdksharevideocontent = fbsdksharevideocontent()       content.video = video   } } 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -