Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Cordova-ios 4.4.0 Problems #1701

Closed
markos92i opened this issue May 2, 2017 · 38 comments
Closed

Cordova-ios 4.4.0 Problems #1701

markos92i opened this issue May 2, 2017 · 38 comments

Comments

@markos92i
Copy link

markos92i commented May 2, 2017

Expected Behaviour

Actual Behaviour

Google-services.plist copied in wrong folder
Push Notification capabilities not activated
APS Environment not setted to development

Reproduce Scenario (including but not limited to)

Steps to Reproduce

cordova platform add ios
cordova build ios --release
Open xcode.workspace

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Xcode 8.3.2

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Cordova CLI version and cordova platform version

cordova --version                                    # e.g. 6.5.0
cordova platform version android           # e.g. 6.2.0
cordova platform version ios                   # e.g. 4.4.0

Plugin version

2.0.0-rc2

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

@macdonst macdonst added this to the Release 2.0.0 milestone May 2, 2017
@gianpaj
Copy link
Contributor

gianpaj commented May 5, 2017

i'm not getting with push notifications with FCM on iOS. Both in Dev (Sandbox) or with Prod certs.

Are there any workarounds you would suggest or debugging steps?

thanks

Edit: I had an issue with pem certs and provisioning certs.

@markos92i
Copy link
Author

Using cordova-ios 4.4.0 as engine.
Remove the platform and plugin directories inside the proyect and do a "cordova platform add ios" again.
Then a "cordova build ios --release" (or --debug, doesn't matter), then open the Xcode project and take a look: you will see push notifications capabilities disabled, GoogleService-Info empty (but if you look under Resources folder you see another Resources folder with the correct file copied).
And aps-environment is not setted neither.

@macdonst
Copy link
Member

macdonst commented May 5, 2017

@markos92i I'm working on an rc3 which does the copying of the Google Services without a hook.

@markos92i
Copy link
Author

markos92i commented May 10, 2017

With the rc3 still the file isn't copied, I've taken a look at the new and I think the origin path is different than before (it was copied from the root of the project, not from src/ios/)
Also it still fails to activate the push notifications capabilities.

And if you use cordova 7.0.0 it doesnt even install:

Saved plugin info for "phonegap-plugin-push" to config.xml
  Adding phonegap-plugin-push to package.json
  Error: Cannot find module '../plugman/platforms/ios'

@markos92i
Copy link
Author

I've been trying to go back to rc2 and cordova-ios 4.3.1 as it worked in the past, but now it says that it cannot work with 4.3.1, that rc2 needs 4.4.0???

@macdonst macdonst added the ios label May 11, 2017
@tlaverdure
Copy link

@markos92i with RC3 I'm noticing two Google-services.plist files.

screen shot 2017-05-22 at 5 50 49 pm

The one directly under Resources seems to have all the right values. The one under Resources/Resources seems to be the stub file included with the plugin. I'm trying to use FCM but it looks like the emtpy .plist file is causing the SENDER_ID to be empty when running on a device.

Is there a way to explicitly set ios to use FCM or fix this issue?

I'm also using cordova-ios 4.4.0.

@jcesarmobile
Copy link
Collaborator

The hook is gone now, you have to use <resource-file src="GoogleService-Info.plist" /> in the config.xml inside the ios platform.
I've send a PR to avoid creating the empty GoogleService-Info.plist file. #1732

@tlaverdure
Copy link

I seem to be running into this issue quite often when trying to build iOS:

The following build commands failed:
CopyPlistFile /Library/Developer/Xcode/DerivedData/App-aaatjwwhebrovbcevrxvrigenh
wb/Build/Intermediates/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app/GoogleService-Info.plist App/Resources/GoogleService-Info.plist
        (1 failure)
        Error: Error code 65 for command: xcodebuild with args: -xcconfig,/App/platforms/ios/cordova/build-release.xcconfig,-workspace,app.xcworkspace,-scheme,App,-configuration,Release,-destinat
ion,generic/platform=iOS,-archivePath,App.xcarchive,archive,CONFIGURATION_BUILD_DIR=/App/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/App/platforms/ios/build/
sharedpch

I have this in my config.xml:

<resource-file src="GoogleService-Info.plist" target="GoogleService-Info.plist" />

@markos92i
Copy link
Author

markos92i commented May 29, 2017

That worked, and the GoogleService-Info.plist file is now correctly added to the project, thank you.

Now im facing the entitlements problem, the two things that i think might be the cause are:
Having ionic deeplinks plugin installed, which also writes an .entitlements file (this one works well)
That phonegap plugin push sets the entitlements inside .plist files, rather than .entitlements. The plist are present inside the project, but the ones that Xcode see are in the .entitlements.

@jcesarmobile
Copy link
Collaborator

Yeah, if another plugin is using .entitlements file that will cause problems with this plugin, as, as you said, it uses .plist for entitlements.

I think there is a feature request open for cordova-ios to use .entilements file instead of .plist.

For now the only thing you can do is to fork the other plugin and change it to write on the .plist instead of creating a .entitlements file.

@markos92i
Copy link
Author

markos92i commented May 29, 2017

I added in a plugin.xml of a custom plugin that I have, the following:

    <config-file target="*.entitlements" parent="aps-environment">
        <string>development</string>
    </config-file>

And it adds the entitlement and enables de capability correctly, along with the others of deeplinks or whatever other plugin.

@macdonst
Copy link
Member

@shazron thoughts on the entitlements issue?

@jcesarmobile
Copy link
Collaborator

If the other plugin is adding a .entitlements file then Xcode will use it instead of the entitlements.plist. We should move to the .entitlements file on cordova-ios, I think there was an issue open for it.

@shazron
Copy link
Member

shazron commented Jun 3, 2017

cordova-ios issue: https://issues.apache.org/jira/browse/CB-12316

@shazron
Copy link
Member

shazron commented Jun 3, 2017

Please add comments into the JIRA issue. Problem is -- an older version of the push plugin (and possibly others) might already depend on the filename being ??.plist so we would break them, we might need a proper migration path.

@markos92i does that create an .entitlements file or just modify an existing one?

@macdonst
Copy link
Member

macdonst commented Jun 4, 2017

@shazron I'm happy to break things with the 2.0.0 release as it will be a major version bump.

@markos92i
Copy link
Author

@shazron it modifies the existing one, but I didn't really try if when it does not exist it is created.

@markos92i
Copy link
Author

markos92i commented Jun 5, 2017

With the latest rc4 i cant put a "data" object inside de payload, as before. If I send it with whatever other name it works... what did you do T_T.

This is the payload:

{
	"to": "/topics/_android_",
	"priority": "high",
	"data": {
		"app": "MOV_PROD",
		"title": "TEST",
		"message": "This is a Firebase Cloud Messaging Topic Message!",
		"icon": "rtve_logo_push_color",
		"data": {
			"idMensaje": "2611",
			"servicio": "MOV_NOTIC",
			"infopopup": "Tiene nuevas noticias"
		}
	}
}

And this is the only way to make "data" be received:

{
	"to": "/topics/_android_",
	"priority": "high",
	"data": {
		"app": "MOV_PROD",
		"title": "TEST",
		"message": "This is a Firebase Cloud Messaging Topic Message!",
		"icon": "rtve_logo_push_color",
		"WHATEVER": {
			"idMensaje": "2611",
			"servicio": "MOV_NOTIC",
			"infopopup": "Tiene nuevas noticias"
		}
	}
}

@fzamperin
Copy link

I'm having a problem, in my folders, Resources folders in ios platform does not contain Resources/Resources, inside the first Resources is only GoogleMapsbundle, for this reason my app only generates APN push, any guesses what might be?

@jcesarmobile
Copy link
Collaborator

There shouldn't be a Resources folder inside Resources folder, only one Resources folder. But I don't think I understand your question, what does the GoogleMapsbundle has to do with push?

@fzamperin
Copy link

I configured plugin.xml as it says in the plugin docs for Google.plist, but the plugin is not copying the .plist inside the Resources folder, inside the Resources folder there's only GoogleMaps.bundle (from another plugin), when I try to manually copy the .plist nothing happens and he's not initializing fcm for me just APN push. When I get the registration is only from APN

@jcesarmobile
Copy link
Collaborator

You have to put it on the config.xml, not in the plugin.xml

@fzamperin
Copy link

The documentation is a little bit ambiguous... But now I'll try that

As of version 2.0.0 the SENDER_ID parameter has been removed at install time. Instead you put your google-services.json (Android) and/or GoogleService-Info.pList in the root folder of your project and then add the following lines into your plugin.xml.

@fzamperin
Copy link

@jcesarmobile Thanks man, worked like a charm, I was in this issue for weeks!!

@jcesarmobile
Copy link
Collaborator

where is that text? can you link it? here it says config.xml https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md

@fzamperin
Copy link

@jcesarmobile
Copy link
Collaborator

ah, that's old, v2.0.x branch was merged into master, so new changes are on master branch now instead of v2.0.x. We should probably delete it.

@fzamperin
Copy link

@jcesarmobile I'm installing the plugin using phonegap-plugin-push@v2.0.0-rc5 is that correct?

@tlaverdure
Copy link

Still running into this issue quite often. Only solution I have found is recreating that whole iOS platform.

@mikegleasonjr
Copy link

@macdonst macdonst modified the milestones: Release 2.0.0, Release 2.1.0 Sep 6, 2017
@koenoe
Copy link

koenoe commented Sep 18, 2017

@tlaverdure same here

@papago-development
Copy link

worked for me:

  1. readded platform
  2. put the plist file in root ( your project )
  3. if there is a .plist file(empty) in ../Resource/Resources override it with the .plist file from parent

@macdonst
Copy link
Member

Still waiting for fix in cordova-ios

@macdonst macdonst removed this from the Release 2.1.0 milestone Oct 20, 2017
@danielcrk
Copy link

I'm having the same issue, push is always OFF under the Capabilities tab. If I understand this thread correctly, this is a cordova ios version (I'm using the latest 4.5.3) and not an issue with this plugin?

@vdharmon
Copy link

vdharmon commented Nov 7, 2017

I'm using XCode 9.0, Cordova-CLI (7.1.0), with Cordova-IOS (4.5.3) and the Phonegap-Plugin-Push (2.1.0) and Push Notifications are not working.

The XCode project 'Capabilities' tab shows 'Push Notifications' as OFF.

Any guidance would be greatly appreciated.

@jcesarmobile
Copy link
Collaborator

The way cordova-ios works, it doesn't enable capabilities in Xcode, that doesn't mean that push notifications don't work because of that.

If you use another plugin that adds a .entitlements file, it will conflict with this plugin and push won't work.

@stale
Copy link

stale bot commented Jun 3, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 3, 2018
@stale stale bot closed this as completed Jun 10, 2018
@lock
Copy link

lock bot commented Jul 10, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests