Skip to content

Commit

Permalink
Remove fast enumeration code to make the library buildable on OS X 10.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukhnos committed Oct 10, 2011
1 parent 250f893 commit ea7fd90
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions Source/ObjectiveFlickr.m
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,9 @@ - (NSDictionary *)signedOAuthHTTPQueryArguments:(NSDictionary *)inArguments base
[baseString appendString:@"&"];

NSMutableArray *baseStrArgs = [NSMutableArray array];

for (NSString *k in sortedArgKeys) {
NSEnumerator *kenum = [sortedArgKeys objectEnumerator];
NSString *k;
while ((k = [kenum nextObject]) != nil) {
[baseStrArgs addObject:[NSString stringWithFormat:@"%@=%@", k, OFEscapedURLStringFromNSStringWithExtraEscapedChars([newArgs objectForKey:k], kEscapeChars)]];
}

Expand All @@ -357,8 +358,10 @@ - (NSURL *)oauthURLFromBaseURL:(NSURL *)inURL method:(NSString *)inMethod argume
{
NSDictionary *newArgs = [self signedOAuthHTTPQueryArguments:inArguments baseURL:inURL method:inMethod];
NSMutableArray *queryArray = [NSMutableArray array];

for (NSString *k in [newArgs allKeys]) {

NSEnumerator *kenum = [newArgs keyEnumerator];
NSString *k;
while ((k = [kenum nextObject]) != nil) {
[queryArray addObject:[NSString stringWithFormat:@"%@=%@", k, OFEscapedURLStringFromNSStringWithExtraEscapedChars([newArgs objectForKey:k], kEscapeChars)]];
}

Expand Down Expand Up @@ -551,12 +554,29 @@ - (BOOL)uploadImageStream:(NSInputStream *)inImageStream suggestedFilename:(NSSt
return NO;
}

if (![[context authToken] length]) {
// get the api_sig
NSArray *argComponents = nil;

if ([context OAuthToken] && [context OAuthTokenSecret]) {
NSMutableArray *newArgsComps = [NSMutableArray array];
NSDictionary *signedArgs = [context signedOAuthHTTPQueryArguments:(inArguments ? inArguments : [NSDictionary dictionary]) baseURL:[NSURL URLWithString:[context uploadEndpoint]] method:LFHTTPRequestPOSTMethod];

NSEnumerator *keyEnum = [signedArgs keyEnumerator];
NSString *key;
while ((key = [keyEnum nextObject]) != nil) {
NSString *value = [signedArgs valueForKey:key];
[newArgsComps addObject:[NSArray arrayWithObjects:key, value, nil]];
}

argComponents = newArgsComps;
}
else if ([[context authToken] length] > 0) {
argComponents = [[self context] signedArgumentComponentsFromArguments:(inArguments ? inArguments : [NSDictionary dictionary]) useURIEscape:NO];
}
else {
return NO;
}

// get the api_sig
NSArray *argComponents = [[self context] signedArgumentComponentsFromArguments:(inArguments ? inArguments : [NSDictionary dictionary]) useURIEscape:NO];

NSString *separator = OFGenerateUUIDString();
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", separator];

Expand Down

0 comments on commit ea7fd90

Please sign in to comment.