0
votes

I am trying to upload a file image to the content but i get this error.

error: Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSUnderlyingError=0x162007a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, _kCFStreamPropertySSLClientCertificateState=0, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorCodeKey=-9802, kCFStreamPropertySSLPeerTrust=, _kCFStreamErrorDomainKey=3, kCFStreamPropertySSLPeerCertificates={type = immutable, count = 3, values = ( 0 : 1 : 2 : )}, NSErrorFailingURLStringKey=https://qbprod.s3.amazonaws.com/, NSErrorFailingURLKey=https://qbprod.s3.amazonaws.com/}}, _kCFStreamErrorCodeKey=-9802, NSErrorFailingURLStringKey=https://qbprod.s3.amazonaws.com/, NSErrorPeerCertificateChainKey={type = immutable, count = 3, values = ( 0 : 1 : 2 : )}, NSErrorClientCertificateStateKey=0, NSURLErrorFailingURLPeerTrustErrorKey=, NSErrorFailingURLKey=https://qbprod.s3.amazonaws.com/}

1
Hi kader, do you use iOS 9? It might be ATS problem. Please take a look at QB repo github.com/QuickBlox/quickblox-ios-sdkSevenDays

1 Answers

1
votes

I used the below code to upload file and it worked perfectly.

let imageData: NSData = UIImagePNGRepresentation(image)!

QBRequest.TUploadFile(imageData, 
                      fileName: "testimage.png", 
                      contentType: "image/png", 
                      isPublic: false, 
                      successBlock: {(response: QBResponse!, uploadedBlob: QBCBlob!) in 
                      /** You get success with updated blob **/
                      }, statusBlock: {(request: QBRequest?, status: QBRequestStatus?) in 

                      },
                      errorBlock: {(response: QBResponse!) in 

                      })