admin管理员组文章数量:1410697
I was looking for a method to debug JavaScript in UIWebView and came across some articles about _enableRemoteInspector specifically
/
I could not get the example code to pile though. I keep getting a "No known class method for selecctor" error. Not just a warning.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Works
[NSClassFromString(@"WebView") performSelector:@selector(_enableRemoteInspector)];
//Won't pile
//[NSClassFromString(@"WebView") _enableRemoteInspector];
}
So I tried performSelector and that works and the debugger works as described.
But how do you pile it without resorting to performSelector?
I am running Xcode 4.2.1 and my project uses the iOS5 SDK.
I was looking for a method to debug JavaScript in UIWebView and came across some articles about _enableRemoteInspector specifically
http://atnan./blog/2011/11/17/enabling-remote-debugging-via-private-apis-in-mobile-safari/
I could not get the example code to pile though. I keep getting a "No known class method for selecctor" error. Not just a warning.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Works
[NSClassFromString(@"WebView") performSelector:@selector(_enableRemoteInspector)];
//Won't pile
//[NSClassFromString(@"WebView") _enableRemoteInspector];
}
So I tried performSelector and that works and the debugger works as described.
But how do you pile it without resorting to performSelector?
I am running Xcode 4.2.1 and my project uses the iOS5 SDK.
Share Improve this question asked Dec 29, 2011 at 10:13 MegasaurMegasaur 6368 silver badges20 bronze badges1 Answer
Reset to default 7This is due to the new Automatic Reference Counting (ARC) in iOS 5. The sample code you linked to makes an assumption that you're not using ARC.
If you weren't using ARC, [NSClassFromString(@"WebView") _enableRemoteInspector]
would simply produce a "method not found" warning (because the method isn't declared publicly).
However, for various reasons when you've got ARC enabled this warning bees an error. If you want it to pile without using performSelector
you'll need to disable ARC.
本文标签: javascriptiOS 5Compiling Private APIs for debuggingspecifically enableRemoteInspectorStack Overflow
版权声明:本文标题:javascript - iOS 5 - Compiling Private APIs for debugging - specifically _enableRemoteInspector - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745038993a2638962.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论