0

On iOS 11, I can not send a file of light size using Multipeer Connectivity.
However, on iOS 10, it was able to send regardless of size.

If it could not be sent, the block in "completionHandler" of "MCSession.sendResource (at: withName: toPeer: withCompletionHandler :)" was not called.
(On the receiving side, "session(_:didFinishReceivingResourceWithName:fromPeer:at:withError:)" of "MCSessionDelegate" was not called.)
Probably, when the size is light, processing of the transmission status seems not functioning properly.

Even iOS 11, It was able to receive a file of light size.

What do I need to send a file of light size on iOS 11?

Error Image

MultipeerConnectivity Error Image

Programing

import MultipeerConnectivity

class SessionContainer: NSObject, MCSessionDelegate {
    var session:MCSession?
    var delegate:SessionContainerDelegate?

    func sendImage(imageUrl:URL) -> Transcript {

        var progress:Progress?
        // Loop on connected peers and send the image to each
        for peerID in (self.session?.connectedPeers)! {
            progress = self.session?.sendResource(at: imageUrl, withName: imageUrl.lastPathComponent, toPeer: peerID, withCompletionHandler: { (error) in

                // **WAS NOT CALLED!!!**
                if (error != nil) {
                    print("Send resource to peer " + peerID.displayName + " completed with Error " + error.debugDescription)
                } else {
                    // Create an image transcript for this received image resource
                    let transcript:Transcript = Transcript().initWithPeerID(peerID: (self.session?.myPeerID)!, imageUrl: imageUrl, direction: .TRANSCRIPT_DIRECTION_SEND)
                    self.delegate?.updateTranscript(transcript: transcript)
                }
                // **WAS NOT CALLED!!!**

            })

        }
        // Create an outgoing progress transcript.  For simplicity we will monitor a single NSProgress.  However users can measure each NSProgress returned individually as needed
        let transcript:Transcript = Transcript().initWithPeerID(peerID: (self.session?.myPeerID)!, imageName: imageUrl.lastPathComponent, progress: progress, direction: .TRANSCRIPT_DIRECTION_SEND)

        return transcript
    }
}

https://github.com/amarron1/MultipeerGroupChatSwift/blob/master/MultipeerGroupChatSwift/SessionContainer.swift

Refarence

amarron
  • 91
  • 1
  • 9
  • Did you make it work? – Ladislav Oct 16 '17 at 11:26
  • No, it has not work yet. I also contacted the bug report, but I don't know when the fix will be over. https://forums.developer.apple.com/message/262655#262655 – amarron Oct 16 '17 at 12:24
  • And which one is not working, small size or big one? – Ladislav Oct 16 '17 at 13:03
  • Small size is not working. Below is the answer of bugreport. ``` Engineering has determined that your bug report is a duplicate of another issue and will be closed. The open or closed status of the original report your bug was duplicated to appears in a text box within the bug detail section of the bug reporter user interface. For security and privacy reasons, we don't provide access to the original bug yours was duped to. If you have any questions or concerns, please update your report directly at this link: https://bugreport.apple.com/. ``` – amarron Oct 16 '17 at 13:47
  • Did you try sending it as NSData instead? with `sendData: toPeers:...` – Ladislav Oct 16 '17 at 13:48
  • No, I have not tried it. – amarron Oct 16 '17 at 13:54

0 Answers0