Firebase Task finished with error - code: -1200 - ios

I am unable to access data from Firebase storage on my iOS app on my current connection. When I connect to a VPN, it allows me to connect and download data from Firebase Storage normally. I have also tried to allow arbitrary loads but to no use. Any suggestions?
The following is the code:
let tempImageRef = storage.child("CoverArt/Issue15.jpg")
tempImageRef.getData(maxSize: 1*1000*1000) { (data, error) in
if (error == nil)
{ //Do something }
else { print(error!.localizedDescription) } }
The following is the error:
Task <D343DC6F-2D37-4246-A0BA-4044BF36C83D>.<1> finished with error - code: -1200 An unknown error occurred, please check the server response.
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

Related

BrainTree DropIn credit card example

I am trying to integrate BrainTree with ios using DropIn UI.
I succeeded to show the UI and when I use the test card
Number: 4111111111111111
Exp: 09/2020
It shows message
"Please review your information and try again"
let request = BTDropInRequest()
request.amount = "100"
request.paypalDisabled = true
request.shouldMaskSecurityCode = true
let dropIn = BTDropInController(authorization: tokenizationKey, request: request)
{ (controller, result, error) in
if (error != nil) {
print("ERROR = \(error?.localizedDescription ?? "")")
} else if (result?.isCancelled == true) {
print("CANCELLED")
} else if let result = result {
print("Payment Description = \(result.paymentDescription)")
print("paymentOptionType = \(result.paymentOptionType)")
print("paymentMethod = \(result.paymentMethod?.type ?? "")")
print("isCancelled = \(result.isCancelled)")
// Use the BTDropInResult properties to update your UI
// result.paymentOptionType = .
}
controller.dismiss(animated: true, completion: nil)
}
viewController.present(dropIn!, animated: true, completion: nil)
And here is the log when I click on Add Card
-canOpenURL: failed for URL: "com.venmo.touch.v2://x-callback-url/vzero/auth" - error: "This app is not allowed to query for scheme com.venmo.touch.v2"
TIC TCP Conn Failed [25:0x28008b3c0]: 12:8 Err(-65554)
Task .<2> HTTP load failed (error code: -1003 [12:8])
Task .<2> finished with error - code: -1003
TIC TCP Conn Failed [26:0x2800889c0]: 12:8 Err(-65554)
Task <650E9BB8-3AF6-4076-A6C4-977D0435B161>.<5> HTTP load failed (error code: -1003 [12:8])
Task <650E9BB8-3AF6-4076-A6C4-977D0435B161>.<5> finished with error - code: -1003
[BraintreeSDK] WARNING Failed to flush analytics events: A server with the specified hostname could not be found.
It seems that sandbox doesn't work on a real device when I switched to a simulator, request succeeded after adding a credit card details.
After changing to the production environment the same problem existed, After a several tries I changed from Wifi to LTE as connection in my iPhone device, and it worked! it seems that my ISP has no DNS for production Braintree backend

TIC SSL Trust Error while accessing data from https url

I have tried to access data from a https url by following.
DispatchQueue.global(qos: .background).async {
let stringURL = "https://192.168.104.91:8443/update_info.xml"
let url = URL(string: stringURL)
var data:Data? = nil
do {
data = try Data(contentsOf: url!)
} catch {
print(error.localizedDescription)
}
}
But i am getting following error.
2018-03-21 12:49:35.529949+0600 AppName[704:205346] TIC SSL Trust Error [1:0x1c0171a00]: 3:0
2018-03-21 12:49:35.541223+0600 AppName[704:205346] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2018-03-21 12:49:35.541283+0600 AppName[704:205346] Task <7D4A1063-B946-4588-830A-CE73AF5B4995>.<0> HTTP load failed (error code: -1202 [3:-9813])
2018-03-21 12:49:35.541771+0600 AppName[704:205344] NSURLConnection finished with error - code -1202
The file “update_info.xml” couldn’t be opened.
Any suggestions ?

iOS - Firebase call neither sends error nor response

When I delete the app and run the following code -> gives the response.
But when I run the same code second time -> I get no response.
FIRDatabase.database().reference().child("wall").child(userId).queryLimited(toLast: limit).observeSingleEvent(of: .value, with: { (snapshot) in
print("response")
}) { (error) in
print(error)
debugPrint(error.localizedDescription)
}
Sometimes it throws ->
NSURLSession/NSURLConnection HTTP load failed
(kCFStreamErrorDomainSSL, -9802)
And most of the time neither the response nor the error is thrown.
Any guesses what is wrong ?
P.S:
I've my plist as:
Most amazing thing is Firebase function call is not even sending error ??

Firebase Anonymous Login fails after Xcode Update

My anonymous login for Firebase was working for months; however, when Xcode forced me to install some updates, it couldn't find some pods. After deleting those pods after running pod update, the project will now build; however, while attempting the anonymous login, I get this error:
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
If I wait long enough, I get error messages like this:
[Client] Discarding message for event <private> because of too many unprocessed messages
Here is my login method:
func login(onCompletion: #escaping (NSError?) -> Void) {
print("authenticating user")
FIRAuth.auth()?.signInAnonymously(completion: { result, error in
guard error == nil else {
print("error while authenticating user")
onCompletion(loginError)
return
}
if let user = result {
self.defaults.set(user.uid, forKey: "uid")
onCompletion(nil)
} else {
onCompletion(loginError)
}
})
}
which is called in the root view controller's viewDidLoad.
I still don't know what the issue was, but it was specific to the project. I created a new project and pulled the code from github and now it works like normal.

Error when downloading from Firebase storage

I am trying to get basic upload/download working with the new Firebase storage. Uploading worked fine but I am unable to download the file to the device. Can someone please shed some light on what I am doing wrong. Thanks!
func downloadAudio() {
let storageRef = FIRStorage.storage().reference()
let pathReference = storageRef.child("testAudio/audio_test.m4a")
let localURL = getDocumentsDirectory().URLByAppendingPathComponent("audio_test2.m4a")
let downloadTask = pathReference.writeToFile(localURL) { (URL, error) -> Void in
if (error != nil) {
print("ERROR - ", error.debugDescription)
} else {
print("SUCCESS - ", URL)
}
}
}
PRINTS:
ERROR - Optional(Error Domain=FIRStorageErrorDomain Code=-13000 "An unknown error occurred, please check the server response." UserInfo={ResponseErrorDomain=NSCocoaErrorDomain, object=testAudio/audio_test.m4a, NSURL=/Users/Ben/Library/Developer/CoreSimulator/Devices/02AF50F2-E9BE-4EED-A3BE-485D63264731/data/Containers/Data/Application/31BDED56-0135-4E70-943E-F897080768D6/Documents/, bucket=mydevslopesapp.appspot.com, ResponseErrorCode=518, NSLocalizedDescription=An unknown error occurred, please check the server response.})
This is not a storage error, it's actually an issue with the file you're attempting to write to.
Looks like URLByAppengingString should be fileURLWithPath to get a file system URL (per NSFileManager creating directory error 518 NSFileWriteUnsupportedSchemeError).
Long term we need to fish this out and serve it as a "see relevant error" rather than "read network response."

Resources