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];
}
你想從其他類調用解析器? – 2011-04-22 08:09:23
@ViTO兄弟:是的.. – user720235 2011-04-22 08:12:52
你可以在你想要調用它的女巫班級中創建解析器! – 2011-04-22 08:14:02