Facebook's SDK does not provide the delegate function to show the progress during uploading the data to Facebook, e.g. photo. Therefore, user has to create it by adding the following functions into FBRequest.h and FBRequest.m as well as your ViewController.
In FBRequest.h, add the below function under FBRequestDelegate protocol:
- (void)request:(FBRequest *)request didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
In FBRequest.m, add the below function:
- (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];
} }
In your ViewController, add the below function to implement the delegate function:
- (void)request:(FBRequest *)request didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
NSLog(@"%d bytes out of %d sent.", totalBytesWritten, totalBytesExpectedToWrite); }
Right now, your ViewController can receive the feedback from FBRequest when the data is being uploaded to Facebook.
Showing posts with label data. Show all posts
Showing posts with label data. Show all posts
Wednesday, September 12, 2012
Tuesday, June 26, 2012
php: get input and write text file, then return
Put the following codes in the server side to receive the inputs from Apps.
<?php
<?php
// assign the input to the variables
$method = $_POST['method'];
$name = $_POST['name']; // variable to be received by server
$id = $_POST['userID']; // variable to be received by server
$id = $_POST['userID']; // variable to be received by server
echo " user name: ".$name ." id: ". $id. " method: ". $method; // echo the received data to the Apps
// write text file with above two variables
$file = "file.txt";
$fh = fopen( $file, 'w' );
$carriageReturn = "\n";
fwrite( $fh, $method );
fwrite( $fh, $carriageReturn );
fwrite( $fh, $name );
fwrite( $fh, $carriageReturn );
fwrite( $fh, $id );
fclose( $fh );
?>
Subscribe to:
Posts (Atom)