Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS build failure #34

Open
omerh86 opened this issue Aug 1, 2017 · 12 comments
Open

IOS build failure #34

omerh86 opened this issue Aug 1, 2017 · 12 comments

Comments

@omerh86
Copy link

omerh86 commented Aug 1, 2017

HI ,
After implementing this plugin I am getting "Use Legacy Swift Language Version" error when build on IOS.
I am using X-code 8.2 which uses swift 2.3 as legacy version.
if im disabling "use swift leagacy version" checkbox in X-code settings it works fine however I am willing to let Cordova do it by configuration.
i have tried to add "<preference name="UseLegacySwiftLanguageVersion" value="false" to my config xml but it didnt help.
Any other suggestions?
Thanks head Omer

@nero120
Copy link

nero120 commented Aug 21, 2017

I get the same error on xcode 8.3.3 (swift 3), even when adding <preference name="UseSwiftLanguageVersion" value="3" /> to config.xml.

@DavidTalamona
Copy link

DavidTalamona commented Sep 7, 2017

I have the same issue as @nero120 when builiding my project with <preference name="UseSwiftLanguageVersion" value="3" /> in my config.xml, after updating to xcode 8.3.3.

        === BUILD TARGET ... OF PROJECT ... WITH CONFIGURATION Debug ===
        
        Check dependencies
        “Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use 
        Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build 
        Settings editor to configure the build setting directly.
        
        ** BUILD FAILED **

I'm using the following plugin https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio, which defines cordova-plugin-add-swift-support as a dependancy.

When I open xcode I get a message asking to convert to actual swift syntax. I say later and manually set the Swift language version from unspecified to Swift 3 and build the project with xcode, it works.
Run ionic cordova build ios again and the same error pops up again. After going back to xcode the Swift language version is reset back to unspecified.

Not shure but I think this setting should be set by your plugin and is not directly related to the fingerprint one, is it?

Here's my environment info:

cli packages:
    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:
    Cordova CLI : 7.0.1

local packages:
    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.1.2 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0

System:
    ios-deploy : 1.9.2 
    ios-sim    : 4.1.1 
    Node       : v6.11.3
    npm        : 4.6.0 
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 

@nero120
Copy link

nero120 commented Sep 7, 2017

@DavidTalamona It's working for me now. The plugin updates the xcode project settings during the after_prepare, after_platform_add and after_plugin_add events. If you clear your Platforms and Plugins folders in your Cordova project folder, then run cordova prepare, it should set the Swift Language Version in Build Settings gets set to Swift 3 automatically and you won't get the build error (though you'll still be prompted to convert swift syntax when you open the project in xcode).

@DavidTalamona
Copy link

DavidTalamona commented Sep 7, 2017

Just did that (and so I did yesterday) without success.

Tried to let the ionic cloud build it for me - build / package failed and guess what the output was ...

=== BUILD TARGET ... OF PROJECT ... WITH CONFIGURATION Release ===

Check dependencies
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

** ARCHIVE FAILED **

They build the project from scratch with my source "injected", so no crappy / corrupt platform which needs cordova prepare.

@DavidTalamona
Copy link

The problem seems to be related to xcode 8.3(x).
After downgrading to xcode 8.2 the build suceeds.

Think it's related to this: https://stackoverflow.com/questions/43107179/xcode-8-3-cant-support-swift-2-3

@NiklasMerz
Copy link
Contributor

I have similar problems with XCode 9 (beta and GM).

@svenemtell
Copy link

I have the same problem with Xcode 9.
I guess the XCode project file (project.pbxproj) is written to disk at line 12868 of add-swift-support.js:
_fs2.default.writeFileSync(pbxprojPath, xcodeProject.writeSync());

Right before the above line I therefore wrote the output of xcodeProject.writeSync() to console.log and while running cordova platform add [email protected] --save I could see all the expected settings, like:
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;and SWIFT_VERSION = 3.0;

But when inspecting the XCode project file afterwards the settings are not there! I also logged pbxprojPathso I know it is using the right XCode project file.

Any ideas?

@jsb8908
Copy link

jsb8908 commented Aug 2, 2018

@DavidTalamona Is there a way to downgrade the version of XCode that ionic cloud uses?

@vwasteels
Copy link

same here with xcode 9.2,
trying to use Geofence plugin, which needs swift plugin ...

@spacesuitdiver
Copy link

What I found is another plugin was overwriting the pbx value. In this case cordova-plugin-localization-strings.

@spacesuitdiver
Copy link

Issue is documented here for that plugin. kelvinhokk/cordova-plugin-localization-strings#33

@pantomath91
Copy link

I also got the same error with xcode 11.3.1 but this happens to me randomly, looks like xcodeProject.updateBuildProperty('SWIFT_VERSION', '5.0', buildConfig.name); is not setting correctly the swift compiler version.

Ref: https://github.com/akofman/cordova-plugin-add-swift-support/blob/master/src/add-swift-support.js#L149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants