-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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 #118832
Comments
Hi @ricoberger, Can you please provide a minimal complete reproducible code sample so that we can investigate this? I tried adding the portion commented out from your code, but for me, it seems like the apis are not available. Thank you |
Hi @danagbemava-nc, I will do so, but what you shared is exactly the problem. The question for me is why is If I go to the definition of FLUTTER_DARWIN_EXPORT
@protocol FlutterBinaryMessenger <NSObject>
/// TODO(gaaclarke): Remove optional when macos supports Background Platform Channels.
@optional
- (NSObject<FlutterTaskQueue>*)makeBackgroundTaskQueue;
- (FlutterBinaryMessengerConnection)
setMessageHandlerOnChannel:(NSString*)channel
binaryMessageHandler:(FlutterBinaryMessageHandler _Nullable)handler
taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue; I'm not sure if it helps, but I also tried to import import Flutter.FlutterBinaryMessenger If I then jump to definition of the import in Xcode it looks like the following and doesn't contain public protocol FlutterBinaryMessenger : NSObjectProtocol {
/// TODO(gaaclarke): Remove optional when macos supports Background Platform Channels. |
@ricoberger, thanks for the clarification. I don't think the sample will be necessary anymore. I saw the same thing as reported in #118832 (comment) when I looked up the definitions. Labeling for further investigation. The code sample I used is attached below. flutter doctor -v
|
Huh I can reproduce this too on Xcode 14.1, and the reporter is on Xcode 14.2. As @ricoberger says only the required methods are in the generated Swift protocol: public protocol FlutterBinaryMessenger : NSObjectProtocol {
/// TODO(gaaclarke): Remove optional when macos supports Background Platform Channels.
/**
* Sends a binary message to the Flutter side on the specified channel, expecting
* no reply.
*
* @param channel The channel name.
* @param message The message.
*/
func send(onChannel channel: String, message: Data?)
/**
* Sends a binary message to the Flutter side on the specified channel, expecting
* an asynchronous reply.
*
* @param channel The channel name.
* @param message The message.
* @param callback A callback for receiving a reply.
*/
func send(onChannel channel: String, message: Data?, binaryReply callback: FlutterBinaryReply? = nil)
/**
* Registers a message handler for incoming binary messages from the Flutter side
* on the specified channel.
*
* Replaces any existing handler. Use a `nil` handler for unregistering the
* existing handler.
*
* @param channel The channel name.
* @param handler The message handler.
* @return An identifier that represents the connection that was just created to the channel.
*/
func setMessageHandlerOnChannel(_ channel: String, binaryMessageHandler handler: FlutterBinaryMessageHandler? = nil) -> FlutterBinaryMessengerConnection
/**
* Clears out a channel's message handler if that handler is still the one that
* was created as a result of
* `setMessageHandlerOnChannel:binaryMessageHandler:`.
*
* @param connection The result from `setMessageHandlerOnChannel:binaryMessageHandler:`.
*/
func cleanUpConnection(_ connection: FlutterBinaryMessengerConnection)
} Objective-C code here: I would have expected it to generate cc @hellohuanlin who might be interested in this. |
When will the definitions be available from swift? Otherwise this does not work in swift. |
@gaaclarke curious we have tried moving the full definition of |
Yea, I'm doing that right now. I think that should be enough to fix it, starting to work on it: flutter/engine#47348. It's a bit tricky because I wanted to make it private. Unfortunately some people have hacked around the issue so I may have to take that into consideration. |
fixes flutter/flutter#118832 This makes the `FlutterTaskQueue` protocol visible, but keeps the `dispatch:` selector private. Under the covers there are runtime checks to make sure `dispatch:` is available since we can't have compile time checks anymore. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
fyi @chickenblood this has landed, it will take a while to roll to you though. |
Many thanks for the turnaround. |
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 |
Hi, this is a duplicate of #97968 reported by @gaaclarke, sorry that I had to open a new issue, but I'm not able to comment on the other issue.
I'm also able to reproduce this on two different MacBooks (both with an M1 chip), one with a new installation of Xcode, so that I'm not sure if this is really just related to some
weird caching happening locally
.Steps to Reproduce
When I want to switch to background threads on iOS as shown in the following:
I receive the following error for
flutter run
:The complete file can be found here: the source code of the whole file can be found here: https://github.com/kubenav/kubenav/blob/main/ios/Runner/KubenavPlugin.swift
Logs
The text was updated successfully, but these errors were encountered: