cloud and OS X client

edited March 2012 in Native
I checking
OS X demo 'demo_iMac_LoadBalancing_objc'. Photon cloud
OS X 10.7.3
XCode 4.3.2
trying to work with custom properties for rooms and players
modified
- (void) opCreateRoom
{
// if last digits are always nearly the same, this is because of the timer calling this function being triggered every x ms with x being a factor of 10
//NSString* tmp = [NSString stringWithFormat:@%d, GETTIMEMS()];
[mOutputListener write:@Creating our default room];
NSString * tmp=[NSString stringWithFormat:@INARITEST];
NSMutableDictionary * roomProperties=[[NSMutableDictionary alloc] init ];
[roomProperties setValue:@TestValue forKey:@TestRoomProp];
//[roomProperties setObject:@TestValue2 forKey:[KeyObject withStringValue:@TestKey2]];
NSMutableDictionary * playerProperties = [[NSMutableDictionary alloc] init ];
[playerProperties setValue:@TestVal forKey:@TestPlayerProp];

[mLoadBalancingClient opCreateRoom:@INARITEST]; //:true :true :0 :roomProperties :playerProperties];
mStateAccessor.State = STATE_JOINING;
[mOutputListener writeLine:@creating room \%@\"", tmp];
}

- (void) opJoinOurRoom
{

NSMutableDictionary * playerProperties = [[NSMutableDictionary alloc] init ];
[playerProperties setObject:@TestUser2 forKey:[KeyObject withStringValue:@TestPlayeProp]];
[mLoadBalancingClient opJoinRoom:@INARITEST :playerProperties];
[mOutputListener writeLine:@joining our room game];

}

and
- (void) joinRoomEventAction:(int)playerNr :(EGArray*)playernrs :(LoadBalancingPlayer*)player
{
PhotonPeer_sendDebugOutput(mLoadBalancingClient, DEBUG_LEVEL_INFO, @%ls joined the game, player.Name.UTF32String);
[mOutputListener writeLine:@""];
[mOutputListener writeLine:@player %d %@ has joined the game", playerNr, player.Name];

NSString * playerProp=[[player CustomProperties] objectForKey:@TestPlayerProp];
[mOutputListener writeLine:@Test Player Prop is %@",playerProp];
NSString * roomProp=[[mLoadBalancingClient.CurrentlyJoinedRoom CustomProperties] objectForKey:@TestRoomProp];
[mOutputListener writeLine:@Test Room Prop is room is %@",roomProp];
// NSString * desc2=[[mLoadBalancingClient CurrentlyJoinedRoom] toString:true];
// [mOutputListener writeLine:@Room is %@",desc2];
}


props are null. and if uncomment last 2 lines, it crashes(looks like toString falls into infinite recursion)
version is Photon-MacOSX_v3-0-0-1_Cloud_SDK
What I'm doing wrong?

Comments

  • [roomProperties setValue:@"TestValue" forKey:@"TestRoomProp"];
    
    is the wrong way.
    You have to do it this way
    [roomProperties setObject:@"TestValue2" forKey:[KeyObject withStringValue:@"TestKey2"]]
    
    instead (always wrap a key into a keyObject, please!).
    Accordingly change your code to
    [playerProperties setObject:@"TestVal" forKey:[KeyObject withStringValue:@"TestPlayerProp"]];
    
    and of course:
    NSString * playerProp=[[player CustomProperties] objectForKey:[KeyObject withStringValue:@"TestPlayerProp"]];
    [mOutputListener writeLine:@"Test Player Prop is %@",playerProp];
    NSString * roomProp=[[mLoadBalancingClient.CurrentlyJoinedRoom CustomProperties] objectForKey:[KeyObject withStringValue:@"TestRoomProp"]];
    

    RoomProperties will work then, when supplying them to opCreateGame(). However on trying to reproduce your issues, we have just found a bug, which is responsible for the PlayerProperties currently not working in the objC clients.
    We will include a bug fix therefor into the next release.
    The infinite recursion issue is also a bug in the LoadBalancing client lib implementation, but only occurring in the current release, while it has already been fixed for the next one.

    Thank you for bringing these issues to our attention.
Sign In or Register to comment.