看板 MacDev 關於我們 聯絡資訊
※ 引述《appleway (蘋果愛天空)》之銘言: : ※ 引述《yueyajbdt (碳烤焦貓)》之銘言: : : http://www.uow.edu.au/handbook/yr2011/ug/arts/H11005889.html : : 我正嘗試解析這個網頁,目前的進度是可以順利的加載到WebView上 : : 但由於資料太多太佔空間,想截取某部份的資訊 : : <div id="column-main" class="grid_14"> - </div>的部份 : : 經過咕狗之後發現有個叫NSURLConnection的東西可以處裡下載下來的資訊 : : 在- (void)connection:(NSURLConnection *)connection didRecieveData: : : (NSData *)data : : { } 裡可以處裡 : : 用了NSLog(@"%@", data)去看裡面的data發覺全部都是意義不明的數字 : : <3c211444f 4354950 45206874.........>一長串 : 試試看下面兩行。你可以看到html code : NSString *html = [[NSString alloc] initWithData:data : encoding:NSUTF8StringEncoding]; : NSLog(@"%@", html); https://github.com/mwaterfall/MWFeedParser/blob/master/Classes/MWFeedParser.m 請自己參考391~426行 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.251.162