Tried to create a NSDictionary in Uno. I’m unsure how to do this, so I tried this in extern string:
var nsdict_id = extern <ObjC.ID>"@{@\"CBCentralManagerScanOptionAllowDuplicatesKey\" : [NSNumber numberWithBool:YES]}";
After making sure it is a .mm file with the .uxl file.
Generating code and data
SetMe.uno(20,1): E3356: '@"CBCentralManagerScanOptionAllowDuplicatesKey"' could not be resolved
SetMe.uno(20,1): E6117: '@"CBCentralManagerScanOptionAllowDuplicatesKey":[NSNumber numberWithBool' cannot be chained because it does not return anything
(4,203.20 ms)
The problem is that @{whatever} is how we do UXL macros, so you’d need to escape this somehow (I’m not entirely sure how you’d do that).
Alternatively, you could just use the ObjC bindings. Here’s a helper-method we use internally, it could probably be a bit more generic, but this was sufficient for my needs:
static internal NSDictionary ToNSDictionary(Dictionary<INSCopying, ObjC.ID> dict)
{
var ret = new NSMutableDictionary(NSMutableDictionary._dictionaryWithCapacity((uint)dict.Count));
foreach (var e in dict)
ret.setObjectForKey(e.Value, e.Key);
return ret;
}
I am experiencing similar problem as I am unable to build preview for iOS with barcode scanner library added.
MTBBarcodeScanner.mm(417.1): E3356: 'AVVideoCodecKey' could not be resolved
MTBBarcodeScanner.mm(642.1): E3356: 'NSLocalizedDescriptionKey' could not be resolved
MTBBarcodeScanner.mm(654.1): E3356: 'NSLocalizedDescriptionKey' could not be resolved
I get these errors when trying to build.
The lines that I am unable to escape with a backslash in front
self.stillImageOutput.outputSettings = @{AVVideoCodecKey: AVVideoCodecJPEG};
userInfo:@{NSLocalizedDescriptionKey : @"Still image capture is already in progress. Check with isCapturingStillImage"}];
userInfo:@{NSLocalizedDescriptionKey : @"AVCaptureConnection is closed"}];