【问题标题】:MCSession send resource cancelMCSession 发送资源取消
【发布时间】:2013-10-30 19:42:33
【问题描述】:

我在我的应用程序 (ios7) 中使用了多点技术。用户可以通过以下方式发送资源:

_progressSend = [session sendResourceAtURL:imageUrl withName: info toPeer:peerID withCompletionHandler:^(NSError *error) {
        // Implement this block to know when the sending resource transfer completes and if there is an error.
        if (error) {
            NSLog(@"Send resource to peer [%@] completed with Error [%@]", peerID.displayName, error);
        }
        else {
            // Create an image transcript for this received image resource

        }
    }];

问题是有时它会在中途停止,或者真的很慢。有没有办法在不断开连接的情况下取消传输:

[session disconnect];

??

【问题讨论】:

    标签: ios7 multipeer-connectivity


    【解决方案1】:

    您可以使用返回的NSProgress 对象取消传输。它有一个-cancel 方法,它的.cancellable 应该返回YES

    【讨论】:

      猜你喜欢
      • 2014-02-03
      • 1970-01-01
      • 1970-01-01
      • 2015-06-06
      • 1970-01-01
      • 2016-06-07
      • 1970-01-01
      • 1970-01-01
      • 2015-11-20
      相关资源
      最近更新 更多