Dear Gianluca,
Thanks for your reply.
The code is as below:


//this line is for starting connection with lightstramer

- (void) viewDidAppearBOOL)animated{

if (![self isConnected]) {

[self connectWithLightStreamer];

}

}



//check ls connection status

- (BOOL) isConnected

{

return client.connected;

}




//connect to ls in background


- (void)connectWithLightStreamer

{

[self performSelectorInBackground:@selector(connectInBac kground) withObject:nil];


}



//connect to ls in background(private method)


- (void) connectInBackground

{

client = [[LSClient alloc] init];



LSConnectionInfo *connectioninfo = [LSConnectionInfo connectionInfoWithPushServerURL:LIGHTSTREAMER_CONN ECITON_ADDRESS pushServerControlURL:nil user:@"user" password:@"password" adapter:LIGHTSTREAMER_CONNECITON_ADAPTER];

[client openConnectionWithInfo:connectioninfo delegate:self];

}



//subscribeitems

- (void) subscribeItemsNSArray *)itemnames andTableKeyLSSubscribedTableKey *)tableKey {

NSLog(@"StockListViewController: Subscribing table...");



@try {

//itemNames is equal to group

//fieldNames is equal to schema

LSExtendedTableInfo *tableInfo= [LSExtendedTableInfo extendedTableInfoWithItems:itemnames mode:LSModeMerge fields:fieldNames dataAdapter:LIGHTSTREAMER_CONNECITON_DATAADAPTER snapshot:YES];



tableInfo.requestedMaxFrequency= 1.0;



tableKey = [client subscribeTableWithExtendedInfo:tableInfo delegate:self useCommandLogic:NO];

[self.tableKeys addObject:tableKey];

[self.itemNames addObject:itemnames];

NSLog(@"StockListViewController: Table subscribed");



} @catch (NSException *e) {

NSLog(@"StockListViewController: Table subscription failed due to exception: %@", e);

}

}



//unsubscribe items

- (void) unsubscribeItemsLSSubscribedTableKey *)tableKey {

NSLog(@"StockListViewController: Unsubscribing table...");



@try {

[client unsubscribeTable:tableKey];



[self.itemNames removeAllObjects];

NSLog(@"StockListViewController: Table unsubscribed");



} @catch (NSException *e) {

NSLog(@"StockListViewController: Table unsubscription failed due to exception: %@", e);

}

}



//clear ls resource(call this method when viewWillDisappear or viewDidDisappear

- (void) clearLightStreamerResource

{

if (client.connected) {

for (LSSubscribedTableKey *key in self.tableKeys) {

[self unsubscribeItems:key];

}

[self.tableKeys removeAllObjects];

[client closeConnection];

}



}


Sometimes light streamer doesn’t respond when unsubscribing and causes the application stop working or freezing or crash, specifically by poor internet connectivity.
So, I cannot use light streamer in the application with more than one page using light streamer.

Kind Regards,
Vahid