Objective-C and SetUserPositionRequest

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

brandonautry
Posts: 8
Joined: 11 Dec 2013, 08:37

Objective-C and SetUserPositionRequest

Postby brandonautry » 28 Jan 2014, 16:48

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.
brandonautry
Posts: 8
Joined: 11 Dec 2013, 08:37

Re: Objective-C and SetUserPositionRequest

Postby brandonautry » 28 Jan 2014, 17:06

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!
brandonautry
Posts: 8
Joined: 11 Dec 2013, 08:37

Re: Objective-C and SetUserPositionRequest

Postby brandonautry » 28 Jan 2014, 17:13

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...
User avatar
Lapo
Site Admin
Posts: 19676
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Objective-C and SetUserPositionRequest

Postby Lapo » 28 Jan 2014, 19:06

Ok, thanks. You did it all by yourself in like 25 minutes :)
Lapo
--
gotoAndPlay()
...addicted to flash games
brandonautry
Posts: 8
Joined: 11 Dec 2013, 08:37

Re: Objective-C and SetUserPositionRequest

Postby brandonautry » 28 Jan 2014, 22:29

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!!

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 1 guest