rackerlabs / ios-cloudfiles Goto Github PK
View Code? Open in Web Editor NEWRackspace Cloud Files SDK for iOS
Home Page: http://www.rackspace.com/cloud/cloud_hosting_products/files/
Rackspace Cloud Files SDK for iOS
Home Page: http://www.rackspace.com/cloud/cloud_hosting_products/files/
Currently, the identity v2.0 API seems not be supported. We'd like to implement multiple API keys and deprecate the admin API key to keep a separation of different systems (using the via API-only sub-users).
See http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/QuickStart-000.html for the Identity API docs.
Any plans on this or do you want a pull request?
How do I get the CDN Url after uploading a file?! Thanks
Im using the code:
[self.container uploadObject:o success:^{
self.object = o;
NSLog(@"%@", o.description);
} failure:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self stopWaiting];
}];
Hi,
I'm using rackerlabs/ios-cloudfiles github repository code on my Objective-C project. I'm able to authenticate, list containers and list objects. Now, I have the exact RSStorageObject I want. How can I get this RSStorageObject URL?!
I have a container name in mind and I want to list all url of all objects inside that container. The code below is the best way?
RSClient *client = [[RSClient alloc] initWithProvider:RSProviderTypeRackspaceUS username:@"XXXX" apiKey:@"XXX"];
[client authenticate:^{
[client getContainers:^(NSArray *objects, NSError *jsonError) {
for (RSContainer *containerObj in objects) {
[client getContainerMetadata:containerObj success:^{
if ([[containerObj name] isEqualToString:@"MYCONTAINER"]) {
[containerObj getObjects:^(NSArray *objects, NSError *jsonError) {
for (RSStorageObject *storageObj in objects) {
// HOW CAN I GET THE URL OF THIS RSStorageObject ???
Thank you!!!!!
The call to +[NSURLConnection sendAsynchronousRequest:queue:completionHandler:] in RSClient.m:154 is only avail in iOS 5.
I've tested this on a 4.3 device and it crashes. Here's the 4.3 - 5.0 diff doc:
https://developer.apple.com/library/ios/#releasenotes/General/iOS50APIDiff/
and the actual iOS SDK doc for the selector:
Hi there, I was uploading images to Cloud Files and was setting the content_type property on RSStorageObject to "image/jpg" but when I view the file in the dashboard at manage.rackspacecloud.com the Type is set to "application/json".
It appears to me that the Content-Type header is not being set in
- (NSURLRequest *)uploadObjectRequest:(RSStorageObject *)object
of RSContainer.m.
Should this line be there?
[request addValue:$S(@"%@", object.content_type) forHTTPHeaderField:@"Content-Type"];
After I added it and uploaded the file I observe that the Type is then set to "application/json, image/jpg" which is an improvement as it caused Chrome to attempt to render the image as a json file but it'd be great if the "application/json" content type weren't added.
If you upload a object with meta data it gives a 400 error.
The following line in RSContainer.m need so be fixed
73: [request addValue:[object.metadata valueForKey:key] forHTTPHeaderField:$S(@"X-Object-Meta-%@", key)];
(add the %@ that is missing)
It would be great if i could add this library by just adding it to my Podfile
So, I'm using the RackSpaceCloudFiles unit tests logic (pretty much identical logic) to essentially do the following:
Steps 1-3 work just fine, and if I login my admin panel, I can see the container, and see that it is CDN enabled.
However, when I try to create an image to upload (or any test file), I never see anything happen. The success handler never completes. The failure handler never completes...it just stops doing anything. My code continues to run no problem.
With that said, if I run the RackSpace unit tests, everything works perfectly. The sample file is created and uploaded...and I can see it in my admin panel.
Here is my logic, just wondering if anything seems blatantly wrong? The code is kicked off with a call to [self uploadImage]
Thanks in advance.
# pragma mark - RackspaceCloud Files logic
# if !TARGET_IPHONE_SIMULATOR
- (void)createContainer:(void (^)(RSContainer *))successHandler {
self.rsContainer = [[RSContainer alloc] init];
self.rsContainer.name = self.user.userId;
[self.rsClient createContainer:self.rsContainer success:^{
successHandler(self.rsContainer);
} failure:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
NSLog(@"Failed to create container: %@", self.rsContainer.name);
}];
}
-
(void)cdnEnableContainer:(void (^)(RSCDNContainer *))successHandler {
if (self.rsContainer) {
[self.rsClient cdnEnableContainer:self.rsContainer success:^(RSCDNContainer *cdnContainer) {
if (self.rsCDNContainer) {
NSLog(@"CDN URL: %@", self.rsCDNContainer.cdn_uri.absoluteString);
self.user.imageUrl = self.rsCDNContainer.cdn_uri.absoluteString;
}
successHandler(cdnContainer);
} failure:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
NSLog(@"Failed to create CDN Enabled Container: %@", self.rsCDNContainer.name);
}];
}
}
-
(void)createObject:(void (^)(RSStorageObject *))successHandler {
self.rsObject = [[RSStorageObject alloc] init];
self.rsObject.name = [NSString stringWithFormat:@"%@_profile.png",self.user.userId];
self.rsObject.content_type = @"image/png";
self.rsObject.data = UIImagePNGRepresentation(self.profileImageView.image);
[self.rsContainer uploadObject:self.rsObject success:^{
successHandler(self.rsObject);
} failure:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
NSLog(@"Failed to create object: %@",self.rsObject.name);
}];
}
-
(void)uploadImage
{
//Let's try to save this image out to the server
self.rsClient = [[RSClient alloc] initWithProvider:RSProviderTypeRackspaceUS username:@"username" apiKey:@"apikey"];
[self createContainer:^(RSContainer *c) {
[self createObject:^(RSStorageObject *o) {
[self cdnEnableContainer:^(RSCDNContainer *cdnContainer) {
if (self.rsCDNContainer)
NSLog(@"CDN Url: %@",self.rsCDNContainer.cdn_uri);
}];
}];
}];
}
On the morning of Saturday, March 23, 2013, the 'rackspace' organization on GitHub will be reorganized. All repos will be moved to the new 'rackerlabs' organization, except for those that are designed to be used by Rackspace customers and which are fully supported.
Please update any links to this repo to reflect the new location within GitHub. For example, if the link to your repo is 'https://github.com/rackspace/foo', you need to change it to 'https://github.com/rackerlabs/foo'.
When retrieving a list of CDN Containers, the call to initWithJSONDictionary will fail due to the JSON containing a key cdn_ios_uri.
I'm interested in uploading files from my application, directly to my rack-space instance. I'm wondering if that would be an appropriate use of this or if deploying an application that uses the rackspace api key would be a bad practice
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.