ios - Objective-C/CocoaHTTPServer - Is it possible pass how response a NSString object? -
i'm using cocoahttpserver in project , need response simple request string. check incoming parameter , have created nsstring object string want return. don't know how return string. can't use "return xmllist" because xcode remember me pointer incompatible. server want result type nsobject. how can do?
- (nsobject<httpresponse> *)httpresponseformethod:(nsstring *)method uri:(nsstring *)path{ httplogtrace(); if ([path isequaltostring:@"/getphotos"]){ nsstring *xmllist = [[nsstring alloc] init]; myservermethods* myservermethods = [[myservermethods alloc] init]; xmllist = [myservermethods getphotos]; nslog(@"return photos list %@", xmllist); } return nil; }
thanks
ok, have resolved problem in mode:
if ([path isequaltostring:@"/getphotos"]){ nsstring *xmllist = [[nsstring alloc] init]; myservermethods* myservermethods = [[myservermethods alloc] init]; //first, create instance of myservermethods xmllist = [myservermethods getphotos]; nsdata* xmldata = [xmllist datausingencoding:nsutf8stringencoding]; httpdataresponse *xmlresponse = [[httpdataresponse alloc] initwithdata:xmldata]; return xmlresponse; }
Comments
Post a Comment