我得到SwiftDeferredNSDictionaryVs11AnyHashableP__ objectForKeyNotNull:
2017-07-14 12:52:58.138873+0200 Adding-Content-to-Apple-Music[1954:511529] -[_TtGCs26_SwiftDeferredNSDictionaryVs11AnyHashableP__ objectForKeyNotNull:]: unrecognized selector sent to instance 0x1c02239c0
用于在快速Dictionary
let apiOptions:Dictionary<String,Any> = [
"options.push.enabled": false,
"options.debuglevel": 4,
]
我传递给Objective-C
库,类似于
if ([options objectForKeyNotNull:@"options.push.enabled"]) {
pushEnabled = [[options objectForKey:@"options.push.enabled"] boolValue];
}
if ([options objectForKeyNotNull:@"options.debuglevel"]) {
debugLevel = [[options objectForKey:@"options.debuglevel"] intValue];
}
在堆栈跟踪中我喜欢
0x1033b1da4 <+316>: ldr x20, #0xa1074 ; "objectForKeyNotNull:"
0x1033b1da8 <+320>: adr x2, #0x7f718 ; @"options.push.enabled"
0x1033b1dac <+324>: nop
0x1033b1db0 <+328>: mov x1, x20
0x1033b1db4 <+332>: bl 0x1033f91f0 ; symbol stub for: objc_msgSend
0x1033b1db8 <+336>: mov x29, x29
0x1033b1dbc <+340>: bl 0x1033f9238 ; symbol stub for: objc_retainAutoreleasedReturnValue
0x1033b1dc0 <+344>: mov x21, x0
因此,options
swift
中定义的Dictionary
对象似乎没有选择器objectForKeyNotNull
。
[UPDATE]
我似乎无法加载像objectForKeyNotNull
这样的ObjC类别:
#import <Foundation/Foundation.h>
@interface NSDictionary (MXMExtensions)
- (id)objectForKeyNotNull:(id)aKey;
@end
@interface NSData (EOUtil)
- (NSData*)dataByHmacSHA1EncryptingWithKey:(NSData*)key;
@end
即使它定义了公共标题。
另一个类别也是如此:
2017-07-14 15:10:21.059117+0200 Adding-Content-to-Apple-Music[2075:560878] +[UIDevice platformString]: unrecognized selector sent to class 0x1b13b1b98
它是
@implementation UIDevice (Hardware)
//...
+ (NSString *)platformString {
//...
}
在Xcode / ObjC项目中,我通常会将其他链接器标志设置为-ObjC
,但在与ObjC Framework链接的Xcode / Swift项目中,这似乎无法正常工作