问题描述
*我遇到了一个麻烦,试图允许用户在我的应用程序中共享音频文件。 代码如下:
struct frenchDancer: View {
@ObservedObject var audiosettings = audioSettings()
@State private var isShareSheetShowing = false
@State private var shareButton: Image? = Image(systemName: "arrowshape.turn.up.right.circle")
Button(action: {
self.shareTrack()
}) {
self.shareButton
.foregroundColor(Color.yellow)
.font(.system(size: 44))
}
}
func shareTrack() {
isShareSheetShowing.toggle()
let activityItem = URL.init(fileURLWithPath: Bundle.main.path(forResource: "French Dancers Smile",ofType: "mp3")!)
let activityView = UIActivityViewController(activityItems: [activityItem],applicationActivities: nil)
UIApplication.shared.windows.first?.rootViewController?.present(activityView,animated: true,completion: nil)
if UIDevice.current.userInterfaceIdiom == .pad {
activityView.popoverPresentationController?.sourceView = UIApplication.shared.windows.first
activityView.popoverPresentationController?.sourceRect = CGRect(
x: UIScreen.main.bounds.width / 2.1,y: UIScreen.main.bounds.height / 2.3,width: 200,height: 200)
}
}
我现在遇到的错误是共享工作表连接无效,因此工作表甚至没有弹出。我想知道是否可能是因为我试图在已经显示的图纸上展示一张图纸。
所以这是第一个要处理的问题。除此之外,我还想知道我的共享跟踪功能中的代码是否能够共享指定的音频文件。
有关info.plist文件更改的任何相关信息也将受到赞赏。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)