关于七牛云存储,HTTPS资源上传不成功问题

关于七牛云存储,HTTPS资源上传不成功问题

官方给出了一个解决方案,亲测可用。特此记录一下。

  • 找到QNConfiguration.m文件。然后重写两个方法,直接上代码。
  + (instancetype)createWithHost:(NSString *)up backupHost:(NSString *)backup ip1:(NSString *)ip1 ip2:(NSString *)ip2
{
    NSArray *ips = [NSArray arrayWithObjects:ip1, ip2, nil];
    NSString *a = [NSString stringWithFormat:@"https://%@", up];
    QNServiceAddress *s1 = [[QNServiceAddress alloc] init:a ips:ips];
    NSString *b = [NSString stringWithFormat:@"https://%@", backup];
    QNServiceAddress *s2 = [[QNServiceAddress alloc] init:b ips:ips];
    return [[QNFixedZone alloc] initWithUp:s1 upBackup:s2];
}
+ (instancetype)zone0
{
static QNZone *z0 = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        z0 = [QNZone createWithHost:@"upload.qbox.me" backupHost:@"up.qbox.me" ip1:@"183.136.139.16" ip2:@"183.136.139.16"]; });
    return z0;
}
posted @ 2017-01-09 11:49  懒懒初阳  阅读(2079)  评论(0编辑  收藏  举报