iPhone bugs

Post here all your questions related with the SmartFoxServer iPhone API

Moderators: Lapo, Bax

stager
Posts: 12
Joined: 06 May 2009, 11:28

Postby stager » 14 Jul 2009, 08:51

Hi!

Yet another set of small bugs in Beta2:

1. INFSmartFoxiPhoneClient.m in sendXtMessage:cmd:paramObj:type:roomId: at line 1234 format string should be @"%@xt%@%@%@%@%@%d%@", not @"%@xt%@%@%@%@%@%@%@". because roomId is NSInteger, not an object.

2. INFSmartFoxiPhoneClient.m There is a problem with _blueBoxIpAddress member memory management. In loadConfig:autoConnect: it is aliased
with _ipAddress at line 703 and may be overwritten later at line 708. This makes correct deallocation of _blueBoxIpAddress impossible. Besides that neither _blueBoxIpAddress nor _ipAddress are deallocated in dealloc call.

Good luck!
User avatar
cemuzunlar
Posts: 47
Joined: 26 Dec 2008, 00:45
Contact:

Postby cemuzunlar » 14 Jul 2009, 09:10

stager wrote:1. INFSmartFoxiPhoneClient.m in sendXtMessage:cmd:paramObj:type:roomId: at line 1234 format string should be @"%@xt%@%@%@%@%@%d%@", not @"%@xt%@%@%@%@%@%@%@". because roomId is NSInteger, not an object.

2. INFSmartFoxiPhoneClient.m There is a problem with _blueBoxIpAddress member memory management. In loadConfig:autoConnect: it is aliased
with _ipAddress at line 703 and may be overwritten later at line 708. This makes correct deallocation of _blueBoxIpAddress impossible. Besides that neither _blueBoxIpAddress nor _ipAddress are deallocated in dealloc call.

3. "[doc release];" call is missing in INFSmartFoxExtHandler.m in
handleMessage:type:delegate:

Thanks for reporting.

These will be fixed in the next release.
Cem Uzunlar
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
stager
Posts: 12
Joined: 06 May 2009, 11:28

Postby stager » 15 Jul 2009, 07:32

Hello!

Small bug in INFSmartFoxObjectSerializer.m in xml2obj:resObj: method: if received string is empty, it causes a problem at line 215, while trying to insert nil value into dictionary. I think that fix is simple - just check if varVal is nil and assign varValue an empty string instead of nil. Something like this:

Code: Select all

--- SmartFox.orig/Source/Util/INFSmartFoxObjectSerializer.m   2009-07-14 13:56:56.000000000 +0300
+++ SmartFox/Source/Util/INFSmartFoxObjectSerializer.m   2009-07-14 13:59:24.000000000 +0300
@@ -205,7 +205,12 @@
             varValue = [NSNumber numberWithInteger:[varVal integerValue]];
          }
          else if ([varType isEqualToString:@"s"]) {
-            varValue = varVal;
+                if (varVal != nil) {
+                    varValue = varVal;
+                }
+                else {
+                    varValue = @"";
+                }
          }
          else if ([varType isEqualToString:@"x"]) {
             varValue = [NSNull null];


Good luck!

PS: what is prefered way to send bug reports and/or patches? Is it ok to post it here, or it would be better to send reports/patches by e-mail?
pankajnagarkoti86
Posts: 2
Joined: 12 Oct 2009, 21:49
Contact:

Postby pankajnagarkoti86 » 12 Oct 2009, 21:50

In handlePrivateMessage the parameters being sent to onPrivateMessage will often stop after the sender param.
aw2xcd
Posts: 6
Joined: 28 Sep 2009, 18:20

more iphone api bugs

Postby aw2xcd » 22 Oct 2009, 09:40

INSmartFoxiPhoneClient.m function strReceived() line 333 should be changed from:

Code: Select all

[handler handleMessage:[msgStr substringWithRange:NSMakeRange(1, [msgStr length]-1)] type:(NSString *)INFSMARTFOXCLIENT_XTMSG_TYPE_STR delegate:_delegate];

to

Code: Select all

[handler handleMessage:[msgStr substringWithRange:NSMakeRange(0, [msgStr length])] type:(NSString *)INFSMARTFOXCLIENT_XTMSG_TYPE_STR delegate:_delegate];


Or else it will cut off the first letter from the returned string.
User avatar
cemuzunlar
Posts: 47
Joined: 26 Dec 2008, 00:45
Contact:

Postby cemuzunlar » 22 Oct 2009, 22:14

This will be fixed in the next release.

You can fix it by updating the function strReceived in INFSmartFoxiPhoneClient.m:

Code: Select all

- (void)strReceived:(NSString *)msg
{
    [self debugMessage:[NSString stringWithFormat:@"INFSmartFoxiPhoneClient:strReceived"]];
   
    // Got String response
    NSArray *params = [[msg substringWithRange:NSMakeRange(1, [msg length] - 2)] componentsSeparatedByString:_MSG_STR];
       
    NSString *handlerId = [params objectAtIndex:0];
    id<INFSmartFoxIMessageHandler> handler = [_messageHandlers objectForKey:handlerId];
   
    if (handler != nil) {
        [handler handleMessage:[params subarrayWithRange:NSMakeRange(1, [params count] - 1)] type:(NSString *)INFSMARTFOXCLIENT_XTMSG_TYPE_STR delegate:_delegate];
    }
    else {
        [self debugMessage:[NSString stringWithFormat:@"No handlers found for type:%@", handlerId]];
    }
}

Thanks
Cem Uzunlar

Infosfer Game and Visualization Technologies

http://www.infosfer.com

contact@infosfer.com

Return to “iPhone Objective-C API”

Who is online

Users browsing this forum: No registered users and 3 guests