Van*_*nel 3 iphone facebook progress-bar
我想在我的iPhone应用程序将图像上传到Facebook时显示进度条.可能吗?
我可以用我制作的每个FBRequest做到吗?我还使用FBRequest检查扩展权限,有时需要花费很多时间.
谢谢.
对于进度条,您可以做一些小问题.在FBRequest.h文件中,在FBRequestDelegate协议中添加以下行:
- (void)request:(FBRequest *)request didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
Run Code Online (Sandbox Code Playgroud)
之后在FBRequest.m文件中添加此功能:
- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
if ([_delegate respondsToSelector:@selector(request:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:)]) {
[_delegate request:self didSendBodyData:bytesWritten totalBytesWritten:totalBytesWritten totalBytesExpectedToWrite:totalBytesExpectedToWrite];
}
}
Run Code Online (Sandbox Code Playgroud)
现在,您的代表每次将更多数据发布到服务器时都会收到一条消息.因此,基本上如果将其实现到您的委托中,您应该在日志中看到一些活动:
- (void)request:(FBRequest *)request didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite
{
NSLog(@"%d bytes out of %d sent.", totalBytesWritten, totalBytesExpectedToWrite);
}
Run Code Online (Sandbox Code Playgroud)
如果你有任何问题将其隐藏到当前的Facebook SDK中,请告诉我.
| 归档时间: |
|
| 查看次数: |
2967 次 |
| 最近记录: |