是否可以阅读特定于应用程序的警告消息?
Is it possible to read app specific warning messages?
我想阅读我的应用程序的控制台。我的目标是找到所有这样的消息:
Warning: Attempt to present <ChildViewController: 0x7b44e380> on <TopViewController: 0x7a65e5b0> which is already presenting (null)
我发现在 iOS7 上您无法阅读系统消息。
Using Objective C to read log messages posted to the device console
In iOS 7 you can use ASL to read messages output by your own app, including on previous runs of the same build of your app, but not messages output by the system or by any other apps.
在我看来,任何警告都是系统消息。 ios8 上可能有什么变化?
可以从 "syslog.sock" 读取。 Github 上的源代码在 iOS8 下工作:https://github.com/eswick/ondeviceconsole
从 iOS7 起,ASL 不再适用于系统范围的日志,iOS 由于沙盒增加,7+ 应用程序只能看到自己的日志消息。
如果您只想查看自己应用的日志,您仍然可以使用 ASL:
aslmsg q, m;
int i;
const char *key, *val;
q = asl_new(ASL_TYPE_QUERY);
aslresponse r = asl_search(NULL, q);
while (NULL != (m = aslresponse_next(r)))
{
NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
for (i = 0; (NULL != (key = asl_key(m, i))); i++)
{
NSString *keyString = [NSString stringWithUTF8String:(char *)key];
val = asl_get(m, key);
NSString *string = val?[NSString stringWithUTF8String:val]:@"";
[tmpDict setObject:string forKey:keyString];
}
NSLog(@"%@", tmpDict);
}
aslresponse_free(r);
我想阅读我的应用程序的控制台。我的目标是找到所有这样的消息:
Warning: Attempt to present <ChildViewController: 0x7b44e380> on <TopViewController: 0x7a65e5b0> which is already presenting (null)
我发现在 iOS7 上您无法阅读系统消息。
Using Objective C to read log messages posted to the device console
In iOS 7 you can use ASL to read messages output by your own app, including on previous runs of the same build of your app, but not messages output by the system or by any other apps.
在我看来,任何警告都是系统消息。 ios8 上可能有什么变化?
可以从 "syslog.sock" 读取。 Github 上的源代码在 iOS8 下工作:https://github.com/eswick/ondeviceconsole
从 iOS7 起,ASL 不再适用于系统范围的日志,iOS 由于沙盒增加,7+ 应用程序只能看到自己的日志消息。
如果您只想查看自己应用的日志,您仍然可以使用 ASL:
aslmsg q, m;
int i;
const char *key, *val;
q = asl_new(ASL_TYPE_QUERY);
aslresponse r = asl_search(NULL, q);
while (NULL != (m = aslresponse_next(r)))
{
NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
for (i = 0; (NULL != (key = asl_key(m, i))); i++)
{
NSString *keyString = [NSString stringWithUTF8String:(char *)key];
val = asl_get(m, key);
NSString *string = val?[NSString stringWithUTF8String:val]:@"";
[tmpDict setObject:string forKey:keyString];
}
NSLog(@"%@", tmpDict);
}
aslresponse_free(r);