-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTL6a #193
RTL6a #193
Conversation
I'm getting errors after the #171:
@tcard Any thoughts? |
I can debug it later. |
@ricardopereira Seems like it's trying to decode a piece of JSON that is already decoded. The |
The test is publishing a dictionary. The existing
@tcard Should I open an issue? |
@ricardopereira Please. |
|
||
let restBlock: @convention(block) (AspectInfo, ARTMessage) -> Void = { info, message in | ||
let invocation = info.originalInvocation() | ||
invocation.invoke() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this aspects thing works, but if message
here is the original, unencoded message that is passed to encodeMessageIfNeeded
, take into account that ARTMessage.encode
returns a copy of the ARTMessage instance, and thus this message
won't be mutated by invocation.invoke()
, and you're assigning the unencoded version to restEncodedMessage
.
Ignore this if this message
is what's returned by encodeMessageIfNeeded
. (But then I don't understand what invocation.invoke()
is invoking.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invocation.invoke()
calls the original implementation, so the encodeWithEncoder
will write to the current ARTMessage
instance (look https://github.com/ably/ably-ios/blob/bff8f901b67e9ab12b38fa477470ed773ae0a902/ably-ios/ARTChannel.m#L54). Even so, I saw the documentation and I think it is possible to retrieve the original return value of the mehotd directly with the NSInvocation.getReturnValue. I think both approaches are correct. What you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That link shows how encodeWithEncoder
takes an output
argument, where it writes the new message, which is then a different instance than the message
passed as argument to encodeMessageIfNeeded
, ie. the message in this block. For this to be correct you need to use the returned message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you right, It is doing a copy of the message
. I will try to use the NSInvocation.getReturnValue
. Ty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 357c5db.
- `testSuite_getReturnValueFrom`: Get each return value generated by the identified method Aspects lib allows you to add code to existing methods but it has some limitations with Swift because the NSInvocation is unavailable: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Fo undation/Classes/NSInvocation_Class/
- `data` is not a value object. It needs to be copied explicitly.
Ok, looks good to me |
LGTM |
No description provided.