Lottie-ios: Repeated "nil host used in call to allowsSpecificHTTPSCertificateForHost" in Log

Created on 13 Sep 2020  Â·  32Comments  Â·  Source: airbnb/lottie-ios

Check these before submitting:

  • [x] The issue doesn't involve an Unsupported Feature
  • [x] This issue isn't related to another open issue

This issue is a:

  • [x] Non-Crashing Bug (Visual or otherwise)
  • [] Crashing Bug
  • [] Feature Request
  • [] Regression (Something that once worked, but doesn't work anymore)

Which Version of Lottie are you using?

Lottie 3.0

What Platform are you on?

  • [] MacOS
  • [x] iOS

What Language are you in?

  • [x] Swift
  • [] Objective-C

Expected Behavior


Loads animation without issues.

Actual Behavior


Loads animation without issues, but in the debug logs, this is what it spams me with 18 times:

2020-09-13 04:45:20.335076-0400 AppName[8898:1527281] nil host used in call to allowsSpecificHTTPSCertificateForHost
2020-09-13 04:45:20.335111-0400 AppName[8898:1527281] nil host used in call to allowsAnyHTTPSCertificateForHost:

Code Example

In Collection View Cell:

var animationView = AnimationView()

In cellForItemAt:

cell.animationView.animation = Animation.named("myMandela")
cell.animationView.layer.masksToBounds = true
cell.animationView.contentMode = .scaleAspectFill
cell.animationView.play()
cell.animationView.loopMode = .loop
cell.animationView.backgroundBehavior = .pauseAndRestore

When I remove cell.animationView.animation = Animation.named("myMandela"), everything works fine—no errors in log.

This happens on iOS 14 beta physical device & simulator using Xcode 12 Beta.

Animation JSON


The JSON file is enormous. I will email it.

Most helpful comment

Facing same issue using 3.2.0 release.

All 32 comments

Same here

I'm facing same issue.

This is still an issue with iOS 14.0 release on physical device and simulator using Xcode 12 GM.

Yes, the same issue for Ionic ios app on the emulator.

The same issue

Same issue here. It appears this error shows up in the log when embedded image assets (jpeg, png) is in the json file. Tried files from my own animation with and without embed image assets and from lottiefiles.com and the results are consistent. I am using the bodymovin plugin to export my animations from AE.

The same issue
2020-09-29 11:15:56.979597+0800 zhenghaoban[22354:752056] nil host used in call to allowsAnyHTTPSCertificateForHost:
2020-09-29 11:15:56.980136+0800 zhenghaoban[22354:752056] nil host used in call to allowsSpecificHTTPSCertificateForHost
2020-09-29 11:15:56.980226+0800 zhenghaoban[22354:752056] nil host used in call to allowsAnyHTTPSCertificateForHost:
2020-09-29 11:15:56.980755+0800 zhenghaoban[22354:752056] nil host used in call to allowsSpecificHTTPSCertificateForHost
2020-09-29 11:15:56.980840+0800 zhenghaoban[22354:752056] nil host used in call to allowsAnyHTTPSCertificateForHost:

Same here... hope this gets fixed cause it's really slowing down the app... a lot!
I even tried to use the "animationCache" but I still get the same problem. Every time I play an animation made of "embedded image assets" I get this issue even if I just loaded it 2 seconds earlier on the same screen.

PS: For what I can tell it's not happening on Android.

Same as well..

Same issue over here!

I'm working on a Cordova project and was brought to this page — just sharing in case anyone else gets here for the same reason

Had an issue very similar to this — repeated logs of nil host used in call to allowsSpecificHTTPSCertificateForHost and I'd also see a -999 error.

I fixed it by re-adding cordova-plugin-deeplinks since I had recently removed some unfinished deep linking code

The diff roughly looked like this, only changes needed in package.json

{
  ...
  "dependencies": {
    ...
+   "cordova-plugin-deeplinks": "^1.1.1"
  },
  "cordova": {
    "plugins": {
      ...
+     "cordova-plugin-deeplinks": {}
}

I don't know where the deep linking related code still lives in the codebase, I just know the symptoms of whatever problem I'm facing looked like this issue

Same here, Xcode 12.2, iOS 14.2, iPhone 6S

same issue, Xcode 12.2, Simulator iPhone 12

Honestly, it doesn't help much to duplicate the same issue over and over again. You can just follow the thread and/or try to solve it.

I looked into the solution of @wswoodruff and tried to find related code in the Cordova plugin that may also apply for native code. The module is mainly handling user activities, but also includes some URL schemes that might influence this issue. @wswoodruff Would you mind sending over an (anonymized) version of your url schemes inside the generated Info.plist? That might lead into the right direction. Also: Did anyone file a radar already?

Is there a way to at least hide the message for now? It's spamming my console and causing me to not see other important stuff.

Anyone have a solution to this?

Xcode 12.2, iOS 14.2, Lottie 3.1.9, device is 12 mini, same result on simulators running iOS 12, iOS 13 and iOS 14 in all devices

Same here, Xcode 12.2, iOS 14.3, iPhone Xr

Same problem here on MacBook Pro M1, XCode 12.3, IOS 14.3.

Same here. Xcode 12.3, iOS 14.3

Same here. Xcode Version 12.4 (940.20)

2021-01-28 15:40:54.349565+0800 [67861:574777] nil host used in call to allowsSpecificHTTPSCertificateForHost
2021-01-28 15:40:54.349698+0800 [67861:574777] nil host used in call to allowsAnyHTTPSCertificateForHost:

Pod information
pod 'lottie-ios', '<= 3.1.8'

I have same problem. Xcode 12.4, iOS 14.4

Facing same issue using 3.2.0 release.

Same here.

opening local html files using UIWebView loadRequest in my app causes that. html files have img tags to locally stored jpegs. Ended up using UIWebView loadHTMLString and converting images into base64 data and pasting them in img tags. no errors now. wish there was a better way though.

Ok, I found what was causing that issue.
If animation file contain base64 image encoded like data:image/_image_mime_type_placeholder_;base64,_base64_encoded_image_placeholder_,
e.g. "data:image/png;base64,...", you will see this error.

To fix this, in BundleImageProvider func imageForAsset(asset: ImageAsset) -> CGImage? you should change parsing of base64 images.
Original:

if asset.name.hasPrefix("data:"),
    // two lines below are generating that issue,
    // I suppose they were taken from here https://stackoverflow.com/a/46195857
    let url = URL(string: asset.name),
    let data = try? Data(contentsOf: url),
    let image = UIImage(data: data) {
        return image.cgImage
}

Fix can look like that:

if asset.name.hasPrefix("data:") {
    let encodedAsset = asset.name
    let mimeLookupUpperBound = 25
    let searchRange = encodedAsset.startIndex..<encodedAsset.index(encodedAsset.startIndex, offsetBy: mimeLookupUpperBound)
    let mimeRange = encodedAsset.range(of: ";base64,", range: searchRange)
    let base64String = String(encodedAsset[mimeRange!.upperBound..<encodedAsset.endIndex])

    if let data = Data(base64Encoded: base64String, options: .ignoreUnknownCharacters),
       let image = UIImage(data: data) {
        return image.cgImage
    }
}

I've tested this approach on iOS 14.4 with 3.1.9 and it works for me.
Hope that helps 😅

Any news for a future correction?

@hansemannn please take a look

@vpopovyc The change makes sense. Can you create a pull request or should I?

@hansemannn please make it, Lottie codebase is new for me, don't want to break things :)

I think @buba447 is best qualified to review and implement this change. And with so much traction on this issue, the chances are good to integrate it soon :-)

Following. When are you planning to hace this issue solved?

Having the same issue, and im _NOT_ using this module.
So there's a chance that this is unrelated to this library.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muraterd picture muraterd  Â·  5Comments

Ushaka picture Ushaka  Â·  5Comments

petoye picture petoye  Â·  3Comments

albertoNovo picture albertoNovo  Â·  3Comments

CentrumGuy picture CentrumGuy  Â·  4Comments