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

Nativescript IOS Build failed with Swift 3 @objc inference in Swift 4 mode is deprecated #39

Open
lostation opened this issue Apr 13, 2020 · 4 comments

Comments

@lostation
Copy link

lostation commented Apr 13, 2020

Hi Osei,

I’m suddenly getting an error trying to build my Nativescript iOS app version… until there it was building correctly and running both on iOS and android... I've updated NS to 6.5.0.

I’ve already retry removing node_modules, npm install and so on… but I’m still stucked at this point.

The described building issue seems to be linked to the Toast-Swift library used from your Nativescript-toasty library.

.../platforms/ios/Pods/Toast-Swift/Toast/Toast.swift:307:15: error: method 'makeToastActivity' with Objective-C selector 'makeToastActivity:' conflicts with previous declaration with the same Objective-C selector
@objc func makeToastActivity(_ point: CGPoint) {
^
.../platforms/ios/Pods/Toast-Swift/Toast/Toast.swift:279:16: note: 'makeToastActivity' previously declared here
@objc func makeToastActivity(_ position: ToastPosition) {
^
Command CompileSwift failed with a nonzero exit code

note: Using new build systemnote: Planning buildnote: Constructing build descriptionwarning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Toast-Swift" target. (in target 'Toast-Swift' from project 'Pods')warning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Toast-Swift" target. (in target 'Toast-Swift' from project 'Pods')

** BUILD FAILED **

Do you have any idea how to solve this... ?

Thanks for any help
Lo.

@lostation
Copy link
Author

I've just replaced your external Toast-Swift dependency from the Podfile with

pod 'Toast-Swift', :git => 'https://github.com/scalessec/Toast-Swift.git'

And it seems to make the workaround for now... Maybe just an update from your own fork of this Toast-Swift library.

Can you check if revert to the original library has no side effect or missing NS feature ?

Thanks.
Lo.

@lostation
Copy link
Author

No it doesn't work... the toast doesn't appear anymore...grrr
It just remove the old deprecated issue...so the build works...but not the feature ; - (

Can you try to update your own Toast-Swift repo ?

thanks
Lo.

@lostation
Copy link
Author

This issue occurred after I installed a new lib into my project -> Nativescript-markdown-view.

this lib was changing the Xcode build configuration for all the pods.

Link to the markdown lib

So I've set Xcode build param to :

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['SWIFT_SWIFT3_OBJC_INFERENCE'] = 'Default' end end end

@Stanteq
Copy link

Stanteq commented Apr 23, 2020

@lostation, try to force swift version to 5 accordingly to this tutorial.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'Toast-Swift'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '5.0'
      end
    end
  end
end

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

2 participants