Reputation: 27133
self.mapper.identityIdsForQuickbloxUserIds(userIDs.map{($0 as! NSNumber).unsignedLongValue}, completion: { identityIdsMapping, error in
Cannot convert call result type '_?' to expected type '[UInt]'
userIDs
is NSSet
and here is a function:
func identityIdsForQuickbloxUserIds(userIds:[UInt], completion:(identityIdsMapping:[UInt: String]?, error:NSError?) -> Void)
how to convert it in a right way?
This is external function which return for me that set:
- (void)allDialogsWithPageLimit:(NSUInteger)limit
extendedRequest:(QB_NULLABLE NSDictionary *)extendedRequest
iterationBlock:(void(^QB_NULLABLE_S )(QBResponse *QB_NONNULL_S response, NSArray QB_GENERIC(QBChatDialog *) *QB_NULLABLE_S dialogObjects, NSSet QB_GENERIC(NSNumber *) * QB_NULLABLE_S dialogsUsersIDs, BOOL * QB_NONNULL_S stop))iterationBlock
completion:(void(^QB_NULLABLE_S)(QBResponse * QB_NONNULL_S response))completion;
As you see we got that NSSet from here:
NSSet QB_GENERIC(NSNumber *) * QB_NULLABLE_S dialogsUsersIDs
that method is from QuickBlox SDK
Upvotes: 3
Views: 1940
Reputation: 1980
userIDs
is optional Set<NSNumber>?
not Set<NSNumber>
so you need unwrap if first with something like this
var ids = userIDs?.map { $0.unsignedLongValue } ?? [UInt]()
...
identityIdsForQuickbloxUserIds(ids, ...)
Upvotes: 1
Reputation: 17695
Example 1:
Here is a simple example:
identityIdsForQuickbloxUserIds([1,2,3]) { dictionary, error in
}
Example 2:
let x = NSSet(array: [1, 2, 3]).map { $0 as! UInt }
identityIdsForQuickbloxUserIds(x) { dictionary, error in
}
Upvotes: 1