Signature of a objective-c function i've used in the past is:
- (MMCall *)getLocalizedAppCategoriesWithOptions:(MMOptions *)options
success:(void (^)(NSArray *response))success
failure:(void (^)(NSError *error))failure;
I use to call it as -
[[whateverclassname new] getLocalizedAppCategoriesWithOptions:nil
success:^(NSArray *response) {
} failure:[^(NSError *error) {
}
It returns an NSArray of objects. These objects' parent class is NSObject and they have few properties. While experimenting with swift, i updated the bridging header file with the respective header file. Issues are -
If I call it following way, i get compile error as "'[AnyObject]' is not identical to 'NSArray'"
whateverclassname().getLocalizedAppCategoriesWithOptions(nil, success: {(response : NSArray!) in }, failure: {(error: NSError!) in })
If I call it following way, it compiles successfully but app crashes at runtime -
whateverclassname().getLocalizedAppCategoriesWithOptions(nil, success: {(response : [AnyObject]!) in }, failure: {(error: NSError!) in })
Please help me find out what's wrong with this?