6

迁移到 IOS 8 和 XCODE 6 后,MWPhoto 库出现问题。错误发生在 PSTCollectionView 类中。我想知道为什么它会返回Missing context for method declaration错误。您可以在下面找到错误的代码和图像。

#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

在此处输入图像描述

4

1 回答 1

9

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

于 2014-09-19T19:00:04.383 回答