- (NSArray<NSString *> *)appDelegateMethods
{
static NSMutableArray *methods = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
unsigned int methodCount = 0;
// 获取UIApplicationDelegate协议所有协议方法
struct objc_method_description *methodList = protocol_copyMethodDescriptionList(@protocol(UIApplicationDelegate), NO, YES, &methodCount);
methods = [NSMutableArray arrayWithCapacity:methodCount];
for (int i = 0; i < methodCount; i ++)
{
struct objc_method_description md = methodList[i];
[methods addObject:NSStringFromSelector(md.name)];
}
free(methodList);
});
// 返回协议方法数组
return methods;
}