在阅读了有关如何使用Pusher的文章之后,我决定通过将其添加到我的pubspec.yamal
文件中来将其包含在我的项目中。我想介绍的插件是pusher_websocket_flutter
版本0.0.2,就像tutorial中一样。
这不是关于遵循教程和实现代码的,我什至没有。此问题仅与将库集成到Flutter中以及在iOS模拟器上运行应用程序有关。它甚至不编译,如果您愿意,只需将插件添加到您的应用程序即可重现相同的问题。
解决问题的方法:
platform :ios, '9.0'
中指定了iOS版本ENV['SWIFT_VERSION'] = '4.1'
以指定快速版本,因为没有此插件也无法使用即使执行了这些步骤,我也无法编译,这是我得到的错误:
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET firebase_analytics OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/aleksandarlugonja/Desktop/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/pusher_websocket_flutter-0.0.7/ios/Classes/PusherPlugin.m:4:17: error: definition of 'PusherPlugin' must be imported from module 'pusher_websocket_flutter.PusherPlugin' before it is required
@implementation PusherPlugin
^
In module 'pusher_websocket_flutter' imported from /Users/aleksandarlugonja/Desktop/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/pusher_websocket_flutter-0.0.7/ios/Classes/PusherPlugin.m:2:
/Users/aleksandarlugonja/Desktop/development/MyApp/build/ios/Debug-iphonesimulator/pusher_websocket_flutter/pusher_websocket_flutter.framework/Headers/PusherPlugin.h:3:12: note: previous definition is here
@interface PusherPlugin : NSObject<FlutterPlugin>