danwilson / google-analytics-plugin

Cordova (PhoneGap) Plugin to connect to the native Google's Universal Analytics SDK 3.0
MIT License
693 stars 500 forks source link

Facing build error on Apple M1 Pro chip Mac Xcode, while choosing iOS Simulator. Issue only on build for simulator's, working fine for real devices. #595

Closed andaralex closed 2 years ago

andaralex commented 2 years ago

OS: macOS Monterey Version 12.3 Chip: Apple M1 Pro

Plugin Details: "cordova-plugin-google-analytics": "1.9.1",

"cordova": { "plugins": { "cordova-plugin-google-analytics": { "GMS_VERSION": "18.0.1" }, "platforms": [ "ios" ] },

Recently I changed my MacBook Pro with Apple M1 Chip. In my application, I have used the "google-analytics-plugin": 1.9.1 and getting below issue while build and run the iOS simulator:

Screenshot 2022-03-24 at 4 08 24 PM

ld: in /Users/Alexandar.S/Documents/ionic_sample_app/test_app/platforms/ios/Pods/GoogleIDFASupport/Libraries/libAdIdAccessLibrary.a(TAGActualAdIdAccess.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/Alexandar.S/Documents/ionic_sample_app/test_app/platforms/ios/Pods/GoogleIDFASupport/Libraries/libAdIdAccessLibrary.a' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Screenshot 2022-03-24 at 4 10 29 PM

Issue only on Xcode while choosing iOS simulator, on real iPhone devices working fine. Also build succeeded on Cordova CLI.

Screenshot 2022-03-24 at 4 26 19 PM

Note: Same working on macOS Big Sur Intel chip machine having Xcode 12.

victorsosa commented 2 years ago

Trying removing this line <pod name="GoogleIDFASupport" spec="3.14.0" />; because it seems to be a versions conflict

You target is set to 8.0, but the deploy target is 9.0 to 15.4.99

andaralex commented 2 years ago

Thanks for your quick reply. You are correct. As you said, it's version conflict. Now Xcode build succeeded and the app running in iOS simulators. I made the below changes in plugin.xml file.

commented this line <pod name="GoogleIDFASupport" spec="3.14.0" />; and updated the GoogleAnalytics pod spec version to 3.20.0

<podspec>
  <config>
    <source url="https://cdn.cocoapods.org/"/>
  </config>
  <pods use-frameworks="true">
    <pod name="GoogleAnalytics" spec="3.20.0"/>
    <!-- <pod name="GoogleIDFASupport" spec="3.14.0" /> -->
  </pods>
</podspec>

<pods use-frameworks="true">
  <pod name="GoogleAnalytics" spec="3.20.0"/>
  <!-- <pod name="GoogleIDFASupport" spec="3.14.0" /> -->
</pods>
Screenshot 2022-03-24 at 8 00 00 PM
victorsosa commented 2 years ago

any PR is welcome

andaralex commented 2 years ago

Raised PR for this fix - https://github.com/danwilson/google-analytics-plugin/pull/596#issue-1180452809. Please review and merge it.