Skip to Content
0
Former Member
May 06, 2011 at 09:08 PM

Login error in SampleApp for Iphone. ([SampleApp_SampleAppDB subscribe];)

8 Views

Hi All,

I have build the SampleApp for Iphone with is provided by sybase. When I deploy the app I do not get any errors. When I run the app on the simulator I get a login error during [SampleApp_SampleAppDB subscribe];. Can someone tell me what the problem is?

source SampleApp.m.

- (void)run

{

NSInteger connectionResult ;

// Set log level

[MBOLogger setLogLevel:LOG_INFO];

//Delete the old database and create a new one.

if([SampleApp_SampleAppDB databaseExists])

[SampleApp_SampleAppDB deleteDatabase];

[SampleApp_SampleAppDB createDatabase];

// Set up synchronization profile .

SUPConnectionProfile* cp = [SampleApp_SampleAppDB

getSynchronizationProfile];

[cp setDomainName:@"default"];

//Register a callback handler.

CallbackHandler* databaseCH = [CallbackHandler getInstance];

[SampleApp_SampleAppDB registerCallbackHandler:databaseCH];

//Start backgroundsynchronization.

[SampleApp_SampleAppDB startBackgroundSynchronization];

//Connect to the server

connectionResult = [SUPMessageClient start];

if(connectionResult != kSUPMessageClientSuccess)

{

NSLog(@"Cannot start SUPMessageClient");

exit(0);

}

while([SUPMessageClient status] != STATUS_START_CONNECTED)

[NSThread sleepForTimeInterval:0.0];

[SampleApp_SampleAppDB beginOnlineLogin:@"supAdmin"

password:@"s3pAdmin"];

while([SampleApp_SampleAppDB getOnlineLoginStatus].status ==

SUPLoginPending)

{

[NSThread sleepForTimeInterval:0.0];

if(databaseCH.loginFailureCount > 0)

{

NSLog(@"SampleApp_SampleAppDB login failed.");

}else{

NSLog(@"SampleApp_SampleAppDB login correct.");

}

}

NSLog(@"Start subscribe.");

//Subscribe to the package.

[SampleApp_SampleAppDB subscribe];

// Wait for imports to come back from server

while([databaseCH importSuccessCount] < 1)

[NSThread sleepForTimeInterval:0.2];

//Call the functions that execute the client APIs for synchronization

//parameters, personalization keys read, create, update and delete

[self runAPITests];

// Unsubscribe

[SampleApp_SampleAppDB unsubscribe];

//Disconnect from server.

[SUPMessageClient stop];

}

Debug log

2011-05-06 22:43:13.913 SampleApp[1746:40b] SampleApp_SampleAppDB login correct.

2011-05-06 22:43:13.914 SampleApp[1746:40b] SampleApp_SampleAppDB login correct.

2011-05-06 22:43:13.914 SampleApp[1746:4403] [INFO] [CallBackHandler.m:107] =============================

2011-05-06 22:43:13.914 SampleApp[1746:40b] Start subscribe.

Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)

(gdb) continue

Current language: auto; currently objective-c

2011-05-06 22:43:13.915 SampleApp[1746:4403] [ERROR] [CallBackHandler.m:108] Login Failed

2011-05-06 22:43:36.996 SampleApp[1746:4403] [INFO] [CallBackHandler.m:109] =============================

2011-05-06 22:43:37.540 SampleApp[1746:4403] [INFO] [CallBackHandler.m:130] =============================

2011-05-06 22:43:37.540 SampleApp[1746:4403] [ERROR] [CallBackHandler.m:131] Subscribe Failed

2011-05-06 22:43:37.541 SampleApp[1746:4403] [INFO] [CallBackHandler.m:132] =============================

2011-05-06 22:43:56.018 SampleApp[1746:40b] *** Terminating app due to uncaught exception 'SUPPersistenceException', reason: 'Illegal key generator status. It must be populated first by the server after a client call to beginOnlineLogin or subscribe'

  • Call stack at first throw:

(

0 CoreFoundation 0x013c75a9 __exceptionPreprocess + 185

1 libobjc.A.dylib 0x01783313 objc_exception_throw + 44

2 SampleApp 0x00006ff3 -[SampleApp_Customer setId_:] + 0

3 SampleApp 0x0003940e +[SampleApp_SampleAppDB subscribe] + 82

4 SampleApp 0x0004572f -[SampleApp run] + 539

5 SampleApp 0x00006d44 main + 90

6 SampleApp 0x00006ce1 start + 53

7 ??? 0x00000001 0x0 + 1

)

terminate called after throwing an instance of 'SUPPersistenceException'

Kind regards,

Richard Middelburg