ios 프로그램이 실행 중인 이상을 지정한 메일박스로 보내기

1297 단어 iOS
 appdelegate.m  
void UncaughtExceptionHandler(NSException *exception)
{
    /**
     *   
     */
    NSArray *callStack = [exception callStackSymbols];
    NSString *reason = [exception reason];
    NSString *name = [exception name];
    NSString *content = [NSString stringWithFormat:@"======== ========
name:%@
reason:
%@
callStackSymbols:
%@",name,reason,[callStack componentsJoinedByString:@"
"]]; /** * */ NSMutableString *mailUrl = [NSMutableString string]; [mailUrl appendString:@"mailto:[email protected]"]; [mailUrl appendString:@"?subject= , , !"]; [mailUrl appendFormat:@"&body=%@", content]; // NSString *mailPath = [mailUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mailPath]]; }

동시에
didFinishLaunchingWithOptions에 다음 코드를 추가하면 됩니다.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   //Override point for customization after application launch.
    
    NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler);
   //………
}

좋은 웹페이지 즐겨찾기