宅男噜噜噜66在线观看,亚洲精品一区二区三区精品,亚洲一区二区三区乱码在线欧洲,亚洲精品久久麻豆蜜桃,亚洲色无色a片一区二区

您是否正受到短信簽名報(bào)備的困擾?互億無(wú)線(xiàn)解決方案讓您最快15分鐘內(nèi)恢復(fù)信息傳遞,馬上 注冊(cè)體驗(yàn)。
所有文檔
銀行信息核驗(yàn)
運(yùn)營(yíng)商信息核驗(yàn)
文檔中心 > 運(yùn)營(yíng)商信息核驗(yàn) > 空號(hào)檢測(cè)

空號(hào)檢測(cè)

Objective-C對(duì)接空號(hào)檢測(cè)提交接口接口DEMO示例
本文為您提供了Objective-C語(yǔ)言版本的空號(hào)檢測(cè)提交接口接口對(duì)接DEMO示例


#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // 定義請(qǐng)求的基礎(chǔ)信息
        NSString *host = @"api.ihuyi.com";
        NSString *path = @"/empty-number/submit";
        NSString *urlString = [NSString stringWithFormat:@"http://%@%@", host, path];
        NSURL *url = [NSURL URLWithString:urlString];
        
        // 定義signature變量
        NSString *signature = @"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // 請(qǐng)?zhí)鎿Q為您的鑒權(quán)簽名
        
        // 定義請(qǐng)求的數(shù)據(jù)
        NSMutableDictionary *values = [NSMutableDictionary dictionaryWithDictionary:@{
            @"mobiles": @[@"18800000000", @"18800000001"], //手機(jī)號(hào)數(shù)組(最多10個(gè))
        }];
        
        // 將數(shù)據(jù)轉(zhuǎn)換為JSON數(shù)據(jù)
        NSError *error = nil;
        NSData *jsonData = [NSJSONSerialization dataWithJSONObject:values 
                                                           options:0 
                                                             error:&error];
        
        if (error) {
            NSLog(@"JSON序列化錯(cuò)誤: %@", error.localizedDescription);
            return 1;
        }

        // 創(chuàng)建請(qǐng)求對(duì)象
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
                                                      cachePolicy:NSURLRequestReloadIgnoringCacheData
                                                  timeoutInterval:30.0];

        // 設(shè)置請(qǐng)求方法和頭部
        [request setHTTPMethod:@"POST"];
        [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
        [request setValue:@"Tue, 26 Aug 2025 07:14:23 GMT" forHTTPHeaderField:@"Date"];
        [request setValue:[NSString stringWithFormat:@"Signature %@" , signature] forHTTPHeaderField:@"Authorization"];

        // 設(shè)置請(qǐng)求體
        [request setHTTPBody:jsonData];

        // 創(chuàng)建會(huì)話(huà)和任務(wù)
        NSURLSession *session = [NSURLSession sharedSession];
        NSURLSessionDataTask *task = [session dataTaskWithRequest:request
                                        completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
                                            if (error) {
                                                NSLog(@"請(qǐng)求錯(cuò)誤: %@", error.localizedDescription);
                                                return;
                                            }
                                            
                                            // 處理響應(yīng)
                                            NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
                                            NSLog(@"狀態(tài)碼: %ld", (long)httpResponse.statusCode);
                                            
                                            if (data) {
                                                NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                                                NSLog(@"響應(yīng)內(nèi)容: %@", responseString);
                                            }
                                        }];

        [task resume];

        // 保持程序運(yùn)行直到請(qǐng)求完成(僅用于測(cè)試)
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:5.0]];
    }
    return 0;
}

5分鐘快速自助開(kāi)通免費(fèi)體驗(yàn)賬戶(hù)

在線(xiàn)咨詢(xún)
電話(huà)咨詢(xún)

服務(wù)熱線(xiàn):

4008 808 898

服務(wù)熱線(xiàn)(工作時(shí)間):

4008 808 898

業(yè)務(wù)咨詢(xún)(非工作時(shí)間):

售后咨詢(xún)(非工作時(shí)間):