为什么我的NSLog信息会覆盖自己/被截止?

时间:2018-01-08 16:36:23

标签: ios objective-c nslog

请考虑以下代码:

- (void)printAssetData {    
    PHFetchResult<PHAsset *> *allAssets = [PHAsset fetchAssetsWithOptions:nil];

    for (PHAsset *asset in allAssets) {        
        NSLog(@"localIdentifier:%@, creationDate:%@, pixelWidth:%ld, pixelHeight:%ld", asset.localIdentifier, asset.creationDate, asset.pixelWidth, asset.pixelHeight);
    }
}

当我在我的个人设备上运行时(有数千张图片/视频),这就是输出:

2018-01-08 11:30:43.496875-0500 testapp[83752:9722498] localIdentifier:D2349261-B3DF-445D-97C5-17D0B0DEEE37/L0/001, creationDate:Thu Dec 22 17:08:50 2011, pixelWidth:1936, pixelHeight:2592
2018-01-08 11:30:43.496925-0500 testapp[83752:9722498] localIdentifier:9F14665C-0E43-4BE3-BEC5-DE401FE2131D/L0/001, creationDate:Thu Dec 22 17:09:42 2011, pixelWidth:1936, pixelHeight:2592
2018-01-08 11:30:43.496950-0500 testapp[83752:9722498] localIdentifier:746158A9-C6D6-4F6B-83EA-2B3B2F2CEF5B/L0/001, creationDate:Fri Dec 23 01:36:44 2011, pixelWidth:1936, pixelHeight:2592
2018-01-08 11:30:43.496973-0500 testapp[83752:9722498] localIdentifier:301A7472-89BD-4571-9672-AF8F49E97959/L0/001, creationDate:Fri Dec 23 01:36:48 2011, pixelWidth:1936, pixelHeight:2592
2018-01-08 11:30:43.496996-0500 testapp[83752:9722498] localIdentifier:29149949-9F72-4D5F-8CE4-FC22EAEE7661/L0/001, creationDate:Fri Dec 23 01:37:25 2011, pixelWidth:1936, pixelHeight:2592
ly[83752:9722498] localIdentifier:6B4B893A-E517-452D-972C-82354D93EA1C/L0/001, creationDate:Fri Dec 23 01:53:12 2011, pixelWidth:1936, pixelHeight:2592
2018-01-08 11:30:43.500454-0500 testapp[83752:9722498] localIdentifier:878CE7A8-E218-452B-AF0F-8F6589347235/L0/001, creationDate:Sun Dec 25 20:19:46 2011, pixelWidth:1936, pixelHeight:2592
2018-01-08 11:30:43.500488-0500 testapp[83752:9722498] localIdentifier:9F4B5249-C3B1-42C1-836C-64A83B485641/L0/001, creationDate:Thu Dec 29 00:02:47 2011, pixelWidth:1936, pixelHeight:2592
2018-01-08 11:30:43.500513-0500 testapp[83752:9722498] localIdentifier:5A812FE1-61ED-4026-859E-2439795442C3/L0/001, creationDate:Thu Dec 29 13:53:50 2011, pixelWidth:1936, pixelHeight:2592
2018-01-08 11:30:43.500536-0500 testapp[83752:9722498] localIdentifier:278508D3-14AE-477C-92E4-7711CB2EC4D8/L0/001, creationDate:Thu Dec 29 16:04:29 2011, pixelWidth:1936, pixelHeight:2592
...

一开始看起来很棒,但是对于第6张图片(带有本地标识符值6B4B893A-E517-452D-972C-82354D93EA1C/L0/001),它会切断并格式化错误。在这种情况下,只有时间戳被切断,但在其他示例中,例如:

...
2018-01-08 11:30:43.573010-0500 testapp[83752:9722498] localIdentifier:DACB34B1-59B0-4CFE-BB40-E39AEB507E0F/L0/001, creationD2018-01-08 11:30:43.573032-0500 testapp[83752:9722498] localIdentifier:38C58C59-41B8-4240-AAAB-B7C2A7C10B34/L0/001, creationDate:Fri Mar  1 19:01:23 2013, pixelWidth:2448, pixelHeight:3264
...

日志语句本身被下一个语句截断/覆盖。

0 个答案:

没有答案