Given the example objective C protocol below:
@protocol testp
- (void)testMethod:(struct {int a;})arg1 reply:(void (^)(NSError *))arg2;
@end
Assuming I've already setup the protocol connection. How can I call the method? The issue is the struct type, I'm familiar with passing basic arguments like int
or NSString
, however I'm unsure how to handle the unnamed struct in the protocol.
If I use:
struct { int a; } test = {1};
[p testMethod:test reply:^(NSError* error ){
NSLog(@"error: %@", error);
}];
I get the following error:
error: sending 'struct (unnamed struct at .. to parameter of incompatible type 'struct (unnamed struct at ..