domesticcatsoftware / dcintrospect Goto Github PK
View Code? Open in Web Editor NEWSmall library of visual debugging tools for iOS.
Home Page: domesticcat.com.au/projects/introspect
License: MIT License
Small library of visual debugging tools for iOS.
Home Page: domesticcat.com.au/projects/introspect
License: MIT License
It is possible to use the +
and -
keys to set the alpha of a view to something like 1.20
or -0.20
.
I've had a dig through the code and am unable to think of a clean way to bring up the introspector when a UITextField currently has focus.
I've found a hacky way, whereby the introspector is invoked after a delay, though this also hides the keyboard when the introspector is brought up, which is a problem in some views as some of them listen to keyboard show / hide notifications.
Thoughts?
Btw, this is a great tool, and I use it all the time when adjusting views created programatically. Keep up the good work!
Has anyone got this working for iPad? I'm getting only a black screen with DCIntrospect on it.
... this would have been exactly what I was looking for ... but all my projects are with ARC :-(
Do you plan to make the modification?
I'm not sure if this is an issue with the library or my XCode installation, but my builds have been failing recently due to the DEBUGGER instruction on line 624 of DCIntrospect.m.
I receive 2 (duplicate) errors which say "Instruction requires: Not 64-bit mode".
After going into the background and foreground again, the space key isn't attached to DCIntrospect anymore.
No big deal but I wanted to let you know.
Thanks for an awesome debugging tool, it's so great it should be included in the Simulator by Apple from scratch!
It might be cool to update the readme to say you can add it with the following:
#ifdef TARGET_IPHONE_SIMULATOR
[[DCIntrospect sharedIntrospector] start];
#endif
Kinda handy. Just a thought.
It would be really nice if DCIntrospect could be fully disabled at compile time without removing the code from Xcode or performing other Xcode setting gymnastics.
We wrap DCIntrospect starting with:
[[DCIntrospect sharedIntrospector] start];
And even with this code disabled DCIntrospect still interfers with the Keyboard animations (see issue #9). It seems there are side effects to just including code in project (I imagine there's a +load somewhere loading code).
Just grabbed a copy of DCIntrospect. I tried compiling the demo example and run it on Xcode 4.0.2 with the iPhone 4.3 simulator. The example shows and I press the space bar to enter the introspection mode. Everything seems to work fine, but pressing ? to show the help screen crashes the application. The crash sometimes happens immediately, other times it seems to take a few seconds to trigger, but the backtrace is always the same:
#0 0x00000000 in ?? ()
#1 0x00003d71 in UITextInputTraits_valueForKey (self=0x8866800, _cmd=0x38c62b2, key=0x4f6f760) at DCIntrospect.m:87
#2 0x04b676bf in -[NSObject(UIAccessibilitySafeCategory) safeValueForKey:] ()
#3 0x04f22377 in -[UIWebDocumentViewAccessibility(SafeCategory) webView:didFinishLoadForFrame:] ()
#4 0x00ebbc7d in __invoking___ ()
#5 0x00ebbb51 in -[NSInvocation invoke] ()
#6 0x00ee9858 in -[NSInvocation invokeWithTarget:] ()
#7 0x00ebca04 in ___forwarding___ ()
#8 0x00ebc522 in __forwarding_prep_0___ ()
#9 0x00ebbc7d in __invoking___ ()
#10 0x00ebbb51 in -[NSInvocation invoke] ()
#11 0x036cf140 in HandleDelegateSource ()
#12 0x00f2c8ff in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#13 0x00e8a88b in __CFRunLoopDoSources0 ()
#14 0x00e89d86 in __CFRunLoopRun ()
#15 0x00e89840 in CFRunLoopRunSpecific ()
#16 0x00e89761 in CFRunLoopRunInMode ()
#17 0x01a921c4 in GSEventRunModal ()
#18 0x01a92289 in GSEventRun ()
#19 0x001abc93 in UIApplicationMain ()
#20 0x00002bc9 in main (argc=1, argv=0xbfffe758) at main.m:14
This is a very similar issue to the one discussed in #22. To reproduce, open the demo application and link against the MapKit.framework. Build and run. As soon as you try to type into a text field, the recursive bug happens again, this time with a UIFieldInput object. Here's a gdb trace from my own application which I caught setting a breakpoint and waiting for the recursion to happen:
(gdb) bt
#0 UITextInputTraits_valueForKey (self=0x6085600, _cmd=0x515edb4, key=0x5c70ce0) at DCIntrospect.m:79
#1 0x0000b421 in UITextInputTraits_valueForKey (self=0x6085600, _cmd=0x515edb4, key=0x5c70ce0) at DCIntrospect.m:87
#2 0x0000b421 in UITextInputTraits_valueForKey (self=0x6085600, _cmd=0x515edb4, key=0x5c70ce0) at DCIntrospect.m:87
#3 0x05cb56bf in -[NSObject(UIAccessibilitySafeCategory) safeValueForKey:] ()
#4 0x05c218f6 in -[UIWebDocumentViewAccessibility(SafeCategory) _accessibilityDocumentView] ()
#5 0x05c2122b in -[UIWebDocumentViewAccessibility(SafeCategory) _accessibilityRootObject] ()
#6 0x05c211ad in -[UIWebDocumentViewAccessibility(SafeCategory) accessibilityElementCount] ()
#7 0x05c191d4 in -[UITextFieldAccessibility(SafeCategory) _accessibilityCountAccessibleChildren:] ()
#8 0x05c19a5c in -[UITextFieldAccessibility(SafeCategory) _updateButtons] ()
#9 0x000ebcab in -[UITextField layoutSubviews] ()
#10 0x00d90a5a in -[CALayer layoutSublayers] ()
#11 0x00d92ddc in CALayerLayoutIfNeeded ()
#12 0x00d380b4 in CA::Context::commit_transaction ()
#13 0x00d39294 in CA::Transaction::commit ()
#14 0x00d3946d in CA::Transaction::observer_callback ()
#15 0x010cf89b in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#16 0x010646e7 in __CFRunLoopDoObservers ()
#17 0x0102d1d7 in __CFRunLoopRun ()
#18 0x0102c840 in CFRunLoopRunSpecific ()
#19 0x0102c761 in CFRunLoopRunInMode ()
#20 0x013261c4 in GSEventRunModal ()
#21 0x01326289 in GSEventRun ()
#22 0x0005dc93 in UIApplicationMain ()
#23 0x000027ff in main (argc=1, argv=0xbfffe818) at main.m:6
(gdb) f 2
#2 0x0000b421 in UITextInputTraits_valueForKey (self=0x6085600, _cmd=0x515edb4, key=0x5c70ce0) at DCIntrospect.m:87
87 return valueForKey(self, _cmd, key);
(gdb) po key
_webView
(gdb) po _cmd
0x515edb4 does not appear to point to a valid object.
(gdb) po self
<UIFieldEditor: 0x6085600; frame = (0 0; 173 28); text = ''; opaque = NO; layer = <UIWebLayer: 0xac21c00>>
(gdb)
Presumably the swizzling trick that was done for UITextField has to be done for the undocumented/private UIFieldEditor, but I don't know how to do that. Any help?
It seems that the hack enabling accessibility without the accessibility inspector in the simulator has very bad unintended side effects.
Setting the ApplicationAccessibilityEnabled
preference to true
in ~/Library/Application Support/iPhone Simulator/5.0/Library/Preferences/com.apple.Accessibility.plist
will change the behavior of UITableView
instances for all apps in the simulator in a very unexpected way.
The data source method - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
and the delegate method - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
will be called for all index paths, even for cells which are not visible when the app is totally idle! Deleting the ApplicationAccessibilityEnabled
preference restores the expected behavior of UITableView
.
Here are the relevant backtraces.
#0 -[TableViewController tableView:cellForRowAtIndexPath:] ()
#1 0x00444e0f in -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] ()
#2 0x004455d6 in -[UITableView(UITableViewInternal) _createPreparedCellForRowAtIndexPath:] ()
#3 0x0c96c0ad in -[UITableViewAccessibility(Accessibility) accessibilityCellForRowAtIndexPath:] ()
#4 0x0c97f60b in -[UITableViewCellAccessibilityElement tableViewCell] ()
#5 0x0c98012a in -[UITableViewCellAccessibilityElement isAccessibilityElement] ()
#6 0x0b774e24 in _appendChildrenToArrayStartingAtIndex ()
#7 0x0b774d3d in _addAXElementsToArrayFromObject ()
#8 0x0b774851 in _appendVendedAXElementsFromUIElements ()
#9 0x0b774774 in _createAXUIElementsFromUIElements ()
#10 0x0b773258 in _copyParameterizedAttributeValueCallback ()
#11 0x0b7aeea6 in _AXXMIGCopyParameterizedAttributeValue ()
#12 0x0b7a9853 in _XCopyParameterizedAttributeValue ()
#13 0x0b7b1e66 in mshMIGPerform ()
#14 0x014e61c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#15 0x0144b022 in __CFRunLoopDoSource1 ()
#16 0x0144990a in __CFRunLoopRun ()
#17 0x01448db4 in CFRunLoopRunSpecific ()
#18 0x01448ccb in CFRunLoopRunInMode ()
#19 0x01c07879 in GSEventRunModal ()
#20 0x01c0793e in GSEventRun ()
#21 0x003aba9b in UIApplicationMain ()
#0 -[TableViewController tableView:willDisplayCell:forRowAtIndexPath:] ()
#1 0x004454fe in -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] ()
#2 0x004455d6 in -[UITableView(UITableViewInternal) _createPreparedCellForRowAtIndexPath:] ()
#3 0x0c9db0ad in -[UITableViewAccessibility(Accessibility) accessibilityCellForRowAtIndexPath:] ()
#4 0x0c9ee60b in -[UITableViewCellAccessibilityElement tableViewCell] ()
#5 0x0c9ef12a in -[UITableViewCellAccessibilityElement isAccessibilityElement] ()
#6 0x0ca88e24 in _appendChildrenToArrayStartingAtIndex ()
#7 0x0ca88d3d in _addAXElementsToArrayFromObject ()
#8 0x0ca88851 in _appendVendedAXElementsFromUIElements ()
#9 0x0ca88774 in _createAXUIElementsFromUIElements ()
#10 0x0ca87258 in _copyParameterizedAttributeValueCallback ()
#11 0x0cac2ea6 in _AXXMIGCopyParameterizedAttributeValue ()
#12 0x0cabd853 in _XCopyParameterizedAttributeValue ()
#13 0x0cac5e66 in mshMIGPerform ()
#14 0x014e61c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#15 0x0144b022 in __CFRunLoopDoSource1 ()
#16 0x0144990a in __CFRunLoopRun ()
#17 0x01448db4 in CFRunLoopRunSpecific ()
#18 0x01448ccb in CFRunLoopRunInMode ()
#19 0x01c07879 in GSEventRunModal ()
#20 0x01c0793e in GSEventRun ()
#21 0x003aba9b in UIApplicationMain ()
Can anybody else confirm this?
Provide a keyboard action that will select the superview of the currently selected view.
TARGET_IPHONE_SIMULATOR is defined on the device, but set to false.
So instead of
[[DCIntrospect sharedIntrospector] start];
correct is:
[[DCIntrospect sharedIntrospector] start];
please ignore
I'm not really sure if this is possible, but it would be amazing if there was a key to break and enter gdb so you could adjust stuff like background color and such or do other tweaking.
Due to alleged errors with the valueForKey method such as "Too many arguments to function call, expected 0, have 3", around this line:
DCIntrospect/DCIntrospect/DCIntrospect.m
Line 127 in 9555122
XCode 5.1.1 refuses to compile this under iOS SDK 8.2 targeting iOS 7.0, after installing DCIntrospect 0.0.2 with cocoapods 0.37.2.
Any ideas?
I am working on a universal iPhone/iPad app and DCIntrospect is great for debugging and tweaking on the iPhone side of things, however it seems to completely not work so far on the iPad side. I haven't exactly looked too closely at what might be triggering this, but it would be great to have full iPad support.
Shake events don't propagate past the inputTextView to the rest of the application. To reproduce, implement a simple project with shake to undo support (like https://github.com/dcgrigsby/TallyTrucks), add DCIntrospect, then run and try to shake-to-undo in the simulator (Hardware -> Shake Gesture or ^โZ). Undo will not prompt.
To make it easier to read debug logs, add this category and make it so that when you tap on a view, it displays the tag name along with the class name. Also, the debug output should display these tags.
e.g.
[myview setNametag:@"My main view"]
when you tap on it, DCIntrospect should display "UIView - My main view {{0,0},{320,568}}" on the top status bar. Without this, you would only see "UIView" which is not helpful when you have many views and subviews!
Category code:
@interface UIView (NameTags)
@implementation UIView (NameTags)
// Nametag setter
// Return 'Class description : hex memory address'
TARGET_IPHONE_SIMULATOR is always defined, but its value is set to 1 or 0.
The correct way to do this is as follows:
[[DCIntrospect sharedIntrospector] start];
e.g. using IF instead of IFDEF
DCIntrospect.m Line 624:
Expanded from macro 'DEBUGGER' from the following:
else if ([string isEqualToString:kDCIntrospectKeysEnterGDB])
{
UIView *view = self.currentView;
view.tag = view.tag; // suppress the xcode warning about an unused variable.
NSLog(@"DCIntrospect: access current view using local 'view' variable.");
DEBUGGER;
return NO;
}
xcode 4.2
apple llvm compiler 3.0 fails
can u see that?
To make it easier to read debug logs, add this category and make it so that when you tap on a view, it displays the tag name along with the class name. Also, the debug output should display these tags.
e.g.
[myview setNametag:@"My main view"]
when you tap on it, DCIntrospect should display "UIView - My main view {{0,0},{320,568}}" on the top status bar. Without this, you would only see "UIView" which is not helpful when you have many views and subviews!
Category code:
@interface UIView (NameTags)
@implementation UIView (NameTags)
// Nametag setter
// Return 'Class description : hex memory address'
Just played around with DCIntrospect, looks great. It crashes when opening a UIPopoverController with an UITableViewController somehow.
There's a Stack Overflow in if ([textInputTraitsProperties containsObject:key]), DCIntrospect.m., Line 80
I'm on Xcode 4.1, iOS 4.3
Here's a Screenshot: http://cl.ly/2s2S3X1U11453I0v1019
Any ideas? Looks like swizzling gone wrong?
DCIntrospect is so cool but outdated. I created a version that now supports ARC, will feature Localization soon and various other bugfixes. If you want to contribute to actively develop this utility it would be awesome if you could contribute to DCIntrospect-ARC
If you want to work on it form pull request or write me a message, that I can add you to the team.
Let's get DCIntrospect up to date and make it even better ๐
It would be great to in one of the log options (or perhaps a new one) to log the accessibility info. This would make writing automated view tests much easier.
I've noticed when DCIntrospect is enabled, the keyboard will not animate in correctly. Also sometimes settings becomeFirstResponder
doesn't work or does work and the keyboard is not visible.
Not a huge deal, just noticing.
It seems that DCIntrospect does not support infinite value. I made a mistake with a UIView which frame had an infinite value in the frame, and when I was trying to use the framework my app seemed to freeze...
Hi,
at first let me thank you for great tools. While using it I found issue. Step to reproduce:
Regars
It would be great if when you press page up to look at a superview, if you could press page down and back to where you were before. Obviously pressing page down before pressing page up isn't really useful because you don't know which view is intended.
This feature would make things easier if you accidentally went to far and wanted to go back down.
Apparently when DCIntrospect is enabled the keyboard won't show at all for text fields inside UIWebView.
To reproduce:
result Keyboard won't show for the google text field.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.