Xcode7: How to send crash report in quick message

My little task is how to send a mail failure message? I do not know if this example is right or wrong.

Coding:

override func viewDidLoad() { super.viewDidLoad() func exceptionHandler(exception : NSException) { print("\n\n \(exception)") print("\n\n \(exception.callStackSymbols)") mailAcn() // SENDING MAIL ACTION WHEN EXCEPTION CAUGHT } NSSetUncaughtExceptionHandler(exceptionHandler) //Error: AC Function pointer cannot be formed from a local function captures context // Do any additional setup after loading the view, typically from a nib. } 

I follow this link, How to use NSSetUncaughtExceptionHandler to display an exception message in a UIView in Swift

Some unknown error. Please help me how to solve this?

0
ios swift mfmailcomposeviewcontroller
Sep 01 '16 at 7:22
source share
1 answer

mailAcn() means self.mailAcn() , i.e. it calls the instance method on self . Thus, the function captures the variable self from the surrounding area and cannot be used as a function of C.

Instead, you can make mailAcn a top-level function.

0
Sep 04 '16 at 21:13
source share



All Articles