! コンソール -- ログ[http://i.stack.imgur.com/pIWvV.png] こんにちは。
私たちはこの技術の初心者です。3 つの入力パラメーター (airlineid、connectionid.flightdate) を持つフライトの詳細という名前の MBO を作成しました。そして、対応するobjective-cコードを生成しました。これで、次のようにサーバーに接続するための手順に従いました。
#import "ConnectionController.h"
#import "SUPApplication.h"
#import "flightDetailsTest_Flightdetails_v1DB.h"
#import "CallbackHandler.h"
#import "SUPConnectionStatus.h"
#import "SUPConnectionProfile.h"
@interface ConnectionController()
@property (nonatomic, retain) CallbackHandler *callbackHandler;
@end
@implementation ConnectionController
@synthesize callbackHandler;
static ConnectionController *appConnectionController;
+(void)beginApplicationSetup
{
NSLog(@"inside controller");
if(!appConnectionController)
{
NSLog(@"inside appconnectioncontroller");
appConnectionController = [[[ConnectionController alloc] init] retain];
appConnectionController.callbackHandler = [[CallbackHandler getInstance] retain];
NSLog(@"end of it");
}
if([SUPApplication connectionStatus] == SUPConnectionStatus_DISCONNECTED)
{
NSLog(@"comparision method");
[appConnectionController setupApplicationConnection];
NSLog(@"end of comparision method");
}
else {
NSLog(@"Already Connected");
}
}
//end of beginApplication
-(BOOL)setupApplicationConnection{
NSLog(@"inside bool1");
SUPApplication *app = [SUPApplication getInstance];
[app setApplicationIdentifier:@"HWC"];
[app setApplicationCallback:self.callbackHandler];
NSLog(@"inside bool2");
SUPConnectionProperties *properties = [app connectionProperties];
NSLog(@"servername");
[properties setServerName:@"sapeccehp5.xxx.com"];
NSLog(@"inside bool2+line1");
[properties setPortNumber:5001];
NSLog(@"middle bool2");
[properties setFarmId:0];
NSLog(@"inside bool2+line3");
[properties setUrlSuffix:@"/tm/?cid=%cid%"];
NSLog(@"inside bool2+line4");
[properties setNetworkProtocol:@"http"];
NSLog(@"inside bool3");
SUPLoginCredentials *loginCred =[SUPLoginCredentials getInstance];
[loginCred setUsername:@"ourmac"];
[loginCred setPassword:nil];
[properties setLoginCredentials:loginCred];
[properties setActivationCode:@"1234"];
NSLog(@"end of bool3");
if(![flightDetailsTest_Flightdetails_v1DB databaseExists])
{
NSLog(@"inside dbif");
[flightDetailsTest_Flightdetails_v1DB createDatabase];
}
NSLog(@"profile start out if");
SUPConnectionProfile *connProfile = [flightDetailsTest_Flightdetails_v1DB getSynchronizationProfile];
NSLog(@"start connection profile");
[connProfile setClientId:@"0" ];
NSLog(@"clientid");
[connProfile setDomainName:@"Development"];
NSLog(@"domain");
[connProfile setUser:@"ourmac"];
NSLog(@"user");
[connProfile setPassword:@"password"];
NSLog(@"pass");
// [connProfile setNetworkProtocol:@"http"];
NSLog(@"netowrk");
// [connProfile setPortNumber:2480];
NSLog(@"port");
// [connProfile setServerName:@"sapeccehp5.xxx.com"];
// [connProfile setAsyncReplay:YES];
[flightDetailsTest_Flightdetails_v1DB registerCallbackHandler:self.callbackHandler];
[flightDetailsTest_Flightdetails_v1DB setApplication:app];
if([SUPApplication registrationStatus] == SUPRegistrationStatus_REGISTERED)
{
[app startConnection:0];
}
else{
[app registerApplication:0];
}
}
@end
// and we have wrote the viewcontroller.m file as follows
-(IBAction)SearchAction:(id)sender{
@try{
[ConnectionController beginApplicationSetup];
NSLog(@"inside applicationsetup");
}
@catch (NSException *exception) {
//[MessagingClientLib resetMessagingState];
NSLog (@"Error-ConnectionAborted");
}
@try {
[flightDetailsTest_Flightdetails_v1DB synchronize];
NSLog(@"inside synchronise");
}
@catch (NSException *exception) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Synchronisation error"
message:@"Error-Please make sure that u r connected"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil ];
[alert show];
[alert release];
}
SUPObjectList *list =[flightDetailsSessionPersonalization findAll];
NSLog(@"inside the list");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"number of leaves" message:[NSString stringWithFormat:@"%d lines syncd",[list length]] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
NSDateFormatter *temp = [[NSDateFormatter alloc] init];
[temp setDateFormat:@"dd.mm.yyyy"];
NSDate *date = [temp dateFromString:flightDate.text];
flightDetailsPersonalizationParameters *pp = [flightDetailsTest_Flightdetails_v1DB getPersonalizationParameters];
[pp setPK_AIRLINEID:airlineID.text] ;
[pp setPK_CONNECTIONID:connID.text];
[pp setPK_FLIGHTDATE:date];
[pp save];
while([flightDetailsTest_Flightdetails_v1DB hasPendingOperations]){
[NSThread sleepForTimeInterval:2];
}
[flightDetailsTest_Flightdetails_v1DB beginSynchronize];
SUPObjectList *details = [flightDetailsflightdetails findAll];
NSLog(@"flights on date %d",[details length]);
}
ステータスを 103 として表示しています。つまり、接続されていますが、データを取得していません。コンソールのステータスがここに添付されています。これを確認して、解決策を見つけてください..