ios - Cannot invoke" 'setViewController' with an argument list of type [AnyObject] -


"cannot invoke" 'setviewcontroller' argument list of type '([anyobject], direction: uipageviewcontrollernavigationdirection, animated: bool, completion: nil)'"

i got error in xcode 7 beta 3 @ line of code:

self.pageviewcontroller.setviewcontrollers(viewcontrollers [anyobject], direction: uipageviewcontrollernavigationdirection.forward, animated: true, completion: nil) 

this rest of code:

pageimages = nsarray(objects:"screenshot01","screenshot02","screenshot03")          self.pageviewcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("mypageviewcontroller") as! uipageviewcontroller          self.pageviewcontroller.datasource = self          var initialcontenviewcontroller = self.pagetutorialatindex(0) tutorialpagecontentholderviewcontroller          var viewcontrollers = nsarray(object: initialcontenviewcontroller)           self.pageviewcontroller.setviewcontrollers(viewcontrollers [anyobject], direction: uipageviewcontrollernavigationdirection.forward, animated: true, completion: nil)          self.pageviewcontroller.view.frame = cgrectmake(0, 100, self.view.frame.size.width, self.view.frame.size.height-100)          self.addchildviewcontroller(self.pageviewcontroller)         self.view.addsubview(self.pageviewcontroller.view)         self.pageviewcontroller.didmovetoparentviewcontroller(self) 

i don't error if run same code in xcode 6 , can't figure out why.

the signature looks like:

func setviewcontrollers(_ viewcontrollers: [uiviewcontroller]?,               direction direction: uipageviewcontrollernavigationdirection,                animated animated: bool,              completion completion: ((bool) -> void)?) 

so why casting [anyobject]?

try

self.pageviewcontroller.setviewcontrollers(viewcontrollers [uiviewcontroller], direction: uipageviewcontrollernavigationdirection.forward, animated: true, completion: nil) 

depending on type of viewcontrollers might need use as!


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -