prebid / prebid-mobile-ios

Prebid Mobile SDK for iOS applications
Apache License 2.0
48 stars 93 forks source link

Fatal error: 'try!' expression unexpectedly raised an error: PrebidMobile.ErrorCode.prebidServerURLInvalid("https://example.com") #1052

Open briantci opened 2 months ago

briantci commented 2 months ago

Describe the bug

When trying to set a custom prebid server, I always get the following error:

Fatal error: 'try!' expression unexpectedly raised an error: PrebidMobile.ErrorCode.prebidServerURLInvalid("https://example.com")

I have followed the steps from the official docs, but I am always getting the same error message, no matter what URL I am using.

When looking at the root of this problem, I see that in the Pods -> PrebidMobile -> core -> Host file, there's a verifyUrl method that contains the following line of code:

return UIApplication.shared.canOpenURL(url)

This line is causing the error to be thrown, because of the canOpenURL method returning false.

After thoroughly reading the Apple docs regarding this function, I still don't understand why it returns false when using regular URL, like https://example.com

To Reproduce

  1. Set up a new swift app
  2. Follow the steps from the official docs

Expected behavior

A successful connection to my self-hosted prebid server.

Desktop:

Smartphone: