Failed loading config file iPhone

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

Moderators: Lapo, Bax

vanducitc
Posts: 1
Joined: 13 Mar 2012, 13:42

Failed loading config file iPhone

Postby vanducitc » 17 Mar 2012, 06:14

I'm having problem with load file config from bundle in the application. This is my source code:
File config name: sfs—config.xml
The content's config file:

Code: Select all

<SmartFoxConfig>
   
   <!-- Mandatory Settings -->
   <ip>127.0.0.1</ip>
   <port>9933</port>
   <zone>BasicExamples</zone>
   <!-- End Mandatory Settings -->
   
   <debug>false</debug>
   
   <httpPort>8080</httpPort>
   <useBlueBox>false</useBlueBox>
   <blueBoxPollingRate>500</blueBoxPollingRate>
   
</SmartFoxConfig>


and:

Code: Select all

   NSString *pathConfig = [[NSBundle mainBundle] pathForResource:@"sfs-config" ofType:@"xml"];
    smartFox2XClient = [[SmartFox2XClient alloc] initSmartFoxWithDebugMode:YES delegate:self];
    [smartFox2XClient loadConfig:pathConfig connectOnSuccess:NO];

callback from Smartfox:

Code: Select all

-(void) onConfigLoadSuccess:(SFSEvent *)evt
{
    NSLog(@"evt: %@", evt);
    NSLog(@"Config file loaded, now connecting...");
}

-(void) onConfigLoadFailure:(SFSEvent *)evt
{
     NSLog(@"Failed loading config file: %@", [evt.params objectForKey:@"message"]);
   
}



and my result: "Failed loading config file: (null)"

i don't know What was wrong ? and what should i do ? Please help me, thanks you.
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: Failed loading config file iPhone

Postby A51Integrated » 19 Mar 2012, 20:34

Is your config file part of your project? Make sure you've added the file tothe project. You can always check if the file exists (if your app can see it) with fileExistsAtPath.
A51 Integrated
http://a51integrated.com / +1 416-703-2300

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 14 guests