我有一个要迁移到WatchOS 2.0的WatchKit扩展项目,由于某些原因,在迁移之后,我收到了一个编译器错误,指出NSTextAttachment是一个未知类型。我不确定这是不是Xcode7的一个bug。它在Xcode6和WatchOS 1中工作得很好,只是所有涉及到NSTextAttachment的东西都给我带来了这个问题。它是不是在WatchOS 2.0或其他版本中不可用?
以下代码:
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];导致错误的结果:
Unknown type name 'NSTextAttachment'; did you mean 'NSTextAlignment'?
Use of undeclared identifier 'NSTextAttachment'像NSAttributedString之类的其他东西都可以工作。
发布于 2016-09-26 16:41:52
您遇到的错误不是bug。实际上,WatchOS不支持NSTextAttachment,坏消息是,这个问题没有合适的替代解决方案。
https://stackoverflow.com/questions/32420980
复制相似问题