您是否正受到短信签名报备的困扰?互亿无线解决方案让您最快15分钟内恢复信息传递,马上 注册体验
所有文档
企业信息核验
文档中心 > 企业信息核验 > 企业资质证书

企业资质证书

Objective-C对接提交查询接口DEMO示例

本文为您提供了Objective-C语言版本的提交查询接口对接DEMO示例



#import <Foundation/Foundation.h>

// 简单的HTTP POST请求示例
void sendSimplePostRequest() {
    // 创建URL
    NSURL *url = [NSURL URLWithString:@"https://api.ihuyi.com/idcard/entcert/Submit.json"];
    
    // 创建请求
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    [request setHTTPMethod:@"POST"];
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    
    // 准备表单数据
    NSString *postString = @"account=xxxxxxxx&password=xxxxxxxxx&ent_name=上海************有限公司&ent_code=913******&organization_code=403925******®_no=403925******&license_name_list=1&have_history=1&page_index=1&page_size=50&time=1623643787&";
    NSData *postData = [postString dataUsingEncoding:NSUTF8StringEncoding];
    [request setHTTPBody:postData];
    
    // 发送请求
    NSURLSession *session = [NSURLSession sharedSession];
    NSURLSessionDataTask *task = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        if (error) {
            NSLog(@"错误: %@", error.localizedDescription);
            return;
        }
        
        NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
        NSLog(@"响应: %@", responseString);
    }];
    
    [task resume];
}

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSLog(@"发送请求...");
        sendSimplePostRequest();
        // 等待请求完成
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]];
    }
    return 0;
}

5分钟快速自助开通免费体验账户

在线咨询
电话咨询

服务热线:

4008 808 898

服务热线(工作时间):

4008 808 898

业务咨询(非工作时间):

售后咨询(非工作时间):