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

Swift unable to find symbols at compile-time that are present in the iOS artifacts #97968

Closed
gaaclarke opened this issue Feb 7, 2022 · 4 comments
Labels
P0 Critical issues such as a build break or regression platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@gaaclarke
Copy link
Member

gaaclarke commented Feb 7, 2022

When compiling an app with flutter run on the master channel the taskQueue API is not present. If you look at the headers and the binaries it should be present though. In XCode if you right click on the taskQueue API it exists, but it doesn't show up in autocomplete. It's almost if the tool is using a wrong version of the Flutter framework.

I've attempted flutter clean and cleaning from Xcode but it didn't remove the problem.

Failed Compilation
aaclarke-macbookpro2:platform_channels_benchmarks aaclarke$ flutter run --release
Launching lib/main.dart on Aaron’s iPhone in release mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: S8QB4VV633
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        713ms
Xcode build done.                                           21.5s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/2y/72984f4n0r7fskhjt3qctglw00915v/T/flutter_tools.aoWNdW/flutter_ios_build_temp_dirF7xoLL/temporary_xcresult_bundle

    /Users/aaclarke/dev/flutter/dev/benchmarks/platform_channels_benchmarks/ios/Runner/AppDelegate.swift:34:43: error: value of type
    'FlutterBinaryMessenger' has no member 'makeBackgroundTaskQueue'
        let taskQueue = registrar.messenger().makeBackgroundTaskQueue();
                        ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
    /Users/aaclarke/dev/flutter/dev/benchmarks/platform_channels_benchmarks/ios/Runner/AppDelegate.swift:37:71: error: extra argument
    'taskQueue' in call
          codec: FlutterStandardMessageCodec.sharedInstance(), taskQueue: taskQueue);
                                                                          ^~~~~~~~~
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order

    Result bundle written to path:
    	/var/folders/2y/72984f4n0r7fskhjt3qctglw00915v/T/flutter_tools.aoWNdW/flutter_ios_build_temp_dirF7xoLL/temporary_xcresult_bundle


Could not build the precompiled application for the device.

It appears that your application still contains the default signing identifier.
Try replacing 'com.example' with your signing id in Xcode:
  open ios/Runner.xcworkspace

Error running application on Aaron’s iPhone.
Artifact Header Search
aaclarke-macbookpro2:platform_channels_benchmarks aaclarke$ find /Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios* -name "FlutterChannels.h" -print -exec grep  taskQueue {} \; 
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Headers/FlutterChannels.h
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Headers/FlutterChannels.h
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios-profile/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Headers/FlutterChannels.h
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios-profile/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Headers/FlutterChannels.h
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Headers/FlutterChannels.h
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Headers/FlutterChannels.h
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
 * @param taskQueue The FlutterTaskQueue that executes the handler (see
                   taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
Artifact Symbol Search
aaclarke-macbookpro2:platform_channels_benchmarks aaclarke$ find /Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios* -name "Flutter" -print -exec sh -c "nm {} | grep taskQueue" \;
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter
00000000005ae13a t -[FlutterBasicMessageChannel initWithName:binaryMessenger:codec:taskQueue:]
0000000000003658 t -[FlutterBinaryMessengerRelay setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
000000000000c1f7 t -[FlutterEngine setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
00000000005af29e t -[FlutterEventChannel initWithName:binaryMessenger:codec:taskQueue:]
00000000005aedda t -[FlutterMethodChannel initWithName:binaryMessenger:codec:taskQueue:]
000000000002b87a t -[FlutterViewController setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0000000001bce518 s _OBJC_IVAR_$_FlutterBasicMessageChannel._taskQueue
0000000001bce588 s _OBJC_IVAR_$_FlutterEventChannel._taskQueue
0000000001bce568 s _OBJC_IVAR_$_FlutterMethodChannel._taskQueue
00000000005fc3c0 t __ZN4dart16DartLibraryCalls19DrainMicrotaskQueueEv
000000000048ef02 t __ZN5tonic18DartMicrotaskQueue13RunMicrotasksEv
000000000048ee08 t __ZN5tonic18DartMicrotaskQueue17ScheduleMicrotaskEP12_Dart_Handle
000000000048edde t __ZN5tonic18DartMicrotaskQueueC1Ev
000000000048edfa t __ZN5tonic18DartMicrotaskQueueD1Ev
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Flutter
0041cb5c t -[FlutterBasicMessageChannel initWithName:binaryMessenger:codec:taskQueue:]
000083c8 t -[FlutterBinaryMessengerRelay setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0001435c t -[FlutterEngine setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0041da64 t -[FlutterEventChannel initWithName:binaryMessenger:codec:taskQueue:]
0041d61a t -[FlutterMethodChannel initWithName:binaryMessenger:codec:taskQueue:]
000303f8 t -[FlutterViewController setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0195f754 s _OBJC_IVAR_$_FlutterBasicMessageChannel._taskQueue
0195f78c s _OBJC_IVAR_$_FlutterEventChannel._taskQueue
0195f77c s _OBJC_IVAR_$_FlutterMethodChannel._taskQueue
0046ba40 t __ZN4dart16DartLibraryCalls19DrainMicrotaskQueueEv
0034074a t __ZN5tonic18DartMicrotaskQueue13RunMicrotasksEv
0000000000510bf8 t -[FlutterBasicMessageChannel initWithName:binaryMessenger:codec:taskQueue:]
0000000000008ab0 t -[FlutterBinaryMessengerRelay setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0000000000015f10 t -[FlutterEngine setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0000000000511e38 t -[FlutterEventChannel initWithName:binaryMessenger:codec:taskQueue:]
000000000051191c t -[FlutterMethodChannel initWithName:binaryMessenger:codec:taskQueue:]
0000000000033380 t -[FlutterViewController setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0000000001bca3d8 s _OBJC_IVAR_$_FlutterBasicMessageChannel._taskQueue
0000000001bca410 s _OBJC_IVAR_$_FlutterEventChannel._taskQueue
0000000001bca400 s _OBJC_IVAR_$_FlutterMethodChannel._taskQueue
0000000000576c08 t __ZN4dart16DartLibraryCalls19DrainMicrotaskQueueEv
00000000003f0a30 t __ZN5tonic18DartMicrotaskQueue13RunMicrotasksEv
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios-profile/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter
00000000005ae13a t -[FlutterBasicMessageChannel initWithName:binaryMessenger:codec:taskQueue:]
0000000000003658 t -[FlutterBinaryMessengerRelay setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
000000000000c1f7 t -[FlutterEngine setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
00000000005af29e t -[FlutterEventChannel initWithName:binaryMessenger:codec:taskQueue:]
00000000005aedda t -[FlutterMethodChannel initWithName:binaryMessenger:codec:taskQueue:]
000000000002b87a t -[FlutterViewController setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0000000001bce518 s _OBJC_IVAR_$_FlutterBasicMessageChannel._taskQueue
0000000001bce588 s _OBJC_IVAR_$_FlutterEventChannel._taskQueue
0000000001bce568 s _OBJC_IVAR_$_FlutterMethodChannel._taskQueue
00000000005fc3c0 t __ZN4dart16DartLibraryCalls19DrainMicrotaskQueueEv
000000000048ef02 t __ZN5tonic18DartMicrotaskQueue13RunMicrotasksEv
000000000048ee08 t __ZN5tonic18DartMicrotaskQueue17ScheduleMicrotaskEP12_Dart_Handle
000000000048edde t __ZN5tonic18DartMicrotaskQueueC1Ev
000000000048edfa t __ZN5tonic18DartMicrotaskQueueD1Ev
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios-profile/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Flutter
00419fc0 t -[FlutterBasicMessageChannel initWithName:binaryMessenger:codec:taskQueue:]
000073d8 t -[FlutterBinaryMessengerRelay setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
000131a8 t -[FlutterEngine setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0041aec8 t -[FlutterEventChannel initWithName:binaryMessenger:codec:taskQueue:]
0041aa7e t -[FlutterMethodChannel initWithName:binaryMessenger:codec:taskQueue:]
0002f030 t -[FlutterViewController setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
00a5e990 s _OBJC_IVAR_$_FlutterBasicMessageChannel._taskQueue
00a5e9c8 s _OBJC_IVAR_$_FlutterEventChannel._taskQueue
00a5e9b8 s _OBJC_IVAR_$_FlutterMethodChannel._taskQueue
0045a2e6 t __ZN4dart16DartLibraryCalls19DrainMicrotaskQueueEv
0033f326 t __ZN5tonic18DartMicrotaskQueue13RunMicrotasksEv
000000000050bdd8 t -[FlutterBasicMessageChannel initWithName:binaryMessenger:codec:taskQueue:]
0000000000005ff4 t -[FlutterBinaryMessengerRelay setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
00000000000132e4 t -[FlutterEngine setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
000000000050d018 t -[FlutterEventChannel initWithName:binaryMessenger:codec:taskQueue:]
000000000050cafc t -[FlutterMethodChannel initWithName:binaryMessenger:codec:taskQueue:]
0000000000030590 t -[FlutterViewController setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:]
0000000000c08a60 s _OBJC_IVAR_$_FlutterBasicMessageChannel._taskQueue
0000000000c08a98 s _OBJC_IVAR_$_FlutterEventChannel._taskQueue
0000000000c08a88 s _OBJC_IVAR_$_FlutterMethodChannel._taskQueue
000000000055d16c t __ZN4dart16DartLibraryCalls19DrainMicrotaskQueueEv
00000000003edbcc t __ZN5tonic18DartMicrotaskQueue13RunMicrotasksEv
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter
/Users/aaclarke/dev/flutter/bin/cache/artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Flutter
Flutter Doctor
aaclarke-macbookpro2:platform_channels_benchmarks aaclarke$ flutter doctor -v
[✓] Flutter (Channel master, 2.11.0-0.0.pre.452, on macOS 12.2 21D49 darwin-x64, locale en-US)
    • Flutter version 2.11.0-0.0.pre.452 at /Users/aaclarke/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ba01ec8faa (2 days ago), 2022-02-05 22:05:18 -0500
    • Engine revision 0712096899
    • Dart version 2.17.0 (build 2.17.0-85.0.dev)
    • DevTools version 2.10.0

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/aaclarke/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio with Blaze.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.64.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (3 available)
    • Aaron’s iPhone (mobile) • 00008030-000614363C43802E • ios            • iOS 15.2.1 19C63
    • macOS (desktop)         • macos                     • darwin-x64     • macOS 12.2 21D49 darwin-x64
    • Chrome (web)            • chrome                    • web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
@gaaclarke gaaclarke added tool Affects the "flutter" command-line tool. See also t: labels. P1 platform-ios iOS applications specifically labels Feb 7, 2022
@gaaclarke gaaclarke changed the title iOS release engine artifacts out of sync Unable to find symbols at compile-time that are present in the iOS artifacts Feb 7, 2022
@gaaclarke
Copy link
Member Author

I added an objc file to my project and it is able to compile against the task queue API. The problem appears to be something specific to swift:

#import "Foo.h"
@import Flutter;

@implementation Foo

- (void)foo {
  NSObject<FlutterBinaryMessenger>* messenger = nil;
  id<FlutterTaskQueue> taskQueue = [messenger makeBackgroundTaskQueue];
  FlutterBasicMessageChannel* channel = [[FlutterBasicMessageChannel alloc] initWithName:@"hi" binaryMessenger:messenger codec:nil taskQueue:nil];
}

@end

@gaaclarke gaaclarke changed the title Unable to find symbols at compile-time that are present in the iOS artifacts Swift unable to find symbols at compile-time that are present in the iOS artifacts Feb 7, 2022
@gaaclarke
Copy link
Member Author

I don't have a valid explanation for this. It seems like the module cache is out of date but I deleted it multiple times and it still seems to show up old. I'm not sure if there is a bug per say in the tooling or some sort of bad state my build environment got into.

I tried:

  1. xcode clean
  2. flutter clean
  3. deleting derived data
  4. restarting xcode

@gaaclarke
Copy link
Member Author

@jmagman was unable to reproduce the issue. There must be some weird caching happening locally. I worked around the issue by rewriting my code in objc.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2022
@flutter-triage-bot flutter-triage-bot bot added P0 Critical issues such as a build break or regression and removed P1 labels Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P0 Critical issues such as a build break or regression platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

1 participant