I get a 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
for a object defined in a swift Dictionary
let apiOptions:Dictionary<String,Any> = [
"options.push.enabled": false,
"options.debuglevel": 4,
]
that I pass to a Objective-C
library, that does like
if ([options objectForKeyNotNull:@"options.push.enabled"]) {
pushEnabled = [[options objectForKey:@"options.push.enabled"] boolValue];
}
if ([options objectForKeyNotNull:@"options.debuglevel"]) {
debugLevel = [[options objectForKey:@"options.debuglevel"] intValue];
}
In the stack trace I have like
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
so it seems that the options
object, defined in swift
as a Dictionary
has no selector objectForKeyNotNull
.
[UPDATE]
It seems that I cannot load ObjC categories like the objectForKeyNotNull
here:
#import <Foundation/Foundation.h>
@interface NSDictionary (MXMExtensions)
- (id)objectForKeyNotNull:(id)aKey;
@end
@interface NSData (EOUtil)
- (NSData*)dataByHmacSHA1EncryptingWithKey:(NSData*)key;
@end
even if it has its public header defined.
The same happens with another category:
2017-07-14 15:10:21.059117+0200 Adding-Content-to-Apple-Music[2075:560878] +[UIDevice platformString]: unrecognized selector sent to class 0x1b13b1b98
that it is
@implementation UIDevice (Hardware)
//...
+ (NSString *)platformString {
//...
}
In a Xcode/ObjC project I would normally set the Other Linker Flags to -ObjC
, but in a Xcode/Swift project with a ObjC Framework linked, this seems not to work properly.