我使用一个包pusher_client:^2.0.0
在Flutter中,它可以在Android上正常工作,但是当在ios模拟器上运行我的项目时,我在控制台中收到错误。
当我运行flutter run
时,我得到以下错误,由于内容长度,我删除了错误的一些重复部分。
Xcode's output:
↳
2 warnings generated.
error: the following command failed with exit code 0 but produced no further output
CompileC
/Users/zia/Library/Developer/Xcode/DerivedData/Runner-hdzpmljlvwqzschdvjjsljzxqxtc/Build/Intermediates.noindex/
Pods.build/Debug-iphonesimulator/location.build/Objects-normal/arm64/LocationPlugin.o
/Users/zia/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/location-4.3.0/ios/Classes/LocationPlugin.m
normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'location' from project 'Pods')
/Users/zia/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_phone_direct_caller-2.1.0/ios/Classes/F
lutterPhoneDirectCallerPlugin.m:24:22: warning: 'stringByAddingPercentEscapesUsingEncoding:' is deprecated:
first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always
uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each
URL component or subcomponent has different rules for what characters are valid. [-Wdeprecated-declarations]
number = [number stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
^
In module 'UIKit' imported from /Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Target Support
Files/flutter_phone_direct_caller/flutter_phone_direct_caller-prefix.pch:2:
In module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.
2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.
2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURL.h:599:1: note:
'stringByAddingPercentEscapesUsingEncoding:' has been explicitly marked deprecated here
- (nullable NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)enc API_DEPRECATED("Use
-stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding,
and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has
different rules for what characters are valid.", macos(10.0,10.11), ios(2.0,9.0), watchos(2.0,2.0),
tvos(9.0,9.0));
^
/Users/zia/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_phone_direct_caller-2.1.0/ios/Classes/F
lutterPhoneDirectCallerPlugin.m:30:51: warning: 'openURL:' is deprecated: first deprecated in iOS 10.0
[-Wdeprecated-declarations]
} else if(![[UIApplication sharedApplication] openURL:[NSURL URLWithString:number]]) {
^~~~~~~
openURL:options:completionHandler:
In module 'UIKit' imported from /Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Target Support
Files/flutter_phone_direct_caller/flutter_phone_direct_caller-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.
2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:124:1: note: 'openURL:' has been
explicitly marked deprecated here
- (BOOL)openURL:(NSURL*)url API_DEPRECATED_WITH_REPLACEMENT("openURL:options:completionHandler:", ios(2.0,
10.0)) NS_EXTENSION_UNAVAILABLE_IOS("");
^
2 warnings generated.
/Users/zia/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_phone_direct_caller-2.1.0/ios/Classes/F
lutterPhoneDirectCallerPlugin.m:24:22: warning: 'stringByAddingPercentEscapesUsingEncoding:' is deprecated:
first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always
uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each
URL component or subcomponent has different rules for what characters are valid. [-Wdeprecated-declarations]
number = [number stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
^
In module 'UIKit' imported from /Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Target Support
Files/flutter_phone_direct_caller/flutter_phone_direct_caller-prefix.pch:2:
In module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.
2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.
2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURL.h:599:1: note:
'stringByAddingPercentEscapesUsingEncoding:' has been explicitly marked deprecated here
- (nullable NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)enc API_DEPRECATED("Use
-stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding,
and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has
different rules for what characters are valid.", macos(10.0,10.11), ios(2.0,9.0), watchos(2.0,2.0),
tvos(9.0,9.0));
^
/Users/zia/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_phone_direct_caller-2.1.0/ios/Classes/F
lutterPhoneDirectCallerPlugin.m:30:51: warning: 'openURL:' is deprecated: first deprecated in iOS 10.0
[-Wdeprecated-declarations]
} else if(![[UIApplication sharedApplication] openURL:[NSURL URLWithString:number]]) {
^~~~~~~
openURL:options:completionHandler:
In module 'UIKit' imported from /Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Target Support
Files/flutter_phone_direct_caller/flutter_phone_direct_caller-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.
2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:124:1: note: 'openURL:' has been
explicitly marked deprecated here
- (BOOL)openURL:(NSURL*)url API_DEPRECATED_WITH_REPLACEMENT("openURL:options:completionHandler:", ios(2.0,
10.0)) NS_EXTENSION_UNAVAILABLE_IOS("");
^
2 warnings generated.
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:61:34:
warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol WebSocketClient: class {
^~~~~
AnyObject
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:282:30:
warning: 'withUnsafeMutableBytes' is deprecated: use `withUnsafeMutableBytes<R>(_:
(UnsafeMutableRawBufferPointer) throws -> R) rethrows -> R` instead
let _ = peerName.withUnsafeMutableBytes { (peerNamePtr: UnsafeMutablePointer<Int8>) in
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:1326:14:
warning: 'withUnsafeBytes' is deprecated: use `withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R)
rethrows -> R` instead
data.withUnsafeBytes { _ = CC_SHA1($0, CC_LONG(data.count), &digest) }
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:1327:16:
warning: 'init(bytes:)' is deprecated: use `init(_:)` instead
return Data(bytes: digest).base64EncodedString()
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/Compression.swift:59:25:
warning: 'withUnsafeBytes' is deprecated: use `withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R)
rethrows -> R` instead
return try data.withUnsafeBytes { (bytes:UnsafePointer<UInt8>) -> Data in
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/Compression.swift:83:29:
warning: initialization of 'UnsafeMutablePointer<UInt8>' results in a dangling pointer
strm.next_out = UnsafeMutablePointer<UInt8>(&buffer)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/Compression.swift:140:14:
warning: 'withUnsafeBytes' is deprecated: use `withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R)
rethrows -> R` instead
data.withUnsafeBytes { (ptr:UnsafePointer<UInt8>) -> Void in
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:61:34:
warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol WebSocketClient: class {
^~~~~
AnyObject
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:119:35:
warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol WSStreamDelegate: class {
^~~~~
...
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:282:30:
warning: 'withUnsafeMutableBytes' is deprecated: use `withUnsafeMutableBytes<R>(_:
(UnsafeMutableRawBufferPointer) throws -> R) rethrows -> R` instead
let _ = peerName.withUnsafeMutableBytes { (peerNamePtr: UnsafeMutablePointer<Int8>) in
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:1326:14:
warning: 'withUnsafeBytes' is deprecated: use `withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R)
rethrows -> R` instead
data.withUnsafeBytes { _ = CC_SHA1($0, CC_LONG(data.count), &digest) }
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:1327:16:
warning: 'init(bytes:)' is deprecated: use `init(_:)` instead
return Data(bytes: digest).base64EncodedString()
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/Compression.swift:59:25:
warning: 'withUnsafeBytes' is deprecated: use `withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R)
rethrows -> R` instead
return try data.withUnsafeBytes { (bytes:UnsafePointer<UInt8>) -> Data in
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/Compression.swift:83:29:
warning: initialization of 'UnsafeMutablePointer<UInt8>' results in a dangling pointer
strm.next_out = UnsafeMutablePointer<UInt8>(&buffer)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/Compression.swift:83:57:
note: implicit argument conversion from '[UInt8]' to 'UnsafeMutablePointer<UInt8>' produces a pointer valid
only for the duration of the call to 'init(_:)'
strm.next_out = UnsafeMutablePointer<UInt8>(&buffer)
^~~~~~~
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/Compression.swift:83:57:
note: use the 'withUnsafeMutableBufferPointer' method on Array in order to explicitly convert argument to
buffer pointer valid for a defined scope
strm.next_out = UnsafeMutablePointer<UInt8>(&buffer)
^
...
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/Compression.swift:140:14:
warning: 'withUnsafeBytes' is deprecated: use `withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R)
rethrows -> R` instead
data.withUnsafeBytes { (ptr:UnsafePointer<UInt8>) -> Void in
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:61:34:
warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol WebSocketClient: class {
^~~~~
AnyObject
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:119:35:
warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol WSStreamDelegate: class {
^~~~~
...
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:1326:14:
warning: 'withUnsafeBytes' is deprecated: use `withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R)
rethrows -> R` instead
data.withUnsafeBytes { _ = CC_SHA1($0, CC_LONG(data.count), &digest) }
^
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Starscream/Sources/Starscream/WebSocket.swift:1327:16:
warning: 'init(bytes:)' is deprecated: use `init(_:)` instead
return Data(bytes: digest).base64EncodedString()
^
ld: in
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Sodium/Sodium/libsodium/libsodium-ios.a(libsodium_la-ae
ad_xchacha20poly1305.o), building for iOS Simulator, but linking in object file built for iOS, for architecture
arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a
placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from
project 'Runner')
/Users/zia/Desktop/projects/com_tingsapp_mover/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment
target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0
to 15.2.99. (in target 'leveldb-library' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 13.
我在上面的错误中找不到任何相关消息这是flutter--version
% flutter --version
Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 77d935af4d (7 weeks ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1
这就是我与pusher的连接方式
import 'package:pusher_client/pusher_client.dart';
...
...
class Messages extends StatefulWidget {
final Room room;
final int user;
const Messages({Key? key, required this.room, required this.user})
: super(key: key);
@override
_MessagesState createState() => _MessagesState();
}
class _MessagesState extends State<Messages> {
TextEditingController _messageController = TextEditingController();
PusherClient? pusher;
Channel? channel;
List<Message> messages = [];
@override
void initState() {
_initPusher();
super.initState();
}
@override
void dispose() {
channel?.unbind('chat-event');
pusher?.unsubscribe('chat.' + widget.room.id.toString());
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Message")),
body: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
FutureBuilder(
future: _get(),
builder: (context, snapshot) {
if (snapshot.hasData ||
snapshot.connectionState == ConnectionState.done) {
return Expanded(
child: ListView.builder(
reverse: true,
padding: EdgeInsets.only(top: 12, left: 12, right: 12),
shrinkWrap: true,
itemCount: messages.length,
itemBuilder: (context, index) {
return Column(
children: [
_buildMyMessage(messages[index]) != null
? MyMessageCard(
message: _buildMyMessage(messages[index]))
: Container(),
_buildFriendMessage(messages[index]) != null
? FriendMessageCard(
message:
_buildFriendMessage(messages[index]))
: Container(),
],
);
},
),
);
} else if (snapshot.hasError) {
return Padding(
child: Text("Error: ${snapshot.error}"),
padding: EdgeInsets.only(top: 8),
);
} else {
return Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: circularProgress(context)));
}
},
),
Container(
padding: EdgeInsets.all(5),
margin: EdgeInsets.all(5),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: SizedBox(
height: 55,
child: Card(
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
child: Padding(
padding: const EdgeInsets.only(
left: 18.0, right: 18.0, top: 3),
child: TextFormField(
controller: _messageController,
decoration: InputDecoration(
border: InputBorder.none,
isDense: true,
hintText: 'Message'),
),
),
),
),
),
SizedBox(
width: 55,
height: 55,
child: Card(
color: Tingsapp.primary,
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
child: InkWell(
onTap: () => _send(context),
child: Icon(
Icons.send,
color: Colors.white,
)),
),
)
],
),
)
],
),
),
);
}
_send(context) async {
Api api = new Api();
try {
var response = await api.post(
jsonEncode(
<String, dynamic>{
'message': _messageController.text,
},
),
"chat/room/" + "${widget.room.id}" + "/message",
);
if (response.statusCode == 200) {
_messageController.text = "";
_get();
}
} catch (err) {
showSnackbar(context, '${err.toString()}');
}
}
Future _get() async {
Api api = new Api();
try {
var response =
await api.get("chat/room/" + "${widget.room.id}" + "/messages");
if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
var messageList =
(jsonData as List).map((e) => Message.fromJson(e)).toList();
messages = messageList;
return messages;
}
return [];
} catch (err) {
showSnackbar(context, '${err.toString()}');
}
}
Future<void> _initPusher() async {
Store store = new Store();
String token = await store.read('token');
try {
pusher = PusherClient(
pusherKey,
PusherOptions(
host: broadcastPath,
encrypted: false,
auth: PusherAuth(
broadcastPath + "/broadcasting/auth",
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer $token'
},
),
cluster: 'eu',
),
enableLogging: true,
);
channel = pusher?.subscribe("private-chat." + widget.room.id.toString());
pusher?.onConnectionStateChange((state) {
print(
"previousState: ${state?.previousState}, currentState: ${state?.currentState}");
});
pusher?.onConnectionError((error) {
print("error: ${error?.message}");
});
channel?.bind('chat-event', (event) {
setState(() {});
});
} catch (e) {
print(e.toString());
}
}
}
但在我注释掉上述文件和<code>pusher_client:^2.0.0<code>中的<code>时。yaml然后运行<code>颤振运行
有人能帮忙吗拜托
这是github的链接,包含更多详细信息https://github.com/chinloyal/pusher_client/issues/46
> < li>
首先,更新您的IOs/pod文件以包含以下行:
平台:ios,“13.0”
将以下代码添加到Podfile中的post_install命令:
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
例如,我的post_install是这样的:
post_install|安装程序|installer.pods_project.targets.each|目标|flutter_additional_ios_build_settings(目标)target.build_configurations.each做|配置|config.build_settings.delete'IPHONEOS_DEPLOYMENT_TARGET'end end end
转到您的 pubspec.yaml。并将pusher_client依赖关系替换为我的分叉:
pusher_client: git: url:git://github.com/thijskuilman/pusher_client.git
转到项目根文件夹。运行扑动干净
尝试在iOS设备或模拟器上运行该应用程序
我正在尝试实现这个APIhttps://api.bnm.gov.my/portal#operation/ERLatest 根据上面的URL,它的GET请求必须带有值为“application/vnd.BNM.API.v1 json”的Accept-herader 当我尝试与邮递员,可以得到回应- 这就是我所做的,以在我的Spring启动应用程序中获得相同的响应- 但它没有得到正确的回应,我得到的是
我正在尝试访问此属性: 它在Chrome中运行良好,但在Firefox中我得到了“未定义”。有没有什么方法可以在所有浏览器中做到这一点呢? 如果你想知道我需要它做什么:我想在一个矩形的垂直中心对齐一个可变字体大小的文本。字体大小,然而,总是包括一个小的空隙以上的实际顶部的字母。我想要的是实际的像素高度。字母上方的这个差距正是我将“显性-基线”设置为“悬挂”后“offsettop”的值。
我正在尝试调用Workday招聘网络服务的Put_Background_Check操作。我已经在SoapUI中打开了WSDL文件,并成功地发送了以下XML。。。 我得到以下回应。。。 问题是,当我试图在Postman(或cURL或Python请求)中用相同的标题重新创建相同的POST请求时,我会得到无效的用户名或密码错误。SoapUI在这里做什么特别的事情吗?本案的回应如下...
Windows 10用户。我最近第一次安装git,但遇到了一个特殊的问题。我被告知,如果我想在git中使用java,我需要设置环境变量。 我能够为命令提示符正确地更改,但我无法在git bash中显示相同的更改。在命令提示符中键入将返回正确的路径,但在git bash中它将返回。 我进入系统设置并更改了系统变量,以便指向我的jdk。我更新了系统变量和环境变量中的变量,以指向bin和jdk。我关闭并
为什么这个声明在debian linux gnu(x86_64)的Distrib 10.1.29-MariaDB中不起作用,而在MySQL中起作用? 错误: 错误1064(42000):您的SQL语法有错误;检查与您的MariaDB服务器版本相对应的手册,了解使用由“MyPassword”标识的mysql_native_密码的近用户“root”@“localhost”的正确语法; 谢谢
我有一个视频流服务器,它能够使用rtp通过摄像头捕获视频帧。我的android mobile作为客户端,能够通过以下管道传输输出: udpsrc端口=5004!应用程序/x-rtp,时钟速率=90000,编码名称=(字符串)H264,有效负载=96!队列rtph264depay!H264解析!decodebin!自动视频接收器 但是,如果我用fpsdisplysink替换autoVideosink