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 Error #34

Closed
shivgolani opened this issue May 2, 2018 · 9 comments
Closed

iOS build Error #34

shivgolani opened this issue May 2, 2018 · 9 comments

Comments

@shivgolani
Copy link

Hello using Xcode Version 9.3 (9E145)
and macOS High Sierra.

Getting the following error

/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:41:20: error: 'dynamic' var 'cornerRadius' must also be '@objc'
open dynamic var cornerRadius: CGFloat {
~~~~~~~ ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:47:20: error: 'dynamic' var 'textInsets' must also be '@objc'
open dynamic var textInsets = UIEdgeInsets(top: 6, left: 10, bottom: 6, right: 10)
~~~~~~~ ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:50:20: error: 'dynamic' var 'textColor' must also be '@objc'
open dynamic var textColor: UIColor? {
~~~~~~~ ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:56:20: error: 'dynamic' var 'font' must also be '@objc'
open dynamic var font: UIFont? {
~~~~~~~ ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:62:20: error: 'dynamic' var 'bottomOffsetPortrait' must also be '@objc'
open dynamic var bottomOffsetPortrait: CGFloat = {
~~~~~~~ ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:73:20: error: 'dynamic' var 'bottomOffsetLandscape' must also be '@objc'
open dynamic var bottomOffsetLandscape: CGFloat = {
~~~~~~~ ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastWindow.swift:108:16: error: 'dynamic' instance method 'statusBarOrientationWillChange()' must also be '@objc'
dynamic func statusBarOrientationWillChange() {

@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastWindow.swift:112:16: error: 'dynamic' instance method 'statusBarOrientationDidChange()' must also be '@objc'
dynamic func statusBarOrientationDidChange() {
~~~~~~~      ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastCenter.swift:69:16: error: 'dynamic' instance method 'deviceOrientationDidChange()' must also be '@objc'
dynamic func deviceOrientationDidChange() {
~~~~~~~      ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:41:20: error: 'dynamic' var 'cornerRadius' must also be '@objc'
open dynamic var cornerRadius: CGFloat {
     ~~~~~~~     ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:47:20: error: 'dynamic' var 'textInsets' must also be '@objc'
open dynamic var textInsets = UIEdgeInsets(top: 6, left: 10, bottom: 6, right: 10)
     ~~~~~~~     ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:50:20: error: 'dynamic' var 'textColor' must also be '@objc'
open dynamic var textColor: UIColor? {
     ~~~~~~~     ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:56:20: error: 'dynamic' var 'font' must also be '@objc'
open dynamic var font: UIFont? {
     ~~~~~~~     ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:62:20: error: 'dynamic' var 'bottomOffsetPortrait' must also be '@objc'
open dynamic var bottomOffsetPortrait: CGFloat = {
     ~~~~~~~     ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastView.swift:73:20: error: 'dynamic' var 'bottomOffsetLandscape' must also be '@objc'
open dynamic var bottomOffsetLandscape: CGFloat = {
     ~~~~~~~     ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastWindow.swift:108:16: error: 'dynamic' instance method 'statusBarOrientationWillChange()' must also be '@objc'
dynamic func statusBarOrientationWillChange() {
~~~~~~~      ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastWindow.swift:112:16: error: 'dynamic' instance method 'statusBarOrientationDidChange()' must also be '@objc'
dynamic func statusBarOrientationDidChange() {
~~~~~~~      ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastWindow.swift:72:17: error: argument of '#selector' refers to instance method 'bringWindowToTop' that is not exposed to Objective-C
    selector: #selector(self.bringWindowToTop),
              ^              ~~~~~~~~~~~~~~~~
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastWindow.swift:101:8: note: add '@objc' to expose this instance method to Objective-C
func bringWindowToTop(_ notification: Notification) {
     ^
@objc
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastWindow.swift:90:17: error: argument of '#selector' refers to instance method 'applicationDidBecomeActive()' that is not exposed to Objective-C
    selector: #selector(self.applicationDidBecomeActive),
              ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shivgolani/ngasceapp/platforms/ios/Pods/Toaster/Sources/ToastWindow.swift:118:8: note: add '@objc' to expose this instance method to Objective-C
func applicationDidBecomeActive() {
     ^
@objc
** BUILD FAILED **
@cryptonator000
Copy link

cryptonator000 commented May 27, 2018

Same error here.
Did you solve this issue @shivgolani ?

@shivgolani
Copy link
Author

@cryptonator000 No, I removed the plugin and started using native api for android toast widget. For iOS still struggling to integrate Cocoa Pods plugin :(

@cryptonator000
Copy link

Hey @shivgolani ,
I managed to make it work.
I updated the 'Toaster' pod version in podfile within the node_modules folder to version 2.1.1.
Give it a try

@fthuin
Copy link

fthuin commented Jul 31, 2018

I have the same problem, @cryptonator000 if I do that, I'm able to build but I have runtime errors saying the Toast.alloc().initWithTextDelayDuration' is undefined. How did you avoid that?

@mahavirvataliya
Copy link

I have Same error in iOS Build Error Any Solution

@mahavirvataliya
Copy link

mahavirvataliya commented Aug 6, 2018

ERROR ReferenceError: Can't find variable: Toaster
I get Above Error when I tried @cryptonator000 's method

@marcelomiranda90
Copy link

Hello friends,

I had this problem yesterday and I was able to solve it.
It occurred after installing another plugin that forces the build to swift 4.

I was able to solve it in two ways:

Option 1:

  • Prepare the project normally:
         ex: tns prepare ios --release --bundle --env.aot --env.uglify
  • Open the project in xcode;
  • Select in the left panel "Pods", it is below the name of your application;
  • Now on targets, select Toaster (it is represented by a yellow file bag)
  • Click build settings and search for Swifit Language version;
  • Change to version 3.3;
  • Build the project;

Option 2:

  • Prepare the project normally:
         ex: tns prepare ios --release --bundle --env.aot --env.uglify
  • Open the project in xcode;
  • Click on the alert symbol to see the issues that xcode detected;
  • Look for the item "Swift corversion", click and execute the conversion;
  • Build the project;
    captura de tela 2018-08-27 as 20 15 22

@hypery2k
Copy link
Collaborator

hypery2k commented Feb 3, 2019

Fixed in Version 2.0.0

@hypery2k hypery2k closed this as completed Feb 3, 2019
@ryanjorgensen
Copy link

Can this be applied to some file in app/App_Resources instead of opening the project from the generated platform/device files?

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

7 participants