apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.15k stars 986 forks source link

Podfile multiple targets generated if single quote is used in app name #717

Open mikealo opened 4 years ago

mikealo commented 4 years ago

Bug Report

Podfile multiple targets generated if single quote is used in app name, this issue is not created if app does not contain single quote

Problem

If a single quote is used in the app name for example "Test's single quote" and there is any additional plugin that use any pod library then the podfile generated contains multiple targets and cordova fail the plugin installation

What is expected to happen?

The podfile generated should look like this:

platform :ios, '9.0'
target 'Test\'s single quote' do
    project 'Test\'s single quote.xcodeproj'
    pod 'GoogleMaps', '~> 2.0.0'
end

What does actually happen?

The podfile generated look like this:

platform :ios, '9.0'
target 'Test\'s single quote' do
    project 'Test\'s single quote.xcodeproj'
end
target 'Test\'s single quote' do
    project 'Test\'s single quote.xcodeproj'
    pod 'GoogleMaps', '~> 2.0.0'
end

Information

Command or Code

cordova create "Test's single quote" com.test.singlequote "Test's single quote"
cordova platform add ios
cordova plugin add cordova-plugin-googlemaps

Environment, Platform, Device

Version information

MacOS 10.15 Xcode 11.2 Node v12.5.0 Ruby Gem 3.0.6 CocoaPods 1.8.4 Cordova 9.0.0 (cordova-lib@9.0.1) Cordova iOS platform 5.0.1

Checklist

mibzman commented 4 years ago

I'm having this issue as well. @mikealo, did you discover a workaround?

mikealo commented 4 years ago

@mibzman unfortunatly i ended app changing app name and removing single quote.

Even if you change the podfile generated in the project>platform>ios folder manually you can then create errors during build process so i avoided doing so.

The file on ios platform that generate the podfile should be this one:

https://github.com/apache/cordova-ios/blob/master/bin/templates/scripts/cordova/lib/Podfile.js

mibzman commented 4 years ago

Thanks for the response. I've also ended up changing my app name. I removed the single quote from the name property and went with a combination of this plugin and this config to change the display name back to a name with the single quote.

Hopefully, the core team can get to fixing this soon.

RobWouters commented 2 years ago

I have not confirmed this but I suspect the culprit is this regex: https://github.com/apache/cordova-ios/blob/a3a3936a549981054dabff8098dfa393094eb834/bin/templates/scripts/cordova/lib/Podfile.js#L81

csi-slizhevskyv commented 6 months ago

the same issue. UP!