Not connect once disconnect from photon cloud

edited April 28 in Native
Hi @Kaiserludi admin and @Dmitry_Stepanushkin and rest of the team

Getting this error while try to reconnect once disconnect from photon :

2017-04-28 12:44:55,981614 INFO PeerBase.cpp connect() line: 128 - address:
2017-04-28 12:44:56.015958+0530 BJ SPADES[10817:3763226] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x190032fd8 0x18ea94538 0x18ff199a4 0x190030874 0x18ff339c8 0x1002eac50 0x1002d6ec8 0x1002d6d10 0x1002d6cbc 0x1002d6c68 0x1000c2934 0x1001be8d8 0x1001be930 0x1961970ec 0x19619706c 0x1961815e0 0x196196950 0x19619646c 0x196191804 0x196162418 0x19695bf64 0x1969566c0 0x1969569a0 0x18ffe1424 0x18ffe0d94 0x18ffde9a0 0x18ff0ed94 0x191978074 0x1961c7130 0x1001f255c 0x18ef1d59c)
libc++abi.dylib: terminating with uncaught exception of type NSException

Use below code for disconnect :

- (void) disconnect
mState = PeerStates::Disconnecting;
[mPeer disconnect];

Use below code for connect from my viewcontroller :


EGLoadBalancingClient.m file having below code for connect :

- (bool) connect
return [self connect:nil];

- (bool) connect:(EGAuthenticationValues*)authenticationValues
return [self connect:authenticationValues :nil];

- (bool) connect:(EGAuthenticationValues*)authenticationValues :(NSString*)username
return [self connect:authenticationValues :username :NAMESERVER];

- (bool) connect:(EGAuthenticationValues*)authenticationValues :(NSString*)username :(NSString* const)serverAddress
return [self connect:authenticationValues :username :serverAddress :ServerType::NAME_SERVER];

- (bool) connect:(EGAuthenticationValues*)authenticationValues :(NSString*)username :(NSString* const)serverAddress :(nByte)serverType

static const int NAMESERVER_PORT_GAP = 3;
if([mPeer connect:[NSString stringWithFormat:@%@%@", serverAddress, [serverAddress containsString:@:]?@"":[NSString stringWithFormat:@:%d, (mConnectionProtocol==ConnectionProtocol::UDP?NetworkPort::UDP:NetworkPort::TCP)+(serverType==ServerType::NAME_SERVER?NAMESERVER_PORT_GAP:0)]] :mAppIDPeerInit])
self.LocalPlayer.Name = username;
[self setLocalPlayer:-1 :[NSDictionary dictionaryWithObject:username?:@"" forKey:[NSValue value:&Properties::Player::PLAYERNAME withObjCType:@encode(nByte)]]];
[mAuthenticationValues release];
mAuthenticationValues = authenticationValues?[authenticationValues mutableCopy]:[EGMutableAuthenticationValues new];
if(serverType == ServerType::MASTER_SERVER)
mMasterserver = serverAddress;
self.State = serverType==ServerType::NAME_SERVER?PeerStates::ConnectingToNameserver:PeerStates::Connecting;
return true;
return false;

It shows client.state = PeerCreated and disconnecting.....

For connection handling what should i do please give me a solution thanks in advance


  • KaiserludiKaiserludi admin
    edited April 28
    Hi @phsojitra.

    I am afraid that this is a bug in the current release of the objC Client. We will fix it in the next update.

    Until then you can either fix it yourself by changing line 207 in
    [mLoadBalancingClient opSetPropertiesOfPlayer:mNumber :[NSDictionary dictionaryWithObject:mName=[name copy] forKey:[NSValue value:&Properties::Player::PLAYERNAME withObjCType:@encode(nByte)]]];

    [mLoadBalancingClient opSetPropertiesOfPlayer:mNumber :[NSDictionary dictionaryWithObject:mName=[name?:@"" copy] forKey:[NSValue value:&Properties::Player::PLAYERNAME withObjCType:@encode(nByte)]]];
    and afterwards recompiling the LoadBalancing-objc project and using the freshly compiled lib in you app

    or you could workaround by
    replacing your call to
    client.connect(nil, "")
Sign In or Register to comment.