加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – 在IOS 8中为MWPhotoBrowser丢失方法声明的上下文

发布时间:2020-12-14 19:45:10 所属栏目:百科 来源:网络整理
导读:移动到 IOS 8和XCODE 6后,我遇到了MWPhoto库的问题.在PSTCollectionView类中发生错误.我想知道为什么它返回我缺少方法声明错误的上下文.您可以在下面找到错误的代码和图像. #import objc/runtime.h- (NSMethodSignature *)methodSignatureForSelector:(SEL)s
移动到 IOS 8和XCODE 6后,我遇到了MWPhoto库的问题.在PSTCollectionView类中发生错误.我想知道为什么它返回我缺少方法声明错误的上下文.您可以在下面找到错误的代码和图像.

#import <objc/runtime.h>
- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {
    NSMethodSignature *signature = [super methodSignatureForSelector:selector];
    if (!signature) {
        NSString *selString = NSStringFromSelector(selector);
        if ([selString hasPrefix:@"_"]) {
            SEL cleanedSelector = NSSelectorFromString([selString substringFromIndex:1]);
            signature = [super methodSignatureForSelector:cleanedSelector];
        }
    }
    return signature;
}

- (void)forwardInvocation:(NSInvocation *)invocation {
    NSString *selString = NSStringFromSelector([invocation selector]);
    if ([selString hasPrefix:@"_"]) {
        SEL cleanedSelector = NSSelectorFromString([selString substringFromIndex:1]);
        if ([self respondsToSelector:cleanedSelector]) {
            invocation.selector = cleanedSelector;
            [invocation invokeWithTarget:self];
        }
    }else {
        [super forwardInvocation:invocation];
    }
}

@end

解决方法

我从github更新PSTCollectionView,现在工作正常
https://github.com/steipete/PSTCollectionView

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读