triniwiz / nativescript-toasty

:bread: NativeScript toast plugin :bread:
Other
44 stars 21 forks source link

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

Open lostation opened 4 years ago

lostation commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

standevo commented 4 years ago

@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