IOS应用中的Prestashop搜索API方法

IOS应用中的Prestashop搜索API方法,ios,xcode,api,search,prestashop,Ios,Xcode,Api,Search,Prestashop,我正在构建我的第一个IOS应用程序,目前我正在将我的应用程序与我的Prestashop网站集成。我已经从数据库中获取了大量数据,但是使用他们的API中的搜索方法运气不太好 我已经成功地调用了RESTAPI并通过了服务器的身份验证。我得到的响应状态代码是200,因此通过身份验证一切正常,但是我从服务器收到的数据是HTML格式的网站主页,而不是带有搜索结果的XML文件 下面我将列出我用来访问Prestashop服务器的部分代码 NSURL *url = [NSURL URLWithString:[N

我正在构建我的第一个IOS应用程序,目前我正在将我的应用程序与我的Prestashop网站集成。我已经从数据库中获取了大量数据,但是使用他们的API中的搜索方法运气不太好

我已经成功地调用了RESTAPI并通过了服务器的身份验证。我得到的响应状态代码是200,因此通过身份验证一切正常,但是我从服务器收到的数据是HTML格式的网站主页,而不是带有搜索结果的XML文件

下面我将列出我用来访问Prestashop服务器的部分代码

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.******.com:443/api/search/?query=%@&language=1",searchTerm]];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];

NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
这是我用来建立到Prestashop服务器的连接的方法

-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
{
    NSLog(@"Test 1.5");
    [self clearCookiesForURL];
    if([challenge previousFailureCount]==0)
    {
        NSURLCredential *credential = [NSURLCredential credentialWithUser:@"(I'm omitting the credential key but it does work)" password:@"" persistence:NSURLCredentialPersistenceForSession];
        NSLog(@"Credential : %@",credential);
        //NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];

        [challenge.sender useCredential:credential forAuthenticationChallenge:challenge];
    } else{
        [[challenge sender] cancelAuthenticationChallenge:challenge];
    }
}
这就是我的身份验证方法。我已经实例化了所有其他连接方法(canAuthenticateAgainstProtectionSpace、didReceiveResponse、didReceiveData等),它们都被调用并且工作正常

NSLog(@"Data After : %@",responseData);
NSString *tempString;
tempString = [[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding];
NSLog(@"String : %@",tempString);
这是我用来将从服务器获取的数据转换成字符串的代码部分(我原以为是XML,但实际上是HTML)

有人能看出我做错了什么吗?任何帮助都将不胜感激