2011-04-22 36 views
0

我正在嘗試創建通過Web服務提供客戶信息的應用程序。我已經在appdelgate類中編寫代碼進行解析。如何在rootviewcontroller類的viewdidload方法中調用此方法?這裏是我的代碼:在viewdidload方法中調用方法

- (void)applicationDidFinishLaunching:(UIApplication *)application 
{ 

    NSURL *url = [[NSURL alloc] initWithString:@"http://192.168.0.218:84/WebServiceCustomerByAmit/Service.asmx/GetWholeCustomerInformation"]; 
    NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; 
    //Initialize the delegate. 
    XMLParser *parser = [[XMLParser alloc] initXMLParser]; 
    //Set delegate 
    [xmlParser setDelegate:parser]; 
    //Start parsing the XML file. 
    BOOL success = [xmlParser parse]; 
    if(success) 
     NSLog(@"No Errors"); 
    else 
     NSLog(@"Error Error Error!!!"); 
    [window addSubview:[navigationController view]]; 
    [window makeKeyAndVisible]; 
    [navigationController release]; 
} 
+0

你想從其他類調用解析器? – 2011-04-22 08:09:23

+0

@ViTO兄弟:是的.. – user720235 2011-04-22 08:12:52

+0

你可以在你想要調用它的女巫班級中創建解析器! – 2011-04-22 08:14:02

回答

0

你可以在你想用它在女巫類中創建解析器...或者你可以在一個類中創建解析器從另一個調用它,並且給了巫類的代表你想...

相關問題