Finding From Where A Method Is Being Called  

The linked SO post has a nice method for logging where an Objective-C method is being called from. Simple but helpful.

    NSString *sourceString = [[NSThread callStackSymbols] objectAtIndex:1];
    // Example: 1   UIKit                               0x00540c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
    NSCharacterSet *separatorSet = [NSCharacterSet characterSetWithCharactersInString:@" -[]+?.,"];
    NSMutableArray *array = [NSMutableArray arrayWithArray:[sourceString  componentsSeparatedByCharactersInSet:separatorSet]];
    [array removeObject:@""];

    NSLog(@"Stack = %@", [array objectAtIndex:0]);
    NSLog(@"Framework = %@", [array objectAtIndex:1]);
    NSLog(@"Memory address = %@", [array objectAtIndex:2]);
    NSLog(@"Class caller = %@", [array objectAtIndex:3]);
    NSLog(@"Function caller = %@", [array objectAtIndex:4]);
 
0
Kudos
 
0
Kudos

Now read this

Possible Future macOS Names

Just for funnies. Others have done this as well before We’ve had: Maverics Yosemite El Capitan Sierra Criteria as I see them # In California Natural Feature or Area Proper name. Has to sound good when spoken. Well known, or famous within... Continue →