获取当前线程的栈调度信息:
NSMutableDictionary *libProperties = [[NSMutableDictionary alloc] init];
NSArray *syms = [NSThread callStackSymbols];
if ([syms count] > 2) {
NSString *trace = [syms objectAtIndex:2];
NSRange start = [trace rangeOfString:@"["];
NSRange end = [trace rangeOfString:@"]"];
if (start.location != NSNotFound && end.location != NSNotFound && end.location > start.location) {
NSString *trace_info = [trace substringWithRange:NSMakeRange(start.location+1, end.location-(start.location+1))];
NSRange split = [trace_info rangeOfString:@" "];
NSString *class = [trace_info substringWithRange:NSMakeRange(0, split.location)];
NSString *function = [trace_info substringWithRange:NSMakeRange(split.location + 1, trace_info.length-(split.location + 1))];
NSString *detail = [NSString stringWithFormat:@"%@##%@####", class, function];
[libProperties setValue:detail forKey:@"detail"];
}
}