Page 1 of 1

Objective-C and SetUserPositionRequest

Posted: 28 Jan 2014, 16:48
by brandonautry
Hello! I'm trying to run the SetUserPositionRequest to start the Proximity_Update_List in my mmoRoom. However the Vec3D in objective-c is expecting the NSNumber datatype and I'm receiving this message on the server because IT is expecting a float/int:

"java.lang.IllegalArgumentException: User coordinates don't match numeric type of the Room's Area Of Interest (AOI)"

My question is how do I send an int/float from the Vec3D class in objective-c when it is expecting a NSNumber?

[smartFox send:[SetUserPositionRequest requestWithPosition:[[Vec3D alloc] initWithX:[NSNumber numberWithFloat:player.position.x] Y:[NSNumber numberWithFloat:player.position.y]] mmoRoom:[smartFox lastJoinedRoom]]];

Here is my SetUserPositionRequest.

Thank you.

Re: Objective-C and SetUserPositionRequest

Posted: 28 Jan 2014, 17:06
by brandonautry
I actually figured it out! After looking at the Vec3D class I realized there was an internal static constructor that is looking for an array! So i did that and sfs2x is happy!

Re: Objective-C and SetUserPositionRequest

Posted: 28 Jan 2014, 17:13
by brandonautry
FYI:
THIS:
[smartFox send:[SetUserPositionRequest requestWithPosition:[[Vec3D alloc] initWithX:[NSNumber numberWithFloat:player.position.x] Y:[NSNumber numberWithFloat:player.position.y]] mmoRoom:[smartFox lastJoinedRoom]]];

Does work... if you convert it to what your extension is looking for... For instance mine was looking for int... so change the numberWithFloat to numberWithInt and what do you know everything is happy.

Thanks I hope this helps someone lol...

Re: Objective-C and SetUserPositionRequest

Posted: 28 Jan 2014, 19:06
by Lapo
Ok, thanks. You did it all by yourself in like 25 minutes :)

Re: Objective-C and SetUserPositionRequest

Posted: 28 Jan 2014, 22:29
by brandonautry
Well I attempted it last night and apparently was tired... spent like an hour on it and it was an "oh duh" moment as soon as I looked at it today :shock: . Thanks for your quick responses though!!