简体   繁体   English

为什么将文件从 WatchApp 传输到配套应用程序并不总是有效?

[英]Why does transfer file from WatchApp to companion app does not work always?

I am trying to send the zip file of 40-50MB from watch app to C-App it works sometimes but sometimes it takes lots of time to transfer the file, Every watch has different behavior eg Watch 3 transfers 5/10 times, watch 5 or SE works 7/10 times at some instance I am not able to transfer file to C-App at all following is the code I am using to transfer the file.我正在尝试将 40-50MB 的 zip 文件从 watch 应用程序发送到 C-App,它有时可以工作,但有时传输文件需要很多时间,每只手表都有不同的行为,例如 Watch 3 传输 5/10 次,watch 5或 SE 在某些情况下工作 7/10 次我根本无法将文件传输到 C-App 以下是我用来传输文件的代码。

      let session = WCSession.default
      if session.activationState == .activated {
         session.transferFile(fileToTransfer, metadata: nil)
      }

Thanks for your attention.感谢您的关注。 I'm looking forward to your reply.我期待着您的回复。

transferFile(_:metadata:) method to transfer files in the background. transferFile(_:metadata:) 方法在后台传输文件。 background transfers are not delivered immediately.后台传输不会立即交付。 If you want to send instant message, you can try sendMessage or sendMessageData method.如果要发送即时消息,可以尝试 sendMessage 或 sendMessageData 方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM