我正在使用 Xcode 为 iPhone 应用程序编写登录代码,但我的代码似乎无法读取我的本地 xml 文件 login.xml
- (void)viewDidUnload
{
[super viewDidUnload];
users =[[NSMutableArray alloc] init];
NSString *path = [[NSBundle mainBundle] pathForResource: @"login" ofType:@"xml" inDirectory:(@"Users/roaalturki/Desktop")];
NSURL *xmlurl = [NSURL fileURLWithPath:path];
xmlparsser=[[NSXMLParser alloc] initWithContentsOfURL:xmlurl];
[xmlparsser setDelegate:self];
[xmlparsser parse];
}
-(void) parser: (NSXMLParser *) parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
currentelement=[elementName copy];
if ([elementName isEqualToString:@"username"]) {
item =[[NSMutableDictionary alloc]init];
currentuser =[[NSMutableString alloc]init];
currentpassword=[[NSMutableString alloc]init];
}
}