Showing posts with label hidden. Show all posts
Showing posts with label hidden. Show all posts

Monday, March 7, 2016

Listening to all the notifications in your app

Sometimes you need to use other peoples code, sometimes you don't get to see their code (eg frameworks). Sometimes you want / need to see what is happening under the covers.

Here is a nice link that shows how to do it.
http://samjarman.co.nz/blog/quick-tip-listen-to-all-the-notifications/

in short;
NSNotificationCenter *notifyCenter = [NSNotificationCenter defaultCenter];
[notifyCenter addObserverForName:nil
object:nil
queue:nil
usingBlock:^(NSNotification* notification){
// Explore notification
NSLog(@"Notification found with:"
"\r\n name: %@"
"\r\n object: %@"
"\r\n userInfo: %@",
[notification name],
[notification object],
[notification userInfo]);
}];

Wednesday, October 7, 2015

Reveal app shows more UI details than xcode

Reveal is an app that you can get (from here) that can take a snapshot of your running app and show all the items that are in it, even if they are hidden or in the background. xcode does have "debug view hierarchy" that does a pretty good job but if you need more detail than that, reveal is for you.

In the latest xcode (7) there is a bit of a connection problem. Specifically with the plugin as it was made for xcode 5 it seems. So to manually get reveal connected to your simulation, you can pause the app while it is running and run the command in the debug commands (lldb);

expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);

expr [(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];


continue;

You might need to enter each line one at a time for it to work. 

After that, you should be able to goto the reveal app, attach it to the simulator and hit the refresh button and tada!