プロジェクトで CocoaHTTPServer を使用していますが、単純な GET リクエストに文字列で応答する必要があります。だから私は着信パラメータをチェックし、私が返したい文字列で NSString オブジェクトを作成しました。しかし、この文字列を返す方法がわかりません。xcodeはポインターに互換性がないことを覚えているため、明らかに「return xmlList」を使用できません。サーバーは結果の型 NSObject を必要としています。どのようにできるのか?
- (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;
}
ありがとう