2012-12-27 37 views

回答

-2

您可以通過讀取URL的數據到一個NSData對象,像這樣

NSData *urlData = [NSData dataWithContentsOfURL:htmlURL]; 

或作爲一個NSString像

NSError *error=nil; 
NSString *htmlString = [NSString stringWithContentsOfURL:[NSURL URLWithString:htmlURL] encoding:NSUTF8StringEncoding error:&error]; 
+0

沒有kevinn nothin工作! – pradeepj

+0

你能證明你試過了什麼嗎? – akdsouza

+0

NSString * str = [[NSString alloc] initWithFormat:@「%@」,self.urlN]; NSURL * tutorialsUrl = [NSURL URLWithString:str]; NSData * urlData = [NSData dataWithContentsOfURL:tutorialsUrl]; – pradeepj

0
NSString* str=[[NSString alloc]initWithFormat:@"%@",@"http://mobiletraining.mcs.schoolinsites.com/?PageName=LatestNews&Section=Highlights&It%E2%80%8C%E2%80%8BemID=114932&ISrc=School&Itype=Highlights&SchoolID=172%0A%09%09"]; 
NSURL *tutorialsUrl = [NSURL URLWithString:str]; 
NSString *htmlString = [NSString stringWithContentsOfURL:tutorialsUrl encoding:NSUTF8StringEncoding error:nil]; 
NSLog(@"Your Html >> %@",htmlString); 
獲取HTML數據
+0

亞它現在正在工作 – pradeepj

+0

嘿,我可以得到唯一的目錄,我想在HTML? – pradeepj

+0

請你解釋..我無法理解... – Rajneesh071