0

I have following API in Objective C declared in protocol:

-(id)decodeData:(NSData *)data inType:(Class)className error:(NSError **)error; 

Now, I have implemented a class in Swift that implements ObjC protocol as below:

@objc class XMLDeserializer: NSObject, IDeserializer { @objc func decodeData(data: NSData!, inType className: AnyClass!) throws -> AnyObject { } } 

Now, my Swift class method is called from within the Objective C class as a part of protocol method calling. But, it is NOT Called.

What could be the reason?

Update:

I have my Communicator class where I have the serializer property in it. When I give my custom serializer object to that property, it is expected that it will call the protocol method (when the success response will come) as described above.

From my communicator class, below is the code how I call my protocol method:

responseObject = [self.responseSerializer decodeData:dataToDeserialize inType:self.responseType error:&err]; 

I have checked and printed the output in console from NSData in Comms Class, to verify that I am getting the successful response.

Only concern is that, my custom serializer is plugged into communicator and then also, my protocol method is not getting called.

I found similar question: LINK but that didn't solved my problem because passing MyClass.self will append the module name in that argument.

Let me know if more information is needed.

11
  • How do you expect it to be called? Who is calling the method? Commented Sep 5, 2015 at 18:21
  • 1
    What are the exclamation marks for? Commented Sep 5, 2015 at 18:23
  • what use of that throws keyword here? Commented Sep 5, 2015 at 18:24
  • show the code how did you call this method in ObjectiveC. Commented Sep 5, 2015 at 18:26
  • How do you know any empty method isn't called? Commented Sep 5, 2015 at 20:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.