0

Extra argument 'error' in call

My Code :

AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil)

    if NSClassFromString("MPNowPlayingInfoCenter") != nil {
        let image:UIImage = UIImage(named: "albumart")!
        let albumArt = MPMediaItemArtwork(image: image)
        var songInfo: NSMutableDictionary = [
            MPMediaItemPropertyTitle: "Radio",
            MPMediaItemPropertyArtist: "fm",
            MPMediaItemPropertyArtwork: albumArt
        ]
        MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo = songInfo as [NSObject : AnyObject]
    }
    if (AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil)) {
        print("Receiving remote control events")
        UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
    }!

ScreenShot from Xcode (ErrorLog)

Adrian
  • 1
  • 2
  • Hello and welcome to StackOverflow. Please take some time to read the help page, especially the sections named ["What topics can I ask about here?"](http://stackoverflow.com/help/on-topic) and ["What types of questions should I avoid asking?"](http://stackoverflow.com/help/dont-ask). And more importantly, please read [the Stack Overflow question checklist](http://meta.stackexchange.com/q/156810/204922). You might also want to learn about [Minimal, Complete, and Verifiable Examples](http://stackoverflow.com/help/mcve). – Morgan Thrapp Jul 10 '15 at 20:53
  • The new error handling model is one of the major changes in Swift 2.0 and is documented (for example) in the Xcode 7 release notes and in https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/index.html. – Martin R Jul 10 '15 at 21:03

0 Answers0