【问题标题】:Get file metadata after opening in app在应用中打开后获取文件元数据
【发布时间】:2016-02-11 06:49:24
【问题描述】:

我正在使用 AppDelegate 在我的应用中打开文件(目前仅 PDF)

application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options. 

如何获取文件的元数据,例如标题、作者、内容创建者?我可以使用

获取 NSFileCreationDate、NSFileExtensionHidden 等数据
[[NSFileManager defaultManager] attributesOfItemAtPath:[url path] error:&error];

【问题讨论】:

  • 请粘贴整个代码块。

标签: ios objective-c metadata nsfilemanager


【解决方案1】:

尝试使用MTPDF。请在以下位置找到它:https://github.com/mysterioustrousers/MTPDF

MTPDF *pdf = [MTPDF PDFWithContentsOfURL:[NSURL URLWithString:strURL]];
NSLog(@"%@\n%@\n%@\n%@\n%@\n%@\n%@",pdf.title, pdf.version, pdf.author, pdf.creator, pdf.subject, pdf.creationDate, pdf.modifiedDate);

我用过,很好用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多