ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native
Other
221 stars 125 forks source link

can't get it work in iOS platform - conflicts with GoogleMaps@~> 3.1.0 #244

Closed leabdalla closed 4 years ago

leabdalla commented 4 years ago

I'm trying to use GoogleMaps on Ionic but it seems impossible to get it working in iOS.

In browser and Android it works good.

After several times trying different ways, I've just forked the quick-example and it's not working for me as well.

So, here is how to reproduce:

$ git clone https://github.com/leabdalla/ionic-googlemaps-quickdemo-v4
$ cd ionic-googlemaps-quickdemo-v4
$ npm install
$ ionic cordova platform add ios --verbose

Installing plugin "cordova-plugin-googlemaps" following successful platform add of ios
Found variables for "cordova-plugin-googlemaps". Processing as cli_variables.
Installing "cordova-plugin-googlemaps" for ios
Running command: /Users/myuser/dev/ionic-googlemaps-quickdemo-v4/platforms/ios/cordova/version
Command finished with error code 0: /Users/myuser/dev/ionic-googlemaps-quickdemo-v4/platforms/ios/cordova/version
Running command: /Users/myuser/dev/ionic-googlemaps-quickdemo-v4/platforms/ios/cordova/version
Running command: /Users/myuser/dev/ionic-googlemaps-quickdemo-v4/platforms/ios/cordova/apple_xcode_version
Running command: /Users/myuser/dev/ionic-googlemaps-quickdemo-v4/platforms/ios/cordova/apple_ios_version
Command finished with error code 0: /Users/myuser/dev/ionic-googlemaps-quickdemo-v4/platforms/ios/cordova/version
Command finished with error code 0: /Users/myuser/dev/ionic-googlemaps-quickdemo-v4/platforms/ios/cordova/apple_xcode_version
Command finished with error code 0: /Users/myuser/dev/ionic-googlemaps-quickdemo-v4/platforms/ios/cordova/apple_ios_version
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-googlemaps on ios platform only.
Executing script found in plugin cordova-plugin-googlemaps for hook "before_plugin_install": plugins/cordova-plugin-googlemaps/src/ios/check_sdk_version.js
Install start for "cordova-plugin-googlemaps" on ios.
Beginning processing of action stack for ios project...
Action stack processing complete.
pods.json found in platforms/ios
Podfile found in platforms/ios
Adding pods since the plugin contained <podspecs>
Set pods.json for `sources` - `https://github.com/CocoaPods/Specs.git`
Added source line for `https://github.com/CocoaPods/Specs.git`
Set pods.json for `libraries` - `GoogleMaps`
Added pod line for `GoogleMaps`
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
Adding pods since the plugin contained <framework>(s) with type="podspec"
cordova-plugin-googlemaps depends on GoogleMaps@~> 2.7.0, which conflicts with another plugin. GoogleMaps@~> 3.1.0 is already installed and was not overwritten.
Wrote to pods.json.
Wrote to Podfile.
Running `pod install` (to install plugins)
Failed to install 'cordova-plugin-googlemaps': undefined
CordovaError: Promise rejected with non-error: 'Version should contain only numbers and dots'
    at cli.catch.err (/Users/myuser/.nvm/versions/node/v10.16.3/lib/node_modules/cordova/bin/cordova:29:15)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] An error occurred while running subprocess cordova.

So I try to install pods:

$ cd platforms/ios
$ pod install

Then get back and try create iOS platform again

$ ionic cordova platform remove ios
$ ionic cordova platform add ios

But it shows the same error message:

cordova-plugin-googlemaps depends on GoogleMaps@~> 2.7.0, which conflicts with another plugin. GoogleMaps@~> 3.1.0 is already installed and was not overwritten.

My environment has:

node -v      = v10.16.3
ionic -v     = npm 5.2.6
npm -v       = 6.9.0
cordova -v   = 9.0.0 (cordova-lib@9.0.1)

Any help?

wf9a5m75 commented 4 years ago

GoogleMaps@~> 3.1.0 is already installed and was not overwritten

leabdalla commented 4 years ago

so do I need to remove it? how?

wf9a5m75 commented 4 years ago

Why you need to install v2.7.0 instead of v3.1.0? Just ignore the line.

The problem is CordovaError: Promise rejected with non-error: 'Version should contain only numbers and dots'

wf9a5m75 commented 4 years ago

I'm testing followed with your steps.

wf9a5m75 commented 4 years ago

Could you tell me the output of $> pod --version?

leabdalla commented 4 years ago
$ pod --version
1.8.0.beta.1
wf9a5m75 commented 4 years ago

And what's the xcode version?

leabdalla commented 4 years ago

Xcode Version 10.3 (10G8)

wf9a5m75 commented 4 years ago

Could you show me the result of following commands?

$> cd platforms/ios/
$> ls
leabdalla commented 4 years ago
$ cd platforms/ios
$ ll

drwxr-xr-x   7 myuser  staff   224B Aug 27 15:08 CordovaLib
drwxr-xr-x  16 myuser  staff   512B Aug 27 15:08 GoogleMapsDemo
drwxr-xr-x   3 myuser  staff    96B Aug 27 15:08 GoogleMapsDemo.xcodeproj
drwxr-xr-x   4 myuser  staff   128B Aug 27 15:08 GoogleMapsDemo.xcworkspace
-rw-r--r--   1 myuser  staff   219B Aug 27 15:08 Podfile
drwxr-xr-x  25 myuser  staff   800B Aug 27 15:08 cordova
-rw-r--r--   1 myuser  staff    12K Aug 27 15:08 ios.json
drwxr-xr-x   7 myuser  staff   224B Aug 27 15:08 platform_www
-rw-r--r--   1 myuser  staff   860B Aug 27 15:08 pods-debug.xcconfig
-rw-r--r--   1 myuser  staff   859B Aug 27 15:08 pods-release.xcconfig
-rw-r--r--   1 myuser  staff   348B Aug 27 15:08 pods.json
drwxr-xr-x   7 myuser  staff   224B Aug 27 15:08 www

And here's the content of Podfile

# DO NOT MODIFY -- auto-generated by Apache Cordova
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'GoogleMapsDemo' do
  project 'GoogleMapsDemo.xcodeproj'
  pod 'GoogleMaps', '~> 3.1.0'
end
wf9a5m75 commented 4 years ago

Um, and show me the output of $ cordova platform list?

leabdalla commented 4 years ago
$ cordova platform list
Installed platforms:
  ios 5.0.1
Available platforms:
  android ^8.0.0
  browser ^6.0.0
  electron ^1.0.0
  osx ^5.0.0
  windows ^7.0.0

(thanks for help so far!!)

wf9a5m75 commented 4 years ago

Um, I don't know why the cordova failed to install the plugin, but try like this:

$> cd platforms/ios/
$> Pod install
$> ls Podfile.lock  // should be existed
$> cd ../../
$> ionic cordova build ios

Even if the above does not work, try to reinstall the maps plugin

$> ionic cordova plugin rm cordova-plugin-googlemaps
$> rm -rf node_modules/cordova-plugin-googlemaps
$> ionic cordova plugin add cordova-plugin-googlemaps@latest
battika commented 4 years ago

Have you also tried running pod repo update in the platforms/ios directory after it failed followed by pod install? Another very useful new Ionic command is ionic repair you could try, it takes care of removing all node_modules, platforms and reinstalls everything. I find it very useful often times.

leabdalla commented 4 years ago

@wf9a5m75 I tried your steps:

The first build attempt died with this errors

PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/myuser/Library/Developer/Xcode/DerivedData/GoogleMapsDemo-crbubauydzqxaydzqgqnqreqsgcc/Build/Intermediates.noindex/GoogleMapsDemo.build/Debug-iphonesimulator/GoogleMapsDemo.build/Script-32D67ED9E3DB2506C92119B1.sh (in target: GoogleMapsDemo)
    cd /Users/myuser/dev/ionic-googlemaps-quickdemo-v4/platforms/ios
    /bin/sh -c /Users/myuser/Library/Developer/Xcode/DerivedData/GoogleMapsDemo-crbubauydzqxaydzqgqnqreqsgcc/Build/Intermediates.noindex/GoogleMapsDemo.build/Debug-iphonesimulator/GoogleMapsDemo.build/Script-32D67ED9E3DB2506C92119B1.sh
diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

** BUILD FAILED **

The following build commands failed:
  PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/myuser/Library/Developer/Xcode/DerivedData/GoogleMapsDemo-crbubauydzqxaydzqgqnqreqsgcc/Build/Intermediates.noindex/GoogleMapsDemo.build/Debug-iphonesimulator/GoogleMapsDemo.build/Script-32D67ED9E3DB2506C92119B1.sh
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.

Then I tried next steps and got same error message on first command:

$ ionic cordova plugin rm cordova-plugin-googlemaps

Uninstalling cordova-plugin-googlemaps from ios
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
CordovaError: Promise rejected with non-error: 'Version should contain only numbers and dots'
    at cli.catch.err (/Users/myuser/.nvm/versions/node/v10.16.3/lib/node_modules/cordova/bin/cordova:29:15)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] An error occurred while running subprocess cordova.
wf9a5m75 commented 4 years ago

I guess your pod has problem. Please try to downgrade to 1.6.1.

leabdalla commented 4 years ago

@battika pod repo update shows me

CocoaPods 1.8.0.beta.2 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

Is it a good idea to update it?

So, I didn't know about ionic repair and it seems to be very useful.

It reinstall and recreates a lot of things, however after it worked I tried to build ios and got exactly the same error as my initial post :(

leabdalla commented 4 years ago

@wf9a5m75 it looks like it worked. I'll post again in a few minutes.

leabdalla commented 4 years ago

It worked, guys! The solution was the Pod downgrade to 1.6.1 and then ionic repair.

Thank you so much!