1

データを取得するためにいくつかのパラメーターを wcf サービスに渡していますが、すべて正常に動作していますが、データを取得していません。パラメータがどのようにサービスを呼び出しているかを確認し、デバッグしたいと考えています。どなたか確認方法を教えていただけないでしょうか。参考までに、以下の私のコードを見つけてください。

NSArray *propertyNames = [NSArray arrayWithObjects:@"studentID",  nil];
    NSArray *propertyValues = [NSArray arrayWithObjects:@"E6A83233-7D7F-49AF-B54E-375BBF3E3E59", nil];

    NSDictionary *properties = [NSDictionary dictionaryWithObjects:propertyValues forKeys:propertyNames];
   // NSMutableDictionary* personObject = [NSMutableDictionary dictionary];
  // [personObject setObject:properties forKey:@"person"];
    NSMutableArray  * arr;
    //[arr addObject: personObject];
    arr=[[NSMutableArray alloc]initWithObjects:properties, nil];
    NSLog(@"%@",arr);
   // NSString *jsonString = [personObject JSONRepresentation];
    //NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
    NSError * error;
    NSData *jsonData2 = [NSJSONSerialization dataWithJSONObject:arr options:NSJSONWritingPrettyPrinted error:&error];

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://parentportal.technologyorg.com/parentportal.svc/GetSchoolEvents"]];
    NSString *jsonString = [[NSString alloc] initWithData:jsonData2 encoding:NSUTF8StringEncoding];
    [request setValue:jsonString forHTTPHeaderField:@"json"];
    [request setHTTPMethod:@"Post"];
    [request setHTTPBody:jsonData2];
    NSLog(@"JSON String: %@",jsonString);
    NSError *errorReturned = nil;
    NSURLResponse *theResponse =[[NSURLResponse alloc]init];
    NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&theResponse error:&errorReturned];
    if (errorReturned) {
        //...handle the error
        NSLog(@"error");
    }
    else {
        NSString *retVal = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
        //...do something with the returned value

        NSLog(@"RETVAL%@",retVal);
    }

何か問題があった場合はお知らせください

4

0 に答える 0