UIWebView无法识别URL地址

时间:2012-05-13 16:52:48

标签: iphone ios uiwebview nsxmlparser

我已经构建了一个XML Parse应用程序,它从PHP(XML Content)文件中检索我的数据库中的一些值,其中一个值我有一个URL,问题是,每次我尝试加载webView使用此URL没有任何反应!我有以下代码:

-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {

    if ( [elementName isEqualToString:@"users"] ) {

        [messages addObject:[NSDictionary dictionaryWithObjectsAndKeys:msgIDEN,@"id",msgAdded,@"added",msgUsername,@"username",msgEmail,@"email",msgMainCode,@"maincode",msgPictureAddress,@"userpictureaddress",nil]];

        [[messages reverseObjectEnumerator] allObjects];

        lastId = msgId;

        [msgAdded release];
        [msgUsername release];
        [msgEmail release];
        [msgMainCode release];
        [msgPictureAddress release];

        NSLog(@"UserData:Success");
        NSString *urlAddress = msgPictureAddress;
        NSURL *url = [NSURL URLWithString:urlAddress];
        NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
        [webViewMateus loadRequest:requestObj];


    }

    if ( [elementName isEqualToString:@"id"] )                  { inIDEN = NO;  }
    if ( [elementName isEqualToString:@"username"] )            { inUsername = NO;  }
    if ( [elementName isEqualToString:@"email"] )               { inEmail = NO;  }
    if ( [elementName isEqualToString:@"usermaincode"] )        { inMainCode = NO;  }
    if ( [elementName isEqualToString:@"userpictureaddress"] )  { inPictureAddress = NO;  }

}

如何让UIWebView地址与我的NSMutableString = userpictureaddress相同?

1 个答案:

答案 0 :(得分:0)

如果查看代码,只需将msgPictureAddress丢弃(释放),然后再将其分配给urlAddress。你确定你当时想发布那些东西吗?