浙江小青龙 2016-07-04 01:32 采纳率: 0%
浏览 1289

iOS开发 如何实现断点上传 求给思路

断点上传 肯定意味着需要用到偏移量
NSFileHandle *readHandle = [NSFileHandle fileHandleForReadingAtPath:@"此处文件路径省略"];
[readHandle seekToFileOffset:100];//设置偏移量
NSInputStream *fileStream = [NSInputStream inputStreamWithData:[readHandle readDataToEndOfFile]];
AFHTTPRequestOperation *afOperation = [AFHTTPRequestOperation new];
afOperation.inputStream = fileStream;
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager new];
formData appendPartWithInputStream:fileStream name:@"file" fileName:str length:此处怎么填写 mimeType:@"image/jpg"];

如上,那个length参数怎么填写呢?求大神指点迷津

  • 写回答

1条回答 默认 最新

  • qq_40421987 2018-02-02 05:57
    关注

    尝试根据已上传文件大小来设置偏移量。

    评论

报告相同问题?