在viewdidload方法中调用方法

时间:2011-04-22 08:04:25

标签: iphone

我正在尝试创建通过Web服务提供客户信息的应用程序。我已经在appdelgate类中编写代码进行解析。如何在rootviewcontroller方法的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];
}

1 个答案:

答案 0 :(得分:0)

你可以在类中创建你想要使用它的解析器......或者你可以在一个类中创建Parser,从另一个类中调用它并给你想要的类女巫的代表......

相关问题