mNo edit summary |
|||
Line 1: | Line 1: | ||
== Printing Ivars == | |||
Often just typing <tt>*varName</tt> works: | Often just typing <tt>*varName</tt> works: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
Line 16: | Line 16: | ||
["isa","_delegate","_touchMap","_exclusiveTouchWindows","_event",... | ["isa","_delegate","_touchMap","_exclusiveTouchWindows","_event",... | ||
</source> | </source> | ||
You may use this function to get as much ivar values as possible: | You may use this function to get as much ivar values as possible: | ||
Line 30: | Line 32: | ||
== Printing Methods == | |||
Function to get the methods: | Function to get the methods: | ||
Line 55: | Line 57: | ||
</source> | </source> | ||
== | == Getting Objective-C Objects from Addresses == | ||
Use <tt>new Instance(0xdeadbabe)</tt>. | |||
<source lang="javascript"> | |||
cy# var p = new Instance(0x8614390) | |||
cy# p | |||
["<SKPaymentTransaction: 0x8613d80>"] | |||
</source> |
Revision as of 11:59, 3 November 2009
Printing Ivars
Often just typing *varName works:
cy# *controller
{isa:"PrefsRootController",_contentView:"<UIView: 0x10bd70; frame = (0 0; 320 460); autoresize = W+H; layer = <CALayer: 0x150120>>",_navBar:...
cy#
Sometimes it does not...
cy# *UIApp
{message:"hasProperty callback returned true for a property that doesn't exist.",name:"ReferenceError"}
then you can do:
cy# [i for (i in *UIApp)]
["isa","_delegate","_touchMap","_exclusiveTouchWindows","_event",...
You may use this function to get as much ivar values as possible:
function tryPrintIvars(a){ var x={}; for(i in *a){ try{ x[i] = (*a)[i]; } catch(e){} } return x; }
To use:
cy# *a
{message:"hasProperty callback returned true for a property that doesn't exist.",name:"ReferenceError"}
cy# tryPrintIvars(a)
{isa:"SBWaveView",_layer:"<CALayer: 0x2a5160>",_tapInfo:null,_gestureInfo:null,_gestureRecognizers:...
Printing Methods
Function to get the methods:
function printMethods(className) {
var count = new new Type("I");
var methods = class_copyMethodList(objc_getClass(className), count);
var methodsArray = [];
for(var i = 0; i < *count; i++) {
var method = methods[i];
methodsArray.push({selector:method_getName(method), implementation:method_getImplementation(method)});
}
free(methods);
free(count);
return methodsArray;
}
Usage:
cy# printMethods("MailboxPrefsTableCell")
[{selector:@selector(layoutSubviews),implementation:0x302bf2e9},{selector:@selector(setCurrentMailbox:),implementation:0x302bee0d},...
cy#
Getting Objective-C Objects from Addresses
Use new Instance(0xdeadbabe).
cy# var p = new Instance(0x8614390)
cy# p
["<SKPaymentTransaction: 0x8613d80>"]