SFSRoom Variables dont all update

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

Moderators: Lapo, Bax

uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

SFSRoom Variables dont all update

Postby uncleunvoid » 17 Jul 2012, 18:59

I had acode running and i think it worked for a while,
however

I am sending 4 new room vars in one go, all fine all sent, yet the response is only the first two.

single one works, two works, three no, four no.

Anyone know what would result in this odd behaviour

I try to work around by doing two requests with two vars each. First one comes back, second one is plainly ignore, no response again.

I changed the vars around its always the first two are fine, afterwards , zilch.

Anyone?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: SFSRoom Variables dont all update

Postby rjgtav » 17 Jul 2012, 23:44

Hi.
How are you setting those vars?
Are you using the latest server patch (2.1.0) and client API?
And please make sure that you insert new values when you update those variables, different from the old ones.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 18 Jul 2012, 20:09

NSNumber *tLon = (NSNumber *)[(SFSUserVariable *)[tSmartFoxServerProxy.smartFox.mySelf getVariable:USER_PROP_LONGITUDE] getValue];
NSNumber *tLat = (NSNumber *)[(SFSUserVariable *)[tSmartFoxServerProxy.smartFox.mySelf getVariable:USER_PROP_LATITUDE] getValue];

NSLog(@">>>> %f::%f", [tLon floatValue], [tLat floatValue]);

NSArray *tVariables = [NSArray arrayWithObjects:
[SFSUserVariable variableWithName:@"pinLat" value:tLat],
[SFSUserVariable variableWithName:@"pinLon" value:tLon],
nil];

[tSmartFoxServerProxy setMyUserVariables:tVariables];
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 18 Jul 2012, 20:10

Might a minus value make a difference? it shouldnt, it worked for two values, and now that stopped as well for some reason (it goes crazy)


the values are there, they are written to the server but for some reason it does not include them in the response
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 18 Jul 2012, 20:20

odd thing is my first round of user props setting

longitude, latitude

works fine

the second one

pinlat, pinlon

screws up ????

inconsistent, why?
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 18 Jul 2012, 20:29

if I use the same properties to set the other properties, it works,

as if it would not like the property names
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 18 Jul 2012, 20:35

it looks like it doesnt like the user property names

why? is there a rule for user property names?
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 18 Jul 2012, 20:37

it accepts the first prop name thousand times yet a new name makes it go funny (deprecate)
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 18 Jul 2012, 20:40

Okay I dont knwo what is going on here.

first segment works, second doesnt, only difference, the names of the properties:



Code: Select all


if([[notification name] isEqualToString: SFS_YOU_LOCATION_UPDATE])
   {
        CLLocation *tCoordinate = (CLLocation *)[notification body];
       
        NSNumber *tLon = [NSNumber numberWithDouble:tCoordinate.coordinate.longitude];
        NSNumber *tLat = [NSNumber numberWithDouble:tCoordinate.coordinate.latitude];

        NSArray *tVariables = [NSArray arrayWithObjects:
                               [SFSUserVariable variableWithName:USER_PROP_LONGITUDE value:tLon],
                               [SFSUserVariable variableWithName:USER_PROP_LATITUDE value:tLat],
                                nil];

        [tSmartFoxServerProxy setMyUserVariables:tVariables];
       
    }
    else if([[notification name] isEqualToString: SFS_YOU_LOCATION_PIN])
   {
        NSNumber *tLonNumber = (NSNumber *)[(SFSUserVariable *)[tSmartFoxServerProxy.smartFox.mySelf getVariable:USER_PROP_LONGITUDE] getValue];
        NSNumber *tLatNumber = (NSNumber *)[(SFSUserVariable *)[tSmartFoxServerProxy.smartFox.mySelf getVariable:USER_PROP_LATITUDE] getValue];
        NSNumber *tLon = [NSNumber numberWithDouble:[tLonNumber doubleValue]];
        NSNumber *tLat = [NSNumber numberWithDouble:[tLatNumber doubleValue]];
       
        //NSLog(@">>>> %f::%f", [tLon floatValue], [tLat floatValue]);
       
        NSArray *tVariables = [NSArray arrayWithObjects:
                               [SFSUserVariable variableWithName:USER_PROP_PIN_LON value:tLon],
                               [SFSUserVariable variableWithName:USER_PROP_PIN_LAT value:tLat],
                               nil];
       
        [tSmartFoxServerProxy setMyUserVariables:tVariables];
       
    }

uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 18 Jul 2012, 20:54

okay the only difference I can test on why the added properties dont come back is that ,
they have different names

thing is what makes some names work?
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 18 Jul 2012, 21:03

OKAY I declare BUG!!!!!

some names cause the list of properties to respond back to be truncated.

what the rule is I dont know


but it looks complicated


I can cut off any user var and room var request by just adding new vars and it will break down

good ? no!!!!!!
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: SFSRoom Variables dont all update

Postby A51Integrated » 18 Jul 2012, 21:28

Can you please post a concise example of what you are talking about to replicate this? Something without your proxy class but that actually shows the SetUserVariablesRequest.

thx.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 20 Jul 2012, 15:30

My proxy code is fairly simple. The function is:

- (void)setRoomVariables:(NSArray *)myRoomVariables inRoom:(id)myRoom
{
[_smartFox send:[SetRoomVariablesRequest requestWithRoomVariables:myRoomVariables room:myRoom]];

}

its the same when I use user variables instead:

- (void)setMyUserVariables:(NSArray *)myVariables
{
[_smartFox send:[SetUserVariablesRequest requestWithUserVariables:myVariables]];

}
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 20 Jul 2012, 18:10

The behaviour is highly bizarre.
If I duplicate the request when I set 'longitude' and 'latitude', it always works fine.
If I use the properties 'longitude' and 'latitude' in the 'pin' request, it works fine.

As soon as I use another value name, it lets me set one and anything after that gets cut off

If I set 'longitude' and 'latitude' twice, like in :

Code: Select all

NSArray *tVariables = [NSArray arrayWithObjects:
                               [SFSUserVariable variableWithName:USER_PROP_LONGITUDE value:tLon],
                               [SFSUserVariable variableWithName:USER_PROP_LATITUDE value:tLat],
                               [SFSUserVariable variableWithName:USER_PROP_LONGITUDE value:tLon],
                               [SFSUserVariable variableWithName:USER_PROP_LATITUDE value:tLat],
                                nil];


that works.

Maybe its some kind of capacity issue?

I can rename 'longitude' and 'latitude' and it still works, as if the first use defines which properties I can set.
uncleunvoid
Posts: 34
Joined: 11 Aug 2011, 12:40

Re: SFSRoom Variables dont all update

Postby uncleunvoid » 20 Jul 2012, 18:18

is there a limitation on the number of properties that can be set on a user or room? or do I have to preset the number or template?

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 15 guests