3

I have created Flutter Project. It's working on Windows OS for Android Successfully. I have tried for the first time to run it in XCode (Mac OS) but getting some error as follows.

Running Xcode build...
Xcode build done. 14.3s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED **

Xcode's output: ↳ In file included from /xxx/xxx/xxx/ios/Pods/FirebaseAuth/FirebaseAuth/Sources/Utilities/FIRAuthURLPresenter.m:24: /xxx/xxx/xxx/ios/Pods/FirebaseAuth/FirebaseAuth/Sources/Utilities/FIRAuthDefaultUIDelegate. h:18:24: error: 'TARGET_OS_WATCHOS' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_] #if !TARGET_OS_OSX && !TARGET_OS_WATCHOS ^ 1 error generated. note: Using new build system note: Building targets in parallel note: Planning build note: Analyzing workspace note: Constructing build description note: Build preparation complete

Could not build the application for the simulator. Error launching application on iPhone 12 Pro Max.

I have added error only for reference. If you need anything please do let me know.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
  • When `clang` is compiling, the `-target ${ARCH}-apple-watchos6.2` command-line arg with `-mwatchos-version-min=6.2` arg causes right macros to be defined (and simulator-build passes `-mwatchsimulator-version-min=6.2` arg instead of second one) – Top-Master Aug 18 '21 at 15:36

2 Answers2

4

If you are using Xcode 12.5, this issue could be solved by changing TARGET_OS_WATCHOS to TARGET_OS_WATCH

You could also refer to this GitHub issue https://github.com/FirebaseExtended/flutterfire/issues/5034

gauravd2196
  • 185
  • 1
  • 11
1

Maybe some of your files have illegal characters or syntax errors.

remove extra line like

#endif without if 

it will work.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
Janvi Patel
  • 242
  • 1
  • 12