I am trying to build a flutter plugin for the Sendbird iOS SDK. For some reason whenever I try to fetch data, I get null from a NSDictionary<NSString *,NSObject *> when I know for a fact that it is not (I have created the keys and values separately).
Most likely it's the fact that being a beginner with Swift I am doing something wrong. This is my code:
let channelMetadata = NSMutableDictionary()
// metadata is the NSDictionary<NSString *,NSObject *>
channel.getAllMetaData{ (metaData, error) in
guard let metadata = metaData, error == nil else {
// Error.
return
}
channelMetadata["status"] = metadata["status"]
channelMetadata["type"] = metadata["type"]
}
js["status"] = channelMetadata["status"]
it's:
js["status"]
Which returns null. I assume this is because I am doing something wrong with the way I am populating my empty dictionary, but I don't know what, even after searching for hours. Any help would be really appreciated.