cancel
Showing results for 
Search instead for 
Did you mean: 

Error while connecting ios app with SMP2.3 server throufh relay server

Former Member
0 Kudos

hello,

I m trying to connect a SMP server(2.3 version) via an IOS application which is giving me a onHttpCommunicationError at time of registration while the same server when I m connecting via an android application is connecting without any issue.

Please help me in this problem if possible then please provide me with the Connection code i.e ios code to connect SMP server.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Anu,

I have resolved that error and now my code is compiling without errors. But I want to connect to relay server and my registered user in sybase control center is not showing as online. I have added all the required relay server settings in my code. Please find below my code and let me know if I missed something.

SUPApplication *app=[SUPApplication getInstance];

[app setApplicationIdentifier:APPLICATION_IDENTIER];

[app setApplicationCallback:self.callbackHandler];

[Demo_AppDemo_AppDB registerCallbackHandler:self.callbackHandler];

SUPConnectionProperties* props = app.connectionProperties;

[props setServerName:server];

[props setPortNumber:CONTROL_PORTNUMBER]; //80 HTTP or 443 for HTTPS

[props setNetworkProtocol:CONTROL_PROTOCOL]; // or https for secure connection

[props setUrlSuffix:@"/ias_relay_server/client/rs_client.dll/MBSFARMID/"];

[props setFarmId:CONTROL_FARMID];

SUPLoginCredentials* login = [SUPLoginCredentials getInstance];

login.username = app_user; // same as in Application Connection

login.password = nil;

props.loginCredentials = login;

props.activationCode = activation;// same as in Application Connection

props.securityConfiguration =CONTROL_SECURITY_CONFIG;

SUPConnectionProfile *sp = [ Demo_AppDemo_AppDB getSynchronizationProfile];

[sp setUser:scc_username];

[sp setPassword:scc_password];

[sp setAsyncReplay:NO];

[sp setServerName:server];

[sp setPortNumber:CONTROL_PORTNUMBER]; // or 80 for http

[sp setNetworkProtocol:CONTROL_PROTOCOL];

With Regards

Neha

Former Member
0 Kudos

I also got the similar issue I was able to resolve it by enabling a flag :

Go to SCC ->Go to ypur Domain ->Select Application -> Go to Application Connection Tab in it -> select your application connection and select Properties there atleft hand side u'll find a tab as Apple Push Notification -> set the enabled value as True.

Try this..

Former Member
0 Kudos

Just want to confirm a point whether your device is not online or user.

User doesnot have a status as online or offline on SCC???

Former Member
0 Kudos

Hi Anu,

In SCC my device is not showing as online. Just want to confirm that any certificate is needed to add in the code and url suffix is necessary to add in the code or is optional. Because i have not included any certificate in the code for relay server.

Thanks

Neha

Former Member
0 Kudos

Hi Anu,

In SCC the Apple Push Notification value is YES. Then also my device is not showing as online in sybase control center.

Thanks

Neha

Former Member
0 Kudos

It is necessary to provide url_suffix if you are using Relay server.

Try to use that and check for reference you can see the connection code written in my previous reply to jitendr6a in this discussion.

Former Member
0 Kudos

Hi Anu,

Which farm id u r using RBS or MBS for connection.

Thanks

Neha

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos
Which farm id u r using RBS or MBS for connection.

It is very simple.

We need to maintain two profiles through code.

  1. Connection profile

          server: Relay server

          port: 80/443

         Farm ID: MBS

2. Synchronization profile

          server: Relay server

          port: 80/443

          stream paramter: url suffix(/ias_relay_server/client/rs_client.dll/RBS farm ID)

Former Member
0 Kudos

Hi,

Now i am developing a native iOS app using SMP 2.3 MBO approach so i have used SMP Object API includes and libraries.But in the later time I have to develop native iOS app using Odata services and SMP 2.3. So I just want to know is there any difference in connecting the Odata services through Relay server or the procedure would be same as the header files we are using in the relay server connection code are available in Object API includes folder(ex: SUPApplication) in SMP and for Odata there is seperate includes folder in which those files are not available.

Thanks

Neha

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

MBO app development for iOS and OData app development for iOS are totally different and independent approaches.

In case of mbo based app, you have to do mbo modeling first, deploy it to server, generate code. The same code has to be merged with UI along wth iOS object APIs files available in Mobil SDK path.

Whereas for OData based apps, there are different libraries files available in mobile sdk path.

Both apps development have to be done separately. Don't mix mbo objectapi with either odata's one in case of any kind of connectivity.

Former Member
0 Kudos

Hi,

So could you please tell me what would be the code for relay server connectivity in case of Odata services. Because we can not use the same code written above for relay server connectivity as the files used in the code are not available in OData SDK includes folder.

Thanks

Neha

Former Member
0 Kudos

Hi,

I am creating a native iOS application using smp2.3. I want the application to be connected through Relay server but i am not able to understand as where to put the relay server connection properties.

I have put the below code in Appdelegate.m:

SUPConnectionProperties* props = app.connectionProperties;

    [props setServerName:self.serverName];

    [props setPortNumber:[self.serverPort intValue]];

    [props setUrlSuffix:@""];

    [props setFarmId:self.farmID];

    SUPLoginCredentials* login = [SUPLoginCredentials

                                  getInstance];

    if(self.manualRegistration)

    {

        login.username = self.connectionName;

        login.password = nil;

        props.activationCode = self.activationCode;

    } else {

    }

    props.loginCredentials = login;

    login.username = self.userName;

    login.password = [smp101vault getString:@"password"];

    props.activationCode = nil;

when I am compiling the app it is giving errors like sybase.sup.h, SUPClassMetaDataRBS.h file missing and use of undeclared identifier SUPConnectionProperties.

Please help me in resolving this error.

Thanks

Neha

Former Member
0 Kudos

hi Neha,

you need to import the required files in the where u r writing this code.

have you added the required file in ur project if yes then have yoy set the Header Search Path in the Build Settings.

You can follow the steps from this pdf :

http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01213.0212/doc/pdf/sup_tutorial_ios_...

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Anu,

Can you please share the code what you have written for app registration?

meanwhile, check this discussion

Rgrds,

Jitendra

Former Member
0 Kudos

I have used following code :

app.applicationIdentifier = @"app_name";

SUP101CallbackHandler *ch = [SUP101CallbackHandler getInstance];

[ch retain];

[app setApplicationCallback:ch];

SUPConnectionProperties *props = app.connectionProperties;

[props setServerName:@"relay_server_name"];

[props setPortNumber:[@"port_number" intValue]];

[props setFarmId : @"farm_id"];

SUPLoginCredentials *login = [SUPLoginCredentials getInstance];

login.username = @"user_name";

login.setPassword = @"pass";

props.activationCode = nil;

props.loginCredentials = login;

[*****DB setApplication:app];

@try{

     [app registerApplication : 30];

}

@catch(Exception *ex){

     NSLog(@"Exception : ",[ex reason]);

}

[*****DB openConnection];

if(![[*****DB databaseExists])

{    

     [*****DB createDataBase];

}

else

{

     [*****DB deleteDatabase];

     [*****DB createDataBase];

}

SUPConnectionProfile *cp = [*****DB getSynchronizationProfile];

[cp setUser : @"user_name"];

[cp setPassword : @"pass"];

[cp setServerName : @"relay_server_name"];

[cp setPortNumber :[@"port_number" intValue]];

[cp setDomainName : @"domain"];

[cp setNetworkProtocol : @"http"];

[cp setNetworkStreamsParam : @"trusted_certificates='compression=none;url_suffix=/ias_relay_server/Client/rs_client.dll/RBS_FARM_ID"];

[*****DB registerCallbackHandler:callbackHandler];

@try{

     ****LocalKeyGenerator *gene = [****LocalKeyGenerator getInstance];

     [gene save];

     [*****DB synchronize];

}

@catch(Exception *ex){

     NSLog(@"Exception while synchronizing : ",[ex reason]);

}

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

can you try with passing values in the above code...? 

Delete Application connection in SCC if any

have a look

Former Member
0 Kudos

hey jitendra,

I have successfully registered and connected the app and its now visible on the SCC also.

But now the issue is that I am not able to call save method on the LBO instance it is giving me a following exception:

NSInvalidArgumentException : -[ __NSCFString appendString :] nil argument.

LBO object is not null and it even contains values in all fields.

Please guide me.