mattrubin / appdotnet Goto Github PK
View Code? Open in Web Editor NEW[Discontinued] Asynchronous Objective-C wrapper for the App.net API
[Discontinued] Asynchronous Objective-C wrapper for the App.net API
ADNClient+ADNUser.m
ADNClient+ADNFile.m
http://developers.app.net/docs/authentication/flows/password/
ADNAuthenticationRequest.m
ADNClient+ADNUser.m
Trying to add image sharing to my test App.net client.
[[ADNClient sharedClient] createFileNamed:finalFilename withContent:imageAsPngData mimeType:@"image/png" metadata:@{@"type" : [NSString stringWithFormat:@"%@.upload", [[NSBundle mainBundle] bundleIdentifier]], @"public" : @1} completionHandler:^(ADNFile *file, ADNMetadata *meta, NSError *error){
if (file) {
NSLog(@"file uploaded: %@", file);
[self submitPostWithFile:file];
} else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"Could not upload image: %@", [error localizedDescription]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
}];
However my app crashes (it doesn't appear to get to the completion block, I am not seeing any NSLog()
s from my completion block showing up in console)
2013-05-01 00:28:49.363 CrApp.net[19104:907] *** Caught exception setting key "permanentURL" from {
complete = 1;
derivedFiles = {
"image_thumb_200s" = "<ADNDerivedFile: 0x1f235220> {\n mimeType = \"image/png\";\n sha1 = 16a22d9df8699cbd356db028ffc8c2d37a19c72a;\n size = 79916;\n url = \"https://d36tc8clsz1tk5.cloudfront.net/adn-uf-01/5R/_S/in/5R_SinAnVcNDUrIIBhgi1ypgPRqhZ-qlSirqlMVSczc?response-cache-control=public%2C%20max-age%3D7200%2C%20s-maxage%3D172800&response-content-disposition=inline%3B%20filename%2A%3DUTF-8%27%27IMG_0247.png&Expires=1367398800&Signature=miHqcZp8XsuMDJazasiZQjY-sp7GaN-UWsRT3JU6-v0sINkmp5uKD67lG9sl5rZI7X9RljhI~8CL62-mMhD9S0-12wZqWTQl9SvDc6D3iLM7dJLsBYL1RPZ1~HsboFAqq-SThQGI-GOd3wGu3rZHdFuV8SZWt3wJyiqkTrnMiNI_&Key-Pair-Id=APKAIWNGPWT6YVKFBWJA\";\n urlExpires = \"2013-05-01 09:00:00 +0000\";\n}";
};
fileId = 59335;
fileToken = "aiEWu1GyP_ILLATSlIYrR3fgSPd9bZ2pmVFQVt97V9GRb3q83rjagZe3J_ZHqmqUmpJEEMA7PlHLBZ7yAYCv-D-xduwP1O-CRz1C8okY2STHHCFmb-3kw_agqixWpVDIRlTKrG-eBbn_7VelOZy82rbmciKNb9njx5JLuSXKnlO3kVAU4icwGwtVcuk6SElHI";
kind = image;
mimeType = "image/png";
name = "IMG_0247.png";
permanentURL = "https://files.app.net/1/59335/a1D20soyc9OKO6rc1jwsRo6bYQY4XpjiQ9z0aEji57dwZBwz9SQTwBqSaLxW0QBVvKTUlrOhVDcox1oVWkGWiC8nFAFYBdSfTT7UcZrGqgCkbIsYGj-eonPrWQPb0-I2azDexoDTlZtxd5b1teKO70qu3r8imJNI-pqIEaOsSAJk9wH4dyyFPWH7WvPHT7B9i";
public = 1;
sha1 = 573f76dc86fd206d9907ed1e86d57f80452e05c1;
size = 308681;
source = "<ADNSource: 0x1ddca8c0> {\n clientId = rpwL7gknJwv3xRDUuJryMR5675wfbfkA;\n link = \"http://DonaldBurr.com/apps/nosillacast/\";\n name = \"CrApp.net\";\n}";
totalSize = 388597;
type = "com.donaldburr.crapp-net.upload";
url = "https://d36tc8clsz1tk5.cloudfront.net/adn-uf-01/Uq/Ct/Xb/UqCtXb2VGGx5f4pmZLY7yCpgPRqhZ-qlSirqlMVSczc?response-cache-control=public%2C%20max-age%3D7200%2C%20s-maxage%3D172800&response-content-disposition=inline%3B%20filename%2A%3DUTF-8%27%27IMG_0247.png&Expires=1367398800&Signature=SDcIKbmmBSVxYvF3uUR156U3iS1dK1JrnKPW97eEqM~Z2PPCmZQSeePlpH6KGysWY5qhnImf~RDkq98qJ2rp5Xv3GqAtoWDRmKIOTw1V1MsPqkPr9A46doBIunEk27-7IH68jr4zaYc-w5CX7iBZCd80B310-nxMnqU2sG~w~Z4_&Key-Pair-Id=APKAIWNGPWT6YVKFBWJA";
urlExpires = "2013-05-01 09:00:00 +0000";
user = "<ADNUser: 0x1f33bba0> {\n annotations = \"<null>\";\n avatarImage = \"[ADNImage: (100 x 100) https://d2rfichhc2fb9n.cloudfront.net/image/5/whULnLL_Un-ldb-8izunjnsxNoZ7InMiOiJzMyIsImIiOiJhZG4tdXNlci1hc3NldHMiLCJrIjoiYXNzZXRzL3VzZXIvOWMvYjQvMDAvOWNiNDAwMDAwMDAwMDAwMC5qcGciLCJvIjoiIn0]\";\n bio = \"<ADNDescription: 0x1f13a140> {\\n entities = \\\"[ADNEntities:\\\\n mentions: (\\\\n)\\\\n hashtags: (\\\\n)\\\\n links: (\\\\n \\\\\\\"[ADNLink: otakunopodcast.com (18 @ 175) <http://otakunopodcast.com>]\\\\\\\"\\\\n)\\\\n]\\\";\\n html = \\\"<span itemscope=\\\\\\\"https://app.net/schemas/Post\\\\\\\">Software engineer, computer geek, anime fanatic, podcaster, blogger, and general Net addict. Host of Otaku no Podcast, a podcast covering all things anime, manga and Japan. <a href=\\\\\\\"http://otakunopodcast.com\\\\\\\">otakunopodcast.com</a></span>\\\";\\n text = \\\"Software engineer, computer geek, anime fanatic, podcaster, blogger, and general Net addict. Host of Otaku no Podcast, a podcast covering all things anime, manga and Japan. otakunopodcast.com\\\";\\n}\";\n canonicalURL = \"https://alpha.app.net/dburr\";\n coverImage = \"[ADNImage: (1024 x 680) https://d2rfichhc2fb9n.cloudfront.net/image/5/HpRcVUpVgrMTabYAD-dkrLYCyUF7InMiOiJzMyIsImIiOiJhZG4tdXNlci1hc3NldHMiLCJrIjoiYXNzZXRzL3VzZXIvMzUvZTQvMDAvMzVlNDAwMDAwMDAwMDAwMC5qcGciLCJvIjoiIn0]\";\n createdAt = \"2012-08-20 21:51:09 +0000\";\n followerCount = 41;\n followingCount = 62;\n followsYou = 0;\n locale = \"en_US\";\n name = \"Donald Burr\";\n postCount = 442;\n starCount = 20;\n timezone = \"America/Los_Angeles\";\n type = human;\n userId = 8660;\n username = dburr;\n youCanSubscribe = 0;\n youFollow = 0;\n youMuted = 0;\n}";
}: Trying to assign an object of type __NSCFString to a property of type NSURL (ADNFile.permanentURL)
2013-05-01 00:28:49.368 CrApp.net[19104:907] file = (null), metadata = <ADNMetadata: 0x1f325e10> {
code = 200;
errorId = "<null>";
errorMessage = "<null>";
errorSlug = "<null>";
maxId = "<null>";
minId = "<null>";
more = 0;
}, error = (null)
But the file upload did in fact succeeds -- if I log in to my account using a file manager like Orbit, Filebase, etc. I can see the file I uploaded, and it is complete and intact.
The simplest way to make use of the client is through the singleton instance [ADNClient sharedClient]. To support multiple accounts, you can create multiple instances of ADNClient, each with their own access token.
This paragraph is kind of misleading, because it is not possible to have multiple instances of a singleton object, hence the name.
ADNClient+ADNUser.m
If this link has no anti-phishing protection (because the domain of the url matches the text), then this field will be omitted.
When the amended_len
field is not included in the link entity JSON, this ObjC property will be 0.
This should default to either some "not applicable" indicator value or to the same value as the length
property.
ADNClient+ADNFile.m
ADNClient+ADNFile.m
The AppDotNet API is kind of asymmetric regarding POSTing new instances and GETting them back, as ADN is enriching the objects with metadata.
When creating posts, only five fields are needed: text
, reply_to
, machine_only
, annotations
and entities
. However when a post is created this JSONDictionary which is converted to JSON later is send to the server:
{
"is_deleted" = 0;
"machine_only" = 0;
"num_replies" = 0;
"num_reposts" = 0;
"num_stars" = 0;
text = "Hello World";
"you_reposted" = 0;
"you_starred" = 0;
}
Which are too many fields. This can lead to problems.
Support NSImage
in addition to UIImage
to make the image-retrieving methods work on the mac, too.
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.