IOS Parse 处理crash

void UncaughtExceptionHandler(NSException *exception) {
    
    
    NSArray *callStack = [exception callStackSymbols];
    NSString *reason = [exception reason];
    NSString *name = [exception name];
    NSString *str = [callStack componentsJoinedByString:@"\n"];
    NSString *content = [NSString stringWithFormat:@"%@%@%@",reason,name,str];
    
          
    
    NSString *phone =  [[NSUserDefaults standardUserDefaults] objectForKey:@"kUserDefaultLoginUserName"];
    
    NSData *data =  [content dataUsingEncoding:NSUTF8StringEncoding];
    
    NSDate *date = [NSDate date];
    
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    
    formatter.dateFormat=@"yyyy-MM-dd";
    
    NSString *nowDate  = [formatter stringFromDate:date];
    
    PFObject *crachObj = [PFObject objectWithClassName:@"log"];
    
    
    PFFile *file= [PFFile fileWithName:[NSString stringWithFormat:@"ios-impay-%@%@",nowDate,@".txt"] data:data];
    
    crachObj[@"logfile"] = file;
    crachObj[@"phonenumber"] = phone;
    [crachObj save];
    
    
}


你可能感兴趣的:(IOS Parse 处理crash)