2016-09-19 4 views
10

ios8.3で実行されますが、ios9または10で実行される場合はこの問題はありません。[CIContext initWithOptions:]:認識できないセレクタがxcode8のインスタンス0x170400960に送信

-[CIContext initWithOptions:]: unrecognized selector sent to instance 0x170400960 
2016-09-19 18:08:21.025 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CIContext initWithOptions:]: unrecognized selector sent to instance 0x170400960' 
*** First throw call stack: 
(0x186d8c2d8 0x1985b00e4 0x186d933a4 0x186d90154 0x186c92ccc 0x1001c1e74 0x1001c1b7c 0x1001c143c 0x1001c1cfc 0x100311e0c 0x1003116d0 0x1001d7690 0x101f3025c 0x101f2fc08 0x101eee29c 0x103db8fd4 0x103db8f94 0x103dbdc28 0x186d437f8 0x186d418a0 0x186c6d2d4 0x1904836fc 0x18b832fac 0x100401fd8 0x198c2ea08) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
+0

私は解決策がないと思っています... https://openradar.appspot.com/28200846 – Dmitriy

答えて

17

あなたはクラッシュレポートを見れば、Xcodeの8はそのObjective-Cの対応+ (CIContext *)contextWithOptions:(NSDictionary<NSString *,id> *)options;にスウィフト方法CIContext(options: [String : Any]?)を変換するいくつかの問題を持っているようです。

代わりに-[CIContext initWithOptions:]と認識されないセレクタとして変換されます。

@interface CIContext (Workaround) 

+ (CIContext *)yourprefix_contextWithOptions:(NSDictionary<NSString *, id> *)options; 

@end 

@implementation CIContext (Workaround) 

+ (CIContext *)yourprefix_contextWithOptions:(NSDictionary<NSString *, id> *)options { 
    return [CIContext contextWithOptions:options]; 
} 

@end 

は、その後、あなたのモジュールブリッジヘッダーでこのカテゴリをインポートし、1を使用して、元のCIContextのinitの呼び出しを置き換える:

一つの可能​​な回避策は、このようなObjective-Cのカテゴリを宣言することですこのカテゴリから。

これはXcodeアップデートで修正できるコンパイルの問題だと思います。その間、この回避策が役立ちます。

+0

これはまさに私が必要とするものです。 – Xingxing

関連する問題