本页内容

Qt Multimedia 在 macOS 和 iOS 上

本页面介绍了Qt Multimedia 各项功能在 iOS 和 macOS 上的可用性。

限制

由于 iOS 版的Qt Multimedia 会使用摄像头和麦克风,因此项目文件中分配给 QMAKE_INFO_PLIST 的Info.plist 必须包含键值NSCameraUsageDescription 和NSMicrophoneUsageDescription 。否则,应用程序将在启动时终止运行。有关此键值的更多信息,请参阅 Apple 的Info.plist文档。

在 iOS 上使用 FFmpeg 库

必须将在线安装程序提供的 FFmpeg 二进制文件嵌入到应用程序的包中。要嵌入这些库,可以在应用程序的 CMakeLists.txt 文件中添加qt_add_ios_ffmpeg_libraries()命令:

qt_add_ios_ffmpeg_libraries(mytarget)

使用 QMake 时,请在您的.pro 文件中添加以下内容:

CONFIG += add_ios_ffmpeg_libraries

注意: 在线安装程序提供的 FFmpeg 二进制文件是 针对 arm64 和 x86_64-simulator 构建的,以确保它们能通过 Apple Store Connect 的验证,并在运行 iOS 模拟器时可用。

注意: 包含 FFmpeg 支持的Qt Multimedia 构建存在一项 限制,即在构建 iOS 应用程序时,必须在链接时提供 FFmpeg 库。否则将导致链接器错误。 这包括由Qt Maintenance Tool 提供的Qt Multimedia 构建版本。使用此类构建版本的应用程序必须调用qt_add_ios_ffmpeg_libraries(),或者自行链接自己的 FFmpeg 库。因此,希望部署不包含 FFmpeg 的 iOS 应用程序的开发者,必须自行构建不支持 FFmpeg 的Qt Multimedia 版本。

另请参阅 qt_add_ios_ffmpeg_libraries()。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.