I want to know if it is possible to intercept all the text that is being displayed on the screen of iPhone or iP开发者_JAVA百科ad. We want to collect all common wording used on mobile devices. If anyone can help please let me know.
No, this is not possible. There are two major ways that text is drawn in iOS, WebKit and Core Text. You'd need to hijack calls into these (and in the case of WebKit, hijack its internal data structures). There's no practical way to attack that, even within your own programs (let alone trying to do it at the system level). I don't even believe there'd be a practical way to attack this on a jailbroken device.
I'm having some difficulty imagining the practical use case of this information, but if it were sufficiently valuable, I would hire someone to take screenshots by hand and OCR them.
I'm not sure I understand your question. You mean the text displayed on EVERY application? The answer for that would be no.
If you wanted to read every UILabel
text in your own application, you could go through the view hierarchy recursively and detect every UILabel
. Example:
- (void)printLabelTextsRecursive:(UIView *)view {
if ([view isKindOfClass:[UILabel class]]) {
NSLog(@"Label: %@", ((UILabel *)(view)).text)
} else {
for (UIView *subView in view.subViews) {
[self printLabelTextsRecursive:subView];
}
}
}
and call it with your UIWindow
in the AppDelegate
class, for instance:
[self printLabelTextsRecursive:self.window];
well, there is no way to do that for unjailbroken iphones as every app is started in its own sandbox. apps can't communicate with each other.
For jailbroken iphones, there might be a way. just think of apples voice over - it reads everything the user touches. so there MUST be a way. what might help you:
- http://chrisalvares.com/blog/?p=7 (a guide about how to create a daemon on a jailbroken iphone)
- have a look at the private frameworks of ios - there are a few starting with "screenreader". You can have a look at their headers by using class-dump-z.
精彩评论