Skip to content

AMFRemotingCall isn't differenciating between onResult and onStatus results #7

@schristmann

Description

@schristmann

Your code has been extremely helpful and is implemented really well, however we had to customize it a bit to handle status errors differently and thought you should know.
Inside AMFRemotingCall connectionDidFinish is the following line of code

AMFActionMessage *message = [[AMFActionMessage alloc] initWithData:m_receivedData];
AMFMessageBody *body = [message.bodies objectAtIndex:0];
objc_msgSend(m_delegate, @selector(remotingCallDidFinishLoading:receivedObject:), self, data);
[message release];

This code indiscriminately returns the user whatever the body of the message is without providing the context of the message. A body can either be an onResult or onStatus message, both of these messages will be fully encoded amf packets, but on onStatus usually means that an exception has been encoded as the body instead of the usual expected result. this was the solution we used, but you may have a better thought on how to accomplish it.

AMFActionMessage *message = [[AMFActionMessage alloc] initWithData:m_receivedData];
AMFMessageBody *body = [message.bodies objectAtIndex:0];
NSObject *data = [[message.bodies objectAtIndex:0] data];
NSRange range = [body.targetURI rangeOfString:@"onStatus"];
if (range.location != NSNotFound) {
    objc_msgSend(m_delegate, @selector(remotingCallOnStatus:receivedObject:),  self, data);
}else {
    objc_msgSend(m_delegate, @selector(remotingCallOnResult:receivedObject:), self, data);
}
[message release];

Sean

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions