如何将一个UIKit类或方法标记为已弃用?

3

我正在使用iOS中的一个安全框架,但它不兼容UIDocumentInteractionController。 我希望其他开发人员在尝试使用此类时能收到警告。 我已尝试了以下方法,但并没有效果。 有什么想法吗?

MyApp.pch

#import <Availability.h>

#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import "UIDocumentInteractionController+JVAdditions.h"
#endif

UIDocumentInteractionController+Additions.h

#import <UIKit/UIKit.h>
@interface UIDocumentInteractionController ()

+ (UIDocumentInteractionController *)interactionControllerWithURL:(NSURL *)url __attribute__((deprecated));

@end
1个回答

4
#pragma GCC poison interactionControllerWithURL

注意没有冒号。Poison旨在与C语言符号一起使用,而不是Objective-C选择器。但是,在这里它将完成你所需的工作。(顺便说一下,该#pragma指令是在GCC中引入的,但clang也支持它。)

太棒了。谢谢你。 - Stavash

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接