cordova-ios icon indicating copy to clipboard operation
cordova-ios copied to clipboard

Automate "Notification Service Extension" (File > New > Target) step

Open rricamar opened this issue 5 years ago β€’ 13 comments

Hi βœ‹ ,

I'm working with a Cordova based App, and I would like to automate the "Notification Service Extension" step (In Xcode: File > New > Target) (for example, in Jenkins pipeline) , since I saw that after doing it, remove platform, and add it again, the associated target is removed 😭

I've been searching through the docs, stack overflow and another issues and I haven't seen anything... is this possible (config.xml, custom hook, post build script) ?

Thanks a lot in advance!

rricamar avatar Mar 27 '19 09:03 rricamar

it's a pain that in every build you have to do all the steps, because it is lost when platform is removed

it should be possible to do it with hooks and xcodebuild... but I haven't found info about how to do it either

manudefrutosvila avatar Mar 27 '19 09:03 manudefrutosvila

Yeah, a hook is probably the best option here.

dpogue avatar Mar 27 '19 14:03 dpogue

Yeah, a hook is probably the best option here.

Thanks for the reply!

Do you have any idea about this? 😭

I've been searching and I couldn't find anything... 😒

rricamar avatar Mar 27 '19 14:03 rricamar

Can you diff the project before and after? Maybe the changes are simple enough so that you can just apply them via git? If not, maybe https://github.com/apache/cordova-node-xcode can help to manipulate the Xcode project via JS.

janpio avatar Mar 27 '19 14:03 janpio

Can you diff the project before and after? Maybe the changes are simple enough so that you can just apply them via git? If not, maybe https://github.com/apache/cordova-node-xcode can help to manipulate the Xcode project via JS.

Yeah, I checked that and as long as I know, these are the changes (with a quick diff command):

  • <App>xcodeproj/project.pbxproj modified
  • <App>.xcworkspace/xcuserdata/<User>.xcuserdatad/UserInterfaceState.xcuserstate modified
  • CordovaLib/CordovaLib.xcodeproj/xcuserdata/<User>.xcuserdatad/xcschemes/xcschememanagement.plist
  • OneSignalNotificationServiceExtension dir completely new

Use a hook for copy the OneSignalNotificationServiceExtension dir should be easy, but after check the changes in another files, I think that they are non-trivial and a little bit dangerous for do it in a ci environment ... ⚠️ because that would require a lot of additions and deletions maybe 😱 ...

I'm going to read docs of cordova-node-xcode , thanks for the help ... meanwhile any idea πŸ’‘ or a working example would be great πŸ™

Thanks for the help❗️

rricamar avatar Mar 27 '19 15:03 rricamar

Attaching an additional reference, there is an open ticket to support iOS "App Extension" target in Cordova's Jira system: https://issues.apache.org/jira/browse/CB-10218

jkasten2 avatar Aug 15 '19 21:08 jkasten2

i use trick in this one

https://github.com/crapthings/cordova-plugin-ios-shareextension

hooks code from cordova-openwith

https://github.com/nexushubs/cube/tree/cordova-openwith

crapthings avatar Feb 15 '20 15:02 crapthings

Yeah hooks are the way to go to copy extension code from a plugin and the Xcode settings. I did this with "openwith" and call directory extensions https://github.com/GEDYSIntraWare/cordova-plugin-call-directory

NiklasMerz avatar Feb 15 '20 20:02 NiklasMerz

So does anyone have a working hook they could share to automate this step for the purpose of being able to send images inside of remote push notifications on IOS please?

vesper8 avatar Feb 03 '21 16:02 vesper8

@vesper8 , did you find a way to do that? send images inside of remote push notifications on IOS?

imirs avatar May 09 '21 14:05 imirs

Hi @rricamar have you found the fix for this, after 2 years of your post, I am struggling with same issue now, if you have any solution on it, can you please help us with your inputs. Thank You in advance.

srinivasaraosaluru avatar Jun 06 '23 06:06 srinivasaraosaluru

Hi @rricamar have you found the fix for this, after 2 years of your post, I am struggling with same issue now, if you have any solution on it, can you please help us with your inputs. Thank You in advance.

Hello @srinivasaraosaluru, sadly I wasn't able to automate these steps since my low knowledge of the Xcode/iOS ecosystem. I had to replicate manually the steps before sending the app to the Apple Store revision until the project was over... πŸ˜…

I quickly checked One Signal's newest documentation and the process looks almost the same as back then, really sad to see that after 4 years after this hasn't been automated somehow 😞

Good luck πŸ€

rricamar avatar Jun 06 '23 12:06 rricamar

Thank Ypou @rricamar for your comments, I have achieved the same with help of manual steps. Thank You once again.

srinivasaraosaluru avatar Jun 23 '23 03:06 srinivasaraosaluru