I am sharing a video on Facebook using Facebook SDK 3.1.1. I have mentioned the code here.
FBRequestConnection *newConnection = [[FBRequestConnection alloc] init];
// for each fbid in the array, we create a request object to fetch
// the profile, along with a handler to respond to the results of the request
NSString *fbid = #"me";
// create a handler block to handle the results of the request for fbid's profile
FBRequestHandler handler =
^(FBRequestConnection *connection, id result, NSError *error) {
// output the results of the request
[self requestCompleted:connection forFbID:fbid result:result error:error];
};
// create the request object, using the fbid as the graph path
// as an alternative the request* static methods of the FBRequest class could
// be used to fetch common requests, such as /me and /me/friends
NSData *videoData = [NSData dataWithContentsOfFile:path];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, #"video.mov",
#"video/quicktime", #"contentType",
#"Video", #"title",
#"Video Test Description", #"description",
#"hello",#"subdescription",
nil];
FBRequest *request = [[FBRequest alloc] initWithSession:theDelegate.session graphPath:#"me/videos" parameters:params HTTPMethod:#"POST"];
//:FBSession.activeSession graphPath:#"me/?fields=location"];
// add the request to the connection object, if more than one request is added
// the connection object will compose the requests as a batch request; whether or
// not the request is a batch or a singleton, the handler behavior is the same,
// allowing the application to be dynamic in regards to whether a single or multiple
// requests are occuring
[newConnection addRequest:request completionHandler:handler];
// if there's an outstanding connection, just cancel
[self.requestConnection cancel];
// keep track of our connection, and start it
self.requestConnection = newConnection;
[newConnection start];
It was working properly earlier. I get the shared Video Id in response every time I initiate an upload video request. But I keep getting the following message when I check my profile on FB in the notifications.
Your Video could not be processed. Visit the Video help page to learn about common problems
I have tried this with different AppIds. Uploading video is working though when I upload it using Facebook website.
Its working now :)
you can check at
https://developers.facebook.com/bugs/543903808965945
This seems to be a new known Facebook bug (first report today).
You can back the bug report here:
http://developers.facebook.com/bugs/543903808965945
Related
In my app, a user can create a message and send it. When the user sends the message, the message is created with createRecord and the server replies with 201 Created if successful.
Also, the user can get messages from other users through a websocket. When it receives a message, I push it into the store with pushPayload.
var parsedData = JSON.parse(data);
this.store.pushPayload('message', parsedData);
The problem is, when a user sends a message and saves it, they also get it back from the websocket, and even though both objects have the same id, the store ends up with duplicate messages.
How can I tell the store than when I push or save something with the same id of an already existing element, it should override it?
Simply perform a check to see whether the model is already in the store before adding it:
var parsedData = JSON.parse(data);
if(this.store.hasRecordForId ('typeOfYourRecord', parsedData.id)){
// logic you want to run when the model is already in the store
var existingItem = this.store.find('typeOfYourRecord', parsedData.id);
// perform updates using returned data here
} else {
this.store.pushPayload('message', parsedData);
}
The only method I found to avoid this problem is to run my update in a new runloop. If the delay in ms in long enough, the problem won't occur.
It seems that receiving the update from the websocket and the request at nearly the same time creates a race condition in Ember Data.
How can I retrieve this photo through graph API?
It is not possible to get photos posted to the wall of an event like your sample.
I had a client last summer who started a contest that had people post photos to an event wall. They asked me to get them for display on their website. We had to manually download them to get them.
You can look at the feed for that event using
/412778502140672/event?fields=feed
But there are no attachments, and no connections. I don't believe it is possible to even get an event's stream using FQL.
If you are working on Android then this way can help you
Request r=Request.newMeRequest(session, new Request.GraphUserCallback() {
#Override
public void onCompleted(GraphUser user, Response response) {
// TODO Auto-generated method stub
JSONObject jso=null;
try{
//Parse json here
}
catch ( Exception e)
{
//Log.d(sTag,e.getMessage());
}
}
});
Bundle paramsPics=r.getParameters();
paramsPics.putString("fields",
"photos");
r.setParameters(paramsPics);
Response response=r.executeAndWait();
In the "me/home" API call, an item that has a photo will have a "picture" field with the source URL for a low resolution picture. To get to original high resolution picture, and dimensional variants of it, you have to do another API call using the "object_id" field in the same JSONObject as the "picture" field.
Doing the graph call for the "object_id" will then give you a "source" field with the original source image URL, as well as an array of different image sizes.
EDIT:
Set the graph path to "412778502140672_425592530859269" for the post.
Set the graph path to "482760011786004" for the photo.
I am going to try to explain with out confusion: I am using the Three20 Library
I have a PostEdit class that contains a xib and class that creates a "popup" calls Edit Post (image below), over an existing view (PostSearch) so that the user does not have to leave the screen when they are trying to edit a Forum Posting they created.
So when the user pushes the send button and the data is sent back to the server, i want to invalidateModel back the PostSearch class (Model/DataSource). This is where I have not clue what to do.
I have even tried this with out success in my PostEdit class.
PostSearch *post = [[PostSearch alloc] init];
[post Invalidate];
[post invalidateModel];
[post invalidateView];
[post release];
I am not sure I understand what you are trying to do; in any case, I will try to answer assuming that PostSearch is a controller that lies below PostEdit; after editing a post and clicking done, you want to update PostSearch.
If this is correct, then what you need to do is access the PostSearch object which is already existing and currently displayed under PostEdit. E.g., you could:
pass a reference to PostSearch when you create your PostEdit; then in the done button handler you would invalidate its model; or,
register your PostSearch object for a notification (through the NSNotificationCenter) that PostEdit would fire when Done is tapped; or,
use a "brute-force" approach and in your PostSearch viewWillAppear do the invalidation.
I have never used the invalidateModel method. What I do when I need to refresh my data, is:
self.model = nil;
self.model;
you could also give this a try.
My capstone team has decided to use Qooxdoo as the front end for our project. We're developing apps for OpenFlow controllers using NOX, so we're using the NOX webservices framework. I'm having trouble getting data from the service; I know the service is running because if I go to the URL using Firefox the right data shows up. Here's the relevant portion of my code:
var req = new qx.io.remote.Request("http://localhost/ws.v1/hello/world",
"GET", "text/plain");
req.addListener("complete", function(e) {
this.debug(e.getContent());
});
var get = new qx.ui.form.Button("get");
get.addListener("execute", function() {
alert("The button has been pressed");
req.send();
}, this);
form.addButton(get);
In the firebug console I get this message after I click through the alert:
008402 qx.io.remote.Exchange: Unknown status code: 0 (4)
And if I press the Get button again I get this error:
027033 qx.io.remote.transport.XmlHttp[56]: Failed with exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: file:///home/user/qooxdoo-1.0-sdk/framework/source/class/qx/io/remote/transport/XmlHttp.js :: anonymous :: line 279" data: no]
I've also looked at the Twitter Client tutorial, however the "dataChange" event I set up in place of the "tweetsChanged" event never fired. Any help is appreciated, thank you.
This sound like a cross domain request issue. qx.io.remote.Request uses XHR for transporting the data which may not work in every case due to the browser restriction. Switching the crossDomain flag on the request to true will change from XHR to a dynamically inserted script tag doesn't have the cross domain restriction (but other restrictions).
req.setCrossDomain(true);
Maybe that solves your problem.
Additionally, you can take a look at the documentation of the remote package to get some further details on cross domain requests:
http://demo.qooxdoo.org/current/apiviewer/#qx.io.remote
Also take care not to use a request object twice. The only work once.
I have found numerous examples on uploading a file to a web server via C++ on Windows.
However I am struggling after a lot of searching (and I thought I was good with Google!) to find any examples to help me achieve the same on a Mac.
Can anyone point me towards some help on how to upload a file to a web server on a Mac OS using either C++ or objective C?
It can be via either HTTP/HTTPS or FTP/FTPS (or both).
Thanks!
You could use 'libcurl', see this article on Wikipedia.
You would want to use an NSURLConnection with a NSMutableURLRequest, something like this:
NSMutableURLRequest *theRequest=[[NSMutableURLRequest alloc] init];
[theRequest addValue:#"attachment;filename=\"file2.gif\"" forHTTPHeaderField:#"Content-disposition"];
[theRequest addValue:#"image/gif" forHTTPHeaderField:#"Content-Type"];
[theRequest addValue:#"binary" forHTTPHeaderField:#"Content-Transfer-Encoding"];
[theRequest setHttpBody:myBodyNSDataObject];
// create the connection with the request
// and start loading the data
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
// Create the NSMutableData that will hold
// the received data
// receivedData is declared as a method instance elsewhere
receivedData=[[NSMutableData data] retain];
} else {
// inform the user that the download could not be made
}
You can modify or set headers using the NSMutableURLRequest method:
- (void)addValue:(NSString *)value forHTTPHeaderField:(NSString *)field
The response will be whatever the server comes back with. You can check out Apple's documentation for the rest of the delegate methods to implement to get the body of the response back. You should have the NSData object representing the content of the file you want to upload ready. Doing the same using FTP is a bit more involved, but this will work to post the file body up. You will want to make sure your NSData object is set up like the body of an HTTP post, such that you set up the headers like:
[theRequest addValue:#"attachment;filename=\"file2.gif\"" forHTTPHeaderField:#"Content-disposition"];
[theRequest addValue:#"image/gif" forHTTPHeaderField:#"Content-Type"];
[theRequest addValue:#"binary" forHTTPHeaderField:#"Content-Transfer-Encoding"];
And then you should append the body. On the server side, you can get the file name and the bytes composing the file.
This is not exactly the code you should use, but it should give you a good idea of how to proceed.
connection Kit might be what your looking for