Just upgraded from version 6.2.0 to 6.4.0

edited February 2011 in Native
We had some memory leaks using Photon (I think they were in PhotonPee::Connect) and I upgraded to version 6.4.0 which seems to solve some memory leaks.

The problem its has disappeared PhotonPeer::opJoin(), PhotonPeer::opRaiseEvent() and PhotonPeer::opLeave(). In the header of PhotonPeer.h say:


\5. PhotonPeer call: opJoin () to get Into the game
...
\7. send in-game data by calling PhotonPeer: opRaiseEvent()
...
\9. PhotonPeer call: opLeave() to quit/leave the game.

What should I use?

- m

Comments

  • KaiserludiKaiserludi admin
    edited January 2011
    Hi mbustos.
    The client API has been refactored to be more similar to the server API:
    On the server, Photon itself cares about the core functionality like connections and sending operations (via opCustom) and all more high level stuff like joining and leaving rooms, raising events (which all are just specific operations with different opCodes for the Photon core) is handled by applications on top of the Photon core and the game specific operations are normally integrated by adding you one application, probably inheriting from an existing one, which is already giving you some basic functionality.
    The operations opJoin, opLeave and opRaiseEvent all belong to the "Lite"-application serverside and are not part of the Photon-core itself.

    After the refactoring on the client-side, all that functionality, which belongs to Lite on Server has now been moved to the freshly added LitePeer on the client side. LitePeer inherits from PhotonPeer.

    If you have a custom peer, which was inheriting from the PhotonPeer until now, but needs Lite funtionality, just let it inherit from LitePeer now.
    If you had an instance of a PhotonPeer as member to your network class before, just change it to be an instancer of LitePeer from now on.

    But all these changes haven taken place with client version 6.1.0, as you can see in the release-history, so I am quite confused, as you are telling me, you have used these methods from PhotonPeer in 6.2.0, when they already were Lite members.
  • You are right, the previous version was 6.0.X

    I'll take a look at LitePad, thanks!
  • I had an existing Iphone app I was working on based on the "demo_iPhone_realtime_objc". It works great except for the Memory Leak created by "Photon_Command". I tried moving to 6.4 from 6.2 and now I get error during the PhotonReturnEvent "NSString stringWithUTF32String".

    What has changed in the return message?
  • Hi tito.suriano.
    What do you mean with "PhotonReturnEvent"?
    What kind of error do you get?
    Can you please run your game in debug mode with Debug Level set to "INFO" and post the debug log?
  • Kaiserludi,

    I will do that after the app review process. Don't want to change anything in case apple needs me to fix something in my current verison.

    I meant this function not "PhotonReturnEvent", sorry
    -(void) PhotonPeerReturn:(nByte)opCode :(int)returnCode :(NSMutableDictionary*)returnValues :(short)invocID;

    I see there is alot of more code for encrypting packets.

    Tito
  • This is the error I get when using 6.4.1, but my code works great with 6.2.0
    -[NSPlaceholderString initWithUTF32String:]: unrecognized selector sent to instance 0x6900460
    2011-02-04 10:32:28.178 KickBack Sports[17453:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPlaceholderString initWithUTF32String:]: unrecognized selector sent to instance 0x6900460'
    *** Call stack at first throw:
    (
    	0   CoreFoundation                      0x0162bbe9 __exceptionPreprocess + 185
    	1   libobjc.A.dylib                     0x017805c2 objc_exception_throw + 47
    	2   CoreFoundation                      0x0162d6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    	3   CoreFoundation                      0x0159d366 ___forwarding___ + 966
    	4   CoreFoundation                      0x0159cf22 _CF_forwarding_prep_0 + 50
    	5   KickBack Sports                     0x000a8f24 +[Utils convertToOOPHash:] + 1633
    	6   KickBack Sports                     0x000b16fa OnPeerReturn + 65
    	7   KickBack Sports                     0x000b87fb PhotonPeer_internal_deserializeOperation + 1072
    	8   KickBack Sports                     0x000b6f25 PhotonPeer_dispatchIncomingCommands + 972
    	9   KickBack Sports                     0x000b747f PhotonPeer_serviceInternal + 145
    	10  KickBack Sports                     0x000b71b8 PhotonPeer_service + 31
    	11  KickBack Sports                     0x000b1ffa -[PhotonPeer service:] + 57
    	12  KickBack Sports                     0x000b1fbb -[PhotonPeer service] + 50
    	13  KickBack Sports                     0x0000b788 -[CPhotonLib Run] + 53
    	14  KickBack Sports                     0x0000c86c -[Game run] + 53
    	15  KickBack Sports                     0x000027b6 -[KickBackSportsAppDelegate onTime:] + 53
    	16  Foundation                          0x0020f7a5 __NSFireTimer + 125
    	17  CoreFoundation                      0x0160cfe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
    	18  CoreFoundation                      0x0160e594 __CFRunLoopDoTimer + 1220
    	19  CoreFoundation                      0x0156acc9 __CFRunLoopRun + 1817
    	20  CoreFoundation                      0x0156a240 CFRunLoopRunSpecific + 208
    	21  CoreFoundation                      0x0156a161 CFRunLoopRunInMode + 97
    	22  GraphicsServices                    0x01d20268 GSEventRunModal + 217
    	23  GraphicsServices                    0x01d2032d GSEventRun + 115
    	24  UIKit                               0x0048842e UIApplicationMain + 1160
    	25  KickBack Sports                     0x000024a0 main + 102
    	26  KickBack Sports                     0x00002431 start + 53
    )
    
  • Ah, then I guess, you are not using "force_load" linker flag on Common-objc lib. This is needed in the objC version of the Photon Client from version 6.4.1 upwards, when you are using a Xcode-version prior to 4.0 (and XCode 4.0 is not cleared for Appstore-builds by Apple yet).

    Let me quote the release-history for more information:
    - note: from now on you have to use linker flag "force_load" on Common-objC in XCode-versions prior to 4.0. This is due to a bug in class-extensiopn-support for static libraries in Xoce 3.x and is fixed in Xcode 4.0
    - added: class extension NSString (UTF32) consisting of the methods stringWithUTF32String(), initWithUTF32String() and mallocedUTF32String() as helperMethods for conversions between EG_CHAR* (which is defined as wchar_t*) and NSString*

    and the documentation:
    5. For XCode-versions prior to 4.0 in your Project Settings at category "Linking" add to "Other Linker Flags" -force_load pathToCommon-objc/libCommon-objc_$(CONFIGURATION)_$(PLATFORM_NAME).a, and replace pathToCommon-objc with the according path and do not bother, that Xcode will present it as two entries after savin the project settings, it will work anyway, but it will not work , if you set it into "".
  • I had already read that in the DOC and added the flag. Upgraded to 4.0 just today because apple is taking app builds from it now. Still getting the same error.
  • I have not tested with Xcode 4.0 yet, so not 100% sure, if it works without the flag there, so please doublecheck the syntax of the flag in you project/Target settings to be exactly the same like in our iPhone objC demos from the 6.4.1 SDK.
    Just tried a typo in the flag in a demo and got the same "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPlaceholderString initWithUTF32String:]: unrecognized selector", which you got. Fixed the typo, all fine again.
  • I did have a typo, had an extra period in "/libCommon-objc_$(CONFIGURATION)_$(PLATFORM_NAME).a" part. Thanks.
Sign In or Register to comment.