dear all,
in spliview based app, once tap file name located on main view panel, 1 jsp (that lies on server) called , jsp returns file location on server. create nsurlconnection object stram file location , save file application document directory. once streaming completed, pass file's local location (as id type) detailitem in detilviewcontroller. , file viewed in uiwebview in detailview.
happening properly.
want jsp called , while takes time stream file locally , activityindicator should rotate in detailview, user has ad idea happening.and file loaded in webview (after file streamed , available locally), indicator stopped.
sure has delegat method of nsurlconnection, unable implement properly. also, know exact file size tapped file (is of use?? may if use progressbar).
part of code is:
any idea appreciated!!code:- (void)tableview: (uitableview *)tableview didselectrowatindexpath: (nsindexpath *)indexpath { nsstring *post = [nsstring stringwithformat:@"docid=%@",docid]; nsdata *postdata = [post datausingencoding:nsasciistringencoding allowlossyconversion:yes]; nsmutableurlrequest *request= [[[nsmutableurlrequest alloc] init] autorelease]; file_expected_size=[[file_size_list objectatindex:indexpath.row] longlongvalue]; [request seturl:[nsurl urlwithstring:[nsstring stringwithformat:@"%@%@",dv_instance,@"/jsp/dv3_createfilelink_ipad.jsp"]]]; [request sethttpmethod:@"post"]; [request sethttpbody: postdata]; nsurlconnection *conn = [[nsurlconnection alloc] initwithrequest:request delegate:self]; if(conn){ nsurlresponse *response; nsdata *data = [nsurlconnection sendsynchronousrequest:request returningresponse:&response error:nil]; nsstring *serveroutput= [[nsstring alloc]initwithdata:data encoding:nsasciistringencoding]; nsstring *stringurl = [serveroutput stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]]; nsurl *url_for_filetapped_on_server = [nsurl urlwithstring:stringurl]; nsdata *data_of_file = [nsdata datawithcontentsofurl:url_for_filetapped_on_server]; // determine local file path (which relative_local_file_full_path) , detailview.detailitem =relative_local_file_full_path; (where detailview object of class detailviewcontroller) } }
don't use sendsynchronousrequest: instead use 1 of asynchronous request methods. there several reasons it's impossible show progress if use synchronous method.
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
No comments:
Post a Comment