googleads / googleads-consent-sdk-ios

Consent SDK
https://developers.google.com/admob/ios/eu-consent
Apache License 2.0
31 stars 47 forks source link

load form crashes: if consent SDK is consumed via CocoaPods #11

Closed DKMaverick closed 6 years ago

DKMaverick commented 6 years ago

In PACView.m, loadWebView method tries to obtain bundle url via: NSURL *bundleURL = [[NSBundle mainBundle] URLForResource:@"PersonalizedAdConsent" withExtension:@"bundle"]; If host app is generated via CocoaPods, this is nil and results a crash. One possible fix is to replace the above with: [[NSBundle bundleForClass:[self class]] URLForResource:@"PersonalizedAdConsent" withExtension:@"bundle"] which would result $SAMPLE_APP_PATH/Frameworks/PersonalizedAdConsent.framework/PersonalizedAdConsent.bundle/ instead of non-existent $SAMPLE_APP_PATH/PersonalizedAdConsent.bundle/ A workaround solution is to change the documentation, so that even with CocoaPods setup, SDK consumers need to add PersonalizedAdConsent.bundle to Copy bundle resources manually.

shirakaba commented 6 years ago

Thanks for this fix; exactly what I needed. I've made a fork so that people can instantly apply or test this patch if necessary:

pod 'PersonalizedAdConsent', :git => 'https://github.com/shirakaba/googleads-consent-sdk-ios.git', :branch => 'fix-cocoapods-bundle-url'

I have also made a pull request for DKMaverick's suggestion.

EDIT: seems I've only made a pull request within my own repo. I haven't signed the Google Contributor agreement in any case, and won't have time to before GDPR, so this is as much as I can offer!

rampara commented 6 years ago

This issue should be resolved on the latest version of this SDK (v1.0.1).

erkie commented 6 years ago

@rampara it seems that 1.0.1 has yet to be pushed to Cocoapods.org? Thanks!

Edit: Was incorrect. Indeed it has. I needed to run pod repo update. This issue can be closed

rampara commented 6 years ago

Closing issue as it has been resolved on the latest version of this SDK (v1.0.1).