2016-07-14 46 views

risposta

0

Si può fare ad esempio con https://github.com/williamFalcon/SwiftTryCatch. In primo luogo aggiungerlo al tuo Podfile:

use_frameworks! 
pod 'SwiftTryCatch' 

Poi nel codice import SwiftTryCatch e quindi è possibile intercettare le eccezioni Objective-C come questo

SwiftTryCatch.try({ 
    // try block 
}, catch: { (error) in 
    // catch block 
}, finally: { 
    // finally block 
})