小编Iro*_*Man的帖子

https连接中的NSURLSession/NSURLConnection HTTP加载失败(kCFStreamErrorDomainSSL,-9802)错误

在iOS 9中,我使用基本的NSURLConnection命令使用网址https://s3.amazonaws.com/furniture.retailcatalog.us/products/2061/6262u9665.jpg.

NSOperationQueue *completionQueue = [NSOperationQueue mainQueue];
    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
    self.mURLSession = [NSURLSession sessionWithConfiguration:configuration delegate:nil delegateQueue:completionQueue];

    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://s3.amazonaws.com/furniture.retailcatalog.us/products/2061/6262u9665.jpg"]];
    NSURLSessionDataTask *dataTask = [self.mURLSession dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        NSLog(@"%@",error);
    }];
    [dataTask resume];
Run Code Online (Sandbox Code Playgroud)

但得到这个错误

错误域= NSURLErrorDomain代码= -1200"发生SSL错误,无法与服务器建立安全连接." UserInfo = {NSLocalizedDescription =发生了SSL错误并且无法与服务器建立安全连接.,NSLocalizedRecoverySuggestion =您是否还要连接到服务器?,_kCFStreamErrorDomainKey = 3,NSUnderlyingError = 0x7c1075e0 {错误域= kCFErrorDomainCFNetwork代码= - 1200"(null)"UserInfo = {_ kCFStreamPropertySSLClientCertificateState = 0,_kCFNetworkCFStreamSSLErrorOriginalValue = -9802,_kCFStreamErrorCodeKey = -9802,_kCFStreamErrorDomainKey = 3,kCFStreamPropertySSLPeerTrust =,kCFStreamPropertySSLPeerCertificates = {type = immutable,count = 3,values =(0:1:2: }}}},_ kCFStreamErrorCodeKey …

iphone https objective-c amazon-s3 ios9

14
推荐指数
2
解决办法
1万
查看次数

WhatsApp图像共享iOS

我正在开发一个iOS应用程序,我必须在我的应用程序上分享WhatsApp上的图像.我找到了这段代码,但它只处理文本共享https://github.com/jberlana/JBWhatsAppActivity

iphone objective-c ios whatsapp

8
推荐指数
1
解决办法
9221
查看次数

在NSInvocation中为具有可变参数的方法传递多个参数

我有一个方法,它采用类似这样的变量参数,参数以nil结尾.

-(void)manyParams:(NSString *)st, ... {
    va_list argList;
    va_start(argList,st);

    id obj;

    while ((obj = va_arg(argList, id))) {
        NSLog(@"%@",obj);
    }
    va_end(argList);

    return;
}
Run Code Online (Sandbox Code Playgroud)

我可以像这样直接调用它

[self manyParams:@"one",@"two",@"three",nil];
Run Code Online (Sandbox Code Playgroud)

如果我使用NSInvocation类来调用manyParams,那么我该怎么做呢

NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:self];
[invocation setSelector:@selector(manyParams:)];
///NSString *one = @"one";
///[invocation setArgument:&one atIndex:2]; //////How to pass variable arguments like @"one",@"two",@"three", nil
[invocation invoke];
Run Code Online (Sandbox Code Playgroud)

macos objective-c ios

3
推荐指数
1
解决办法
823
查看次数

标签 统计

objective-c ×3

ios ×2

iphone ×2

amazon-s3 ×1

https ×1

ios9 ×1

macos ×1

whatsapp ×1