【问题标题】:What header to include to use UTType in objective c?在目标 c 中使用 UTType 需要包含什么标头?
【发布时间】:2021-12-28 21:28:00
【问题描述】:

我有以下代码sn-p:

    NSString* filt = [NSString stringWithUTF8String:allowedExtensions[i].c_str()];
    UTType *type = [UTType typeWithIdentifier:filt];

我收到错误 'Receiver 'UTType' for class message is a forward declaration'。如果我理解这一权利,这意味着未正确包含 UTType。我需要包含什么文件才能正确声明它?我正在使用可可。我可以通过谷歌找到这方面的零信息。我正在使用 Xcode 13。我正在为 MacOS 开发。

此处列出的内容没有帮助:receiver type *** for instance message is a forward declaration

【问题讨论】:

标签: objective-c cocoa


【解决方案1】:

UTType 来自UniformTypeIdentifiers framework

@import UniformTypeIdentifiers;

#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>

两者是等价的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-15
    • 2020-09-09
    • 1970-01-01
    • 2016-10-10
    • 2013-08-01
    • 1970-01-01
    • 2011-12-26
    相关资源
    最近更新 更多