2016-10-02 63 views
0

我得到錯誤後我的應用程序正在引發錯誤是:試圖實現RevMob

無法將類型的價值 - 預期參數類型「((錯誤「>虛空(NSError!)」? ) - >無效)!

,是造成此錯誤的代碼是

RevMobAds.startSessionWithAppID("<YOUR_APP_ID>",  
    withSuccessHandler: completionBlock, 
    andFailHandler: failureBlock) 

之前使用RevMob或對如何解決任何想法時,有沒有人有這個錯誤?由於

,我得到的錯誤: Error Getting Thrown

回答

4

你可能會使用新的Xcode和雨燕3.0。 Objective-C如何被轉換爲swift有一些變化。

你只需要改變從我們有我們的文檔中這個errorBlock代碼:

let errorBlock: ((Error?) -> Void)! = {error in // <== only this line changed 
    // check the error 
    print(error) 
} 

和參數名稱添加到startSession電話:

RevMobAds.startSession(withAppID: "<YOUR_APP_ID>", // only this line changed 
             withSuccessHandler: completionBlock, 
             andFailHandler: errorBlock);