added pods to ignore

This commit is contained in:
Patrick Santana 2014-04-29 15:56:09 -03:00
parent 88d57eee64
commit c2575007e5
113 changed files with 9363 additions and 17226 deletions

6
.gitignore vendored
View file

@ -17,6 +17,10 @@ profile
DerivedData DerivedData
.idea/ .idea/
// private class # private class
Photo/PrivateAuthenticationService.m Photo/PrivateAuthenticationService.m
Photo/PrivateConstants.m Photo/PrivateConstants.m
# cocoa Pods
Pods

27
.gitmodules vendored
View file

@ -1,27 +0,0 @@
[submodule "Frameworks/iRate"]
path = Frameworks/iRate
url = git://github.com/nicklockwood/iRate.git
[submodule "Frameworks/SDWebImage"]
path = Frameworks/SDWebImage
url = git://github.com/rs/SDWebImage.git
[submodule "Frameworks/ASIHTTPRequest"]
path = Frameworks/ASIHTTPRequest
url = git://github.com/pokeb/asi-http-request
[submodule "Frameworks/MBProgressHUD"]
path = Frameworks/MBProgressHUD
url = git://github.com/jdg/MBProgressHUD.git
[submodule "Frameworks/TSAlertView"]
path = Frameworks/TSAlertView
url = git://github.com/TomSwift/TSAlertView.git
[submodule "Frameworks/json-framework"]
path = Frameworks/json-framework
url = git://github.com/stig/json-framework.git
[submodule "Frameworks/ShareKit"]
path = Frameworks/ShareKit
url = git://github.com/ShareKit/ShareKit.git
[submodule "Frameworks/TMQuiltView"]
path = Frameworks/TMQuiltView
url = git://github.com/1000Memories/TMQuiltView.git
[submodule "Frameworks/DLCImagePickerController"]
path = Frameworks/DLCImagePickerController
url = git@github.com:nicnocquee/DLCImagePickerController.git

View file

@ -1,8 +1,5 @@
platform :ios, '7.0' platform :ios, '7.1'
#TSAlertView
#pod 'DLCImagePickerController', '~> 0.0.1'
pod 'SBJson', '~> 3.2' pod 'SBJson', '~> 3.2'
pod 'GoogleAnalytics-iOS-SDK', '~> 3.0.3' pod 'GoogleAnalytics-iOS-SDK', '~> 3.0.3'
pod 'SDWebImage','~> 3.5.2' pod 'SDWebImage','~> 3.5.2'
@ -13,4 +10,7 @@ pod 'ASIHTTPRequest', '~> 1.8.1'
pod 'iRate', '~> 1.9.2' pod 'iRate', '~> 1.9.2'
pod 'ViewDeck', '~> 2.3.1' pod 'ViewDeck', '~> 2.3.1'
pod 'TMQuiltView', '~> 0.0.1' pod 'TMQuiltView', '~> 0.0.1'
#pod 'DLCImagePickerController', '~> 0.0.1'
#pod 'ShareKit', '~> 2.5.3' #pod 'ShareKit', '~> 2.5.3'

View file

@ -1,24 +1,26 @@
PODS: PODS:
- ASIHTTPRequest (1.8.1): - ASIHTTPRequest (1.8.2):
- ASIHTTPRequest/ASIWebPageRequest - ASIHTTPRequest/ASIWebPageRequest
- ASIHTTPRequest/CloudFiles - ASIHTTPRequest/CloudFiles
- ASIHTTPRequest/Core
- ASIHTTPRequest/S3 - ASIHTTPRequest/S3
- ASIHTTPRequest/ASIWebPageRequest (1.8.2):
- ASIHTTPRequest/Core
- ASIHTTPRequest/CloudFiles (1.8.2):
- ASIHTTPRequest/Core
- ASIHTTPRequest/Core (1.8.2):
- Reachability - Reachability
- ASIHTTPRequest/ASIWebPageRequest (1.8.1): - ASIHTTPRequest/S3 (1.8.2):
- Reachability - ASIHTTPRequest/Core
- ASIHTTPRequest/CloudFiles (1.8.1): - GoogleAnalytics-iOS-SDK (3.0.6)
- Reachability - InAppSettingsKit (2.0.1)
- ASIHTTPRequest/S3 (1.8.1): - iRate (1.9.3)
- Reachability
- GoogleAnalytics-iOS-SDK (3.0.3)
- InAppSettingsKit (2.0)
- iRate (1.9.2)
- MBProgressHUD (0.8) - MBProgressHUD (0.8)
- Reachability (3.1.1) - Reachability (3.1.1)
- SBJson (3.2) - SBJson (3.2)
- SDWebImage (3.5.2): - SDWebImage (3.5.4):
- SDWebImage/Core - SDWebImage/Core
- SDWebImage/Core (3.5.2) - SDWebImage/Core (3.5.4)
- TMQuiltView (0.0.1) - TMQuiltView (0.0.1)
- ViewDeck (2.3.1) - ViewDeck (2.3.1)
@ -35,14 +37,14 @@ DEPENDENCIES:
- ViewDeck (~> 2.3.1) - ViewDeck (~> 2.3.1)
SPEC CHECKSUMS: SPEC CHECKSUMS:
ASIHTTPRequest: 162783e0cd71bdd3ff1ceed0cd5fa9505e0116a8 ASIHTTPRequest: 4bd3ed65bf8a726292c5fa79ea5c0a2e02c97241
GoogleAnalytics-iOS-SDK: 7b0e55cfe5e70d60478a7b105f15ac71e8bc373e GoogleAnalytics-iOS-SDK: c135fb62b1e5aa003b7be97b656ccee212896cf7
InAppSettingsKit: 2b85ba925a81634860461c21274f54b130c84614 InAppSettingsKit: 5e42f626b9be9c33e3b04c0cc9523ca5eabe7ad3
iRate: 7c4bc22ab4a8752185d84bed7a98dc111c8212a5 iRate: 99aef520b335a1eb4a14a8d9ba5e8db4e1d95bbe
MBProgressHUD: 2bbc6f470111daf7f3eaa4eb12b8cbf01c4c0622 MBProgressHUD: 2bbc6f470111daf7f3eaa4eb12b8cbf01c4c0622
Reachability: be4883bb93f31e38266ae3365e5600a317aae735 Reachability: be4883bb93f31e38266ae3365e5600a317aae735
SBJson: abc2bf2baef456d5dae213f9826fe2b6fdf19861 SBJson: abc2bf2baef456d5dae213f9826fe2b6fdf19861
SDWebImage: fe7ce01ae4e0a884d168f59c9dd82d35baf8429e SDWebImage: 1a62010700adbba823b621fc217906739dbf6aa5
TMQuiltView: 520d09d6a98f1a6aa75ed92a91123ecc79bab62c TMQuiltView: 520d09d6a98f1a6aa75ed92a91123ecc79bab62c
ViewDeck: 2cdc67c4b41a10cafc7556b982f028409e33604d ViewDeck: 2cdc67c4b41a10cafc7556b982f028409e33604d

View file

@ -133,7 +133,7 @@ static const NSUInteger kDomainSection = 1;
{ {
[self showTitle]; [self showTitle];
UIInterfaceOrientation o = [[UIApplication sharedApplication] statusBarOrientation]; UIInterfaceOrientation o = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
CGFloat angle = 0; CGFloat angle = 0;
switch (o) { switch (o) {
case UIDeviceOrientationLandscapeLeft: angle = 90; break; case UIDeviceOrientationLandscapeLeft: angle = 90; break;
@ -216,7 +216,20 @@ static const NSUInteger kDomainSection = 1;
+ (void)dismiss + (void)dismiss
{ {
[[sharedDialog parentViewController] dismissModalViewControllerAnimated:YES]; UIViewController* dismisser = nil;
if ([sharedDialog respondsToSelector:@selector(presentingViewController)]){
dismisser = [sharedDialog presentingViewController];
}else{
dismisser = [sharedDialog parentViewController];
}
if([dismisser respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]){
[dismisser dismissViewControllerAnimated:YES completion:nil];
}else{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[dismisser dismissModalViewControllerAnimated:YES];
#pragma clang diagnostic pop
}
} }
- (void)viewDidDisappear:(BOOL)animated - (void)viewDidDisappear:(BOOL)animated
@ -233,7 +246,20 @@ static const NSUInteger kDomainSection = 1;
if (self == sharedDialog) { if (self == sharedDialog) {
[[self class] dismiss]; [[self class] dismiss];
} else { } else {
[[self parentViewController] dismissModalViewControllerAnimated:YES]; UIViewController* dismisser = nil;
if ([self respondsToSelector:@selector(presentingViewController)]){
dismisser = [self presentingViewController];
}else{
dismisser = [self parentViewController];
}
if([dismisser respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]){
[dismisser dismissViewControllerAnimated:YES completion:nil];
}else{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[dismisser dismissModalViewControllerAnimated:YES];
#pragma clang diagnostic pop
}
} }
} }
@ -309,7 +335,14 @@ static const NSUInteger kDomainSection = 1;
} }
#endif #endif
if([[self presentingController] respondsToSelector:@selector(presentViewController:animated:completion:)]){
[[self presentingController] presentViewController:self animated:YES completion:nil];
}else{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[[self presentingController] presentModalViewController:self animated:YES]; [[self presentingController] presentModalViewController:self animated:YES];
#pragma clang diagnostic pop
}
} }
#pragma mark button callbacks #pragma mark button callbacks

View file

@ -88,7 +88,7 @@
[outputData increaseLengthBy:halfLength]; [outputData increaseLengthBy:halfLength];
} }
zStream.next_out = [outputData mutableBytes] + zStream.total_out-bytesProcessedAlready; zStream.next_out = (Bytef*)[outputData mutableBytes] + zStream.total_out-bytesProcessedAlready;
zStream.avail_out = (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready)); zStream.avail_out = (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready));
status = deflate(&zStream, shouldFinish ? Z_FINISH : Z_NO_FLUSH); status = deflate(&zStream, shouldFinish ? Z_FINISH : Z_NO_FLUSH);
@ -161,7 +161,7 @@
readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE]; readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE];
// Make sure nothing went wrong // Make sure nothing went wrong
if ([inputStream streamStatus] == NSStreamEventErrorOccurred) { if ([inputStream streamStatus] == NSStreamStatusError) {
if (err) { if (err) {
*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to read from the source data file",sourcePath],NSLocalizedDescriptionKey,[inputStream streamError],NSUnderlyingErrorKey,nil]]; *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to read from the source data file",sourcePath],NSLocalizedDescriptionKey,[inputStream streamError],NSUnderlyingErrorKey,nil]];
} }
@ -184,12 +184,12 @@
} }
// Write the deflated data out to the destination file // Write the deflated data out to the destination file
[outputStream write:[outputData bytes] maxLength:[outputData length]]; [outputStream write:(const uint8_t *)[outputData bytes] maxLength:[outputData length]];
// Make sure nothing went wrong // Make sure nothing went wrong
if ([inputStream streamStatus] == NSStreamEventErrorOccurred) { if ([inputStream streamStatus] == NSStreamStatusError) {
if (err) { if (err) {
*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to write to the destination data file at &@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]]; *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to write to the destination data file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
} }
[compressor closeStream]; [compressor closeStream];
return NO; return NO;
@ -212,7 +212,7 @@
+ (NSError *)deflateErrorWithCode:(int)code + (NSError *)deflateErrorWithCode:(int)code
{ {
return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of data failed with code %hi",code],NSLocalizedDescriptionKey,nil]]; return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of data failed with code %d",code],NSLocalizedDescriptionKey,nil]];
} }
@synthesize streamReady; @synthesize streamReady;

View file

@ -85,7 +85,7 @@
[outputData increaseLengthBy:halfLength]; [outputData increaseLengthBy:halfLength];
} }
zStream.next_out = [outputData mutableBytes] + zStream.total_out-bytesProcessedAlready; zStream.next_out = (Bytef*)[outputData mutableBytes] + zStream.total_out-bytesProcessedAlready;
zStream.avail_out = (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready)); zStream.avail_out = (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready));
status = inflate(&zStream, Z_NO_FLUSH); status = inflate(&zStream, Z_NO_FLUSH);
@ -158,7 +158,7 @@
readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE]; readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE];
// Make sure nothing went wrong // Make sure nothing went wrong
if ([inputStream streamStatus] == NSStreamEventErrorOccurred) { if ([inputStream streamStatus] == NSStreamStatusError) {
if (err) { if (err) {
*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were unable to read from the source data file",sourcePath],NSLocalizedDescriptionKey,[inputStream streamError],NSUnderlyingErrorKey,nil]]; *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were unable to read from the source data file",sourcePath],NSLocalizedDescriptionKey,[inputStream streamError],NSUnderlyingErrorKey,nil]];
} }
@ -181,12 +181,12 @@
} }
// Write the inflated data out to the destination file // Write the inflated data out to the destination file
[outputStream write:[outputData bytes] maxLength:[outputData length]]; [outputStream write:(Bytef*)[outputData bytes] maxLength:[outputData length]];
// Make sure nothing went wrong // Make sure nothing went wrong
if ([inputStream streamStatus] == NSStreamEventErrorOccurred) { if ([inputStream streamStatus] == NSStreamStatusError) {
if (err) { if (err) {
*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were unable to write to the destination data file at &@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]]; *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were unable to write to the destination data file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
} }
[decompressor closeStream]; [decompressor closeStream];
return NO; return NO;
@ -211,7 +211,7 @@
+ (NSError *)inflateErrorWithCode:(int)code + (NSError *)inflateErrorWithCode:(int)code
{ {
return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of data failed with code %hi",code],NSLocalizedDescriptionKey,nil]]; return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of data failed with code %d",code],NSLocalizedDescriptionKey,nil]];
} }
@synthesize streamReady; @synthesize streamReady;

View file

@ -35,6 +35,10 @@
// A helper function that determines if the server has requested data should not be cached by looking at the request's response headers // A helper function that determines if the server has requested data should not be cached by looking at the request's response headers
+ (BOOL)serverAllowsResponseCachingForRequest:(ASIHTTPRequest *)request; + (BOOL)serverAllowsResponseCachingForRequest:(ASIHTTPRequest *)request;
// A list of file extensions that we know won't be readable by a webview when accessed locally
// If we're asking for a path to cache a particular url and it has one of these extensions, we change it to '.html'
+ (NSArray *)fileExtensionsToHandleAsHTML;
@property (assign, nonatomic) ASICachePolicy defaultCachePolicy; @property (assign, nonatomic) ASICachePolicy defaultCachePolicy;
@property (retain, nonatomic) NSString *storagePath; @property (retain, nonatomic) NSString *storagePath;
@property (retain) NSRecursiveLock *accessLock; @property (retain) NSRecursiveLock *accessLock;

View file

@ -14,6 +14,7 @@ static ASIDownloadCache *sharedCache = nil;
static NSString *sessionCacheFolder = @"SessionStore"; static NSString *sessionCacheFolder = @"SessionStore";
static NSString *permanentCacheFolder = @"PermanentStore"; static NSString *permanentCacheFolder = @"PermanentStore";
static NSArray *fileExtensionsToHandleAsHTML = nil;
@interface ASIDownloadCache () @interface ASIDownloadCache ()
+ (NSString *)keyForURL:(NSURL *)url; + (NSString *)keyForURL:(NSURL *)url;
@ -22,6 +23,15 @@ static NSString *permanentCacheFolder = @"PermanentStore";
@implementation ASIDownloadCache @implementation ASIDownloadCache
+ (void)initialize
{
if (self == [ASIDownloadCache class]) {
// Obviously this is not an exhaustive list, but hopefully these are the most commonly used and this will 'just work' for the widest range of people
// I imagine many web developers probably use url rewriting anyway
fileExtensionsToHandleAsHTML = [[NSArray alloc] initWithObjects:@"asp",@"aspx",@"jsp",@"php",@"rb",@"py",@"pl",@"cgi", nil];
}
}
- (id)init - (id)init
{ {
self = [super init]; self = [super init];
@ -33,10 +43,13 @@ static NSString *permanentCacheFolder = @"PermanentStore";
+ (id)sharedCache + (id)sharedCache
{ {
if (!sharedCache) {
@synchronized(self) {
if (!sharedCache) { if (!sharedCache) {
sharedCache = [[self alloc] init]; sharedCache = [[self alloc] init];
[sharedCache setStoragePath:[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"ASIHTTPRequestCache"]]; [sharedCache setStoragePath:[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"ASIHTTPRequestCache"]];
}
}
} }
return sharedCache; return sharedCache;
} }
@ -102,31 +115,7 @@ static NSString *permanentCacheFolder = @"PermanentStore";
- (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge - (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
{ {
NSMutableDictionary *responseHeaders = [NSMutableDictionary dictionaryWithDictionary:[request responseHeaders]]; return [ASIHTTPRequest expiryDateForRequest:request maxAge:maxAge];
// If we weren't given a custom max-age, lets look for one in the response headers
if (!maxAge) {
NSString *cacheControl = [[responseHeaders objectForKey:@"Cache-Control"] lowercaseString];
if (cacheControl) {
NSScanner *scanner = [NSScanner scannerWithString:cacheControl];
[scanner scanUpToString:@"max-age" intoString:NULL];
if ([scanner scanString:@"max-age" intoString:NULL]) {
[scanner scanString:@"=" intoString:NULL];
[scanner scanDouble:&maxAge];
}
}
}
// RFC 2612 says max-age must override any Expires header
if (maxAge) {
return [[NSDate date] addTimeInterval:maxAge];
} else {
NSString *expires = [responseHeaders objectForKey:@"Expires"];
if (expires) {
return [ASIHTTPRequest dateFromRFC1123String:expires];
}
}
return nil;
} }
- (void)storeResponseForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge - (void)storeResponseForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
@ -182,7 +171,12 @@ static NSString *permanentCacheFolder = @"PermanentStore";
[[request responseData] writeToFile:dataPath atomically:NO]; [[request responseData] writeToFile:dataPath atomically:NO];
} else if ([request downloadDestinationPath] && ![[request downloadDestinationPath] isEqualToString:dataPath]) { } else if ([request downloadDestinationPath] && ![[request downloadDestinationPath] isEqualToString:dataPath]) {
NSError *error = nil; NSError *error = nil;
[[[[NSFileManager alloc] init] autorelease] copyItemAtPath:[request downloadDestinationPath] toPath:dataPath error:&error]; NSFileManager* manager = [[NSFileManager alloc] init];
if ([manager fileExistsAtPath:dataPath]) {
[manager removeItemAtPath:dataPath error:&error];
}
[manager copyItemAtPath:[request downloadDestinationPath] toPath:dataPath error:&error];
[manager release];
} }
[[self accessLock] unlock]; [[self accessLock] unlock];
} }
@ -209,12 +203,21 @@ static NSString *permanentCacheFolder = @"PermanentStore";
{ {
// Grab the file extension, if there is one. We do this so we can save the cached response with the same file extension - this is important if you want to display locally cached data in a web view // Grab the file extension, if there is one. We do this so we can save the cached response with the same file extension - this is important if you want to display locally cached data in a web view
NSString *extension = [[url path] pathExtension]; NSString *extension = [[url path] pathExtension];
if (![extension length]) {
// If the url doesn't have an extension, we'll add one so a webview can read it when locally cached
// If the url has the extension of a common web scripting language, we'll change the extension on the cached path to html for the same reason
if (![extension length] || [[[self class] fileExtensionsToHandleAsHTML] containsObject:[extension lowercaseString]]) {
extension = @"html"; extension = @"html";
} }
return [self pathToFile:[[[self class] keyForURL:url] stringByAppendingPathExtension:extension]]; return [self pathToFile:[[[self class] keyForURL:url] stringByAppendingPathExtension:extension]];
} }
+ (NSArray *)fileExtensionsToHandleAsHTML
{
return fileExtensionsToHandleAsHTML;
}
- (NSString *)pathToCachedResponseHeadersForURL:(NSURL *)url - (NSString *)pathToCachedResponseHeadersForURL:(NSURL *)url
{ {
return [self pathToFile:[[[self class] keyForURL:url] stringByAppendingPathExtension:@"cachedheaders"]]; return [self pathToFile:[[[self class] keyForURL:url] stringByAppendingPathExtension:@"cachedheaders"]];
@ -259,7 +262,10 @@ static NSString *permanentCacheFolder = @"PermanentStore";
// Grab the file extension, if there is one. We do this so we can save the cached response with the same file extension - this is important if you want to display locally cached data in a web view // Grab the file extension, if there is one. We do this so we can save the cached response with the same file extension - this is important if you want to display locally cached data in a web view
NSString *extension = [[[request url] path] pathExtension]; NSString *extension = [[[request url] path] pathExtension];
if (![extension length]) {
// If the url doesn't have an extension, we'll add one so a webview can read it when locally cached
// If the url has the extension of a common web scripting language, we'll change the extension on the cached path to html for the same reason
if (![extension length] || [[[self class] fileExtensionsToHandleAsHTML] containsObject:[extension lowercaseString]]) {
extension = @"html"; extension = @"html";
} }
path = [path stringByAppendingPathComponent:[[[self class] keyForURL:[request url]] stringByAppendingPathExtension:extension]]; path = [path stringByAppendingPathComponent:[[[self class] keyForURL:[request url]] stringByAppendingPathExtension:extension]];
@ -435,15 +441,19 @@ static NSString *permanentCacheFolder = @"PermanentStore";
return YES; return YES;
} }
// Borrowed from: http://stackoverflow.com/questions/652300/using-md5-hash-on-a-string-in-cocoa
+ (NSString *)keyForURL:(NSURL *)url + (NSString *)keyForURL:(NSURL *)url
{ {
NSString *urlString = [url absoluteString]; NSString *urlString = [url absoluteString];
if ([urlString length] == 0) {
return nil;
}
// Strip trailing slashes so http://allseeing-i.com/ASIHTTPRequest/ is cached the same as http://allseeing-i.com/ASIHTTPRequest // Strip trailing slashes so http://allseeing-i.com/ASIHTTPRequest/ is cached the same as http://allseeing-i.com/ASIHTTPRequest
if ([[urlString substringFromIndex:[urlString length]-1] isEqualToString:@"/"]) { if ([[urlString substringFromIndex:[urlString length]-1] isEqualToString:@"/"]) {
urlString = [urlString substringToIndex:[urlString length]-1]; urlString = [urlString substringToIndex:[urlString length]-1];
} }
// Borrowed from: http://stackoverflow.com/questions/652300/using-md5-hash-on-a-string-in-cocoa
const char *cStr = [urlString UTF8String]; const char *cStr = [urlString UTF8String];
unsigned char result[16]; unsigned char result[16];
CC_MD5(cStr, (CC_LONG)strlen(cStr), result); CC_MD5(cStr, (CC_LONG)strlen(cStr), result);

View file

@ -50,13 +50,13 @@ typedef enum _ASIPostFormat {
- (void)addFile:(NSString *)filePath forKey:(NSString *)key; - (void)addFile:(NSString *)filePath forKey:(NSString *)key;
// Same as above, but you can specify the content-type and file name // Same as above, but you can specify the content-type and file name
- (void)addFile:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key; - (void)addFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
// Add the contents of a local file to the request, clearing any others with the same key // Add the contents of a local file to the request, clearing any others with the same key
- (void)setFile:(NSString *)filePath forKey:(NSString *)key; - (void)setFile:(NSString *)filePath forKey:(NSString *)key;
// Same as above, but you can specify the content-type and file name // Same as above, but you can specify the content-type and file name
- (void)setFile:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key; - (void)setFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
// Add the contents of an NSData object to the request // Add the contents of an NSData object to the request
- (void)addData:(NSData *)data forKey:(NSString *)key; - (void)addData:(NSData *)data forKey:(NSString *)key;

View file

@ -30,7 +30,7 @@
#pragma mark utilities #pragma mark utilities
- (NSString*)encodeURL:(NSString *)string - (NSString*)encodeURL:(NSString *)string
{ {
NSString *newString = NSMakeCollectable([(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding([self stringEncoding])) autorelease]); NSString *newString = [NSMakeCollectable(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding([self stringEncoding]))) autorelease];
if (newString) { if (newString) {
return newString; return newString;
} }
@ -49,6 +49,7 @@
self = [super initWithURL:newURL]; self = [super initWithURL:newURL];
[self setPostFormat:ASIURLEncodedPostFormat]; [self setPostFormat:ASIURLEncodedPostFormat];
[self setStringEncoding:NSUTF8StringEncoding]; [self setStringEncoding:NSUTF8StringEncoding];
[self setRequestMethod:@"POST"];
return self; return self;
} }
@ -67,10 +68,16 @@
- (void)addPostValue:(id <NSObject>)value forKey:(NSString *)key - (void)addPostValue:(id <NSObject>)value forKey:(NSString *)key
{ {
if (!key) {
return;
}
if (![self postData]) { if (![self postData]) {
[self setPostData:[NSMutableArray array]]; [self setPostData:[NSMutableArray array]];
} }
[[self postData] addObject:[NSDictionary dictionaryWithObjectsAndKeys:[value description],@"value",key,@"key",nil]]; NSMutableDictionary *keyValuePair = [NSMutableDictionary dictionaryWithCapacity:2];
[keyValuePair setValue:key forKey:@"key"];
[keyValuePair setValue:[value description] forKey:@"value"];
[[self postData] addObject:keyValuePair];
} }
- (void)setPostValue:(id <NSObject>)value forKey:(NSString *)key - (void)setPostValue:(id <NSObject>)value forKey:(NSString *)key
@ -93,36 +100,26 @@
[self addFile:filePath withFileName:nil andContentType:nil forKey:key]; [self addFile:filePath withFileName:nil andContentType:nil forKey:key];
} }
- (void)addFile:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key - (void)addFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key
{ {
if (![self fileData]) {
[self setFileData:[NSMutableArray array]];
}
// If data is a path to a local file
if ([data isKindOfClass:[NSString class]]) {
BOOL isDirectory = NO; BOOL isDirectory = NO;
BOOL fileExists = [[[[NSFileManager alloc] init] autorelease] fileExistsAtPath:(NSString *)data isDirectory:&isDirectory]; BOOL fileExists = [[[[NSFileManager alloc] init] autorelease] fileExistsAtPath:filePath isDirectory:&isDirectory];
if (!fileExists || isDirectory) { if (!fileExists || isDirectory) {
[self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileBuildingRequestType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"No file exists at %@",data],NSLocalizedDescriptionKey,nil]]]; [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileBuildingRequestType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"No file exists at %@",filePath],NSLocalizedDescriptionKey,nil]]];
} }
// If the caller didn't specify a custom file name, we'll use the file name of the file we were passed // If the caller didn't specify a custom file name, we'll use the file name of the file we were passed
if (!fileName) { if (!fileName) {
fileName = [(NSString *)data lastPathComponent]; fileName = [filePath lastPathComponent];
} }
// If we were given the path to a file, and the user didn't specify a mime type, we can detect it from the file extension // If we were given the path to a file, and the user didn't specify a mime type, we can detect it from the file extension
if (!contentType) { if (!contentType) {
contentType = [ASIHTTPRequest mimeTypeForFileAtPath:data]; contentType = [ASIHTTPRequest mimeTypeForFileAtPath:filePath];
} }
[self addData:filePath withFileName:fileName andContentType:contentType forKey:key];
} }
NSDictionary *fileInfo = [NSDictionary dictionaryWithObjectsAndKeys:data, @"data", contentType, @"contentType", fileName, @"fileName", key, @"key", nil];
[[self fileData] addObject:fileInfo];
}
- (void)setFile:(NSString *)filePath forKey:(NSString *)key - (void)setFile:(NSString *)filePath forKey:(NSString *)key
{ {
[self setFile:filePath withFileName:nil andContentType:nil forKey:key]; [self setFile:filePath withFileName:nil andContentType:nil forKey:key];
@ -156,7 +153,12 @@
contentType = @"application/octet-stream"; contentType = @"application/octet-stream";
} }
NSDictionary *fileInfo = [NSDictionary dictionaryWithObjectsAndKeys:data, @"data", contentType, @"contentType", fileName, @"fileName", key, @"key", nil]; NSMutableDictionary *fileInfo = [NSMutableDictionary dictionaryWithCapacity:4];
[fileInfo setValue:key forKey:@"key"];
[fileInfo setValue:fileName forKey:@"fileName"];
[fileInfo setValue:contentType forKey:@"contentType"];
[fileInfo setValue:data forKey:@"data"];
[[self fileData] addObject:fileInfo]; [[self fileData] addObject:fileInfo];
} }
@ -206,7 +208,7 @@
[super buildPostBody]; [super buildPostBody];
#if DEBUG_FORM_DATA_REQUEST #if DEBUG_FORM_DATA_REQUEST
NSLog(@"%@",[self debugBodyString]); ASI_DEBUG_LOG(@"%@",[self debugBodyString]);
[self setDebugBodyString:nil]; [self setDebugBodyString:nil];
#endif #endif
} }
@ -220,8 +222,11 @@
NSString *charset = (NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding([self stringEncoding])); NSString *charset = (NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding([self stringEncoding]));
// Set your own boundary string only if really obsessive. We don't bother to check if post data contains the boundary, since it's pretty unlikely that it does. // We don't bother to check if post data contains the boundary, since it's pretty unlikely that it does.
NSString *stringBoundary = @"0xKhTmLbOuNdArY"; CFUUIDRef uuid = CFUUIDCreate(nil);
NSString *uuidString = [(NSString*)CFUUIDCreateString(nil, uuid) autorelease];
CFRelease(uuid);
NSString *stringBoundary = [NSString stringWithFormat:@"0xKhTmLbOuNdArY-%@",uuidString];
[self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"multipart/form-data; charset=%@; boundary=%@", charset, stringBoundary]]; [self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"multipart/form-data; charset=%@; boundary=%@", charset, stringBoundary]];
@ -328,8 +333,10 @@
- (void)addToDebugBody:(NSString *)string - (void)addToDebugBody:(NSString *)string
{ {
if (string) {
[self setDebugBodyString:[[self debugBodyString] stringByAppendingString:string]]; [self setDebugBodyString:[[self debugBodyString] stringByAppendingString:string]];
} }
}
#endif #endif
#pragma mark NSCopying #pragma mark NSCopying

View file

@ -193,7 +193,7 @@ typedef void (^ASIDataBlock)(NSData *data);
NSString *password; NSString *password;
// User-Agent for this request // User-Agent for this request
NSString *userAgent; NSString *userAgentString;
// Domain used for NTLM authentication // Domain used for NTLM authentication
NSString *domain; NSString *domain;
@ -873,6 +873,11 @@ typedef void (^ASIDataBlock)(NSData *data);
// And also by ASIS3Request // And also by ASIS3Request
+ (NSString *)base64forData:(NSData *)theData; + (NSString *)base64forData:(NSData *)theData;
// Returns the expiration date for the request.
// Calculated from the Expires response header property, unless maxAge is non-zero or
// there exists a non-zero max-age property in the Cache-Control response header.
+ (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;
// Returns a date from a string in RFC1123 format // Returns a date from a string in RFC1123 format
+ (NSDate *)dateFromRFC1123String:(NSString *)string; + (NSDate *)dateFromRFC1123String:(NSString *)string;
@ -898,7 +903,7 @@ typedef void (^ASIDataBlock)(NSData *data);
@property (retain) NSString *username; @property (retain) NSString *username;
@property (retain) NSString *password; @property (retain) NSString *password;
@property (retain) NSString *userAgent; @property (retain) NSString *userAgentString;
@property (retain) NSString *domain; @property (retain) NSString *domain;
@property (retain) NSString *proxyUsername; @property (retain) NSString *proxyUsername;

View file

@ -24,7 +24,7 @@
#import "ASIDataCompressor.h" #import "ASIDataCompressor.h"
// Automatically set on build // Automatically set on build
NSString *ASIHTTPRequestVersion = @"v1.8-95 2011-05-28"; NSString *ASIHTTPRequestVersion = @"v1.8.1-61 2011-09-19";
static NSString *defaultUserAgent = nil; static NSString *defaultUserAgent = nil;
@ -105,7 +105,7 @@ static BOOL isBandwidthThrottled = NO;
// When YES, bandwidth will be automatically throttled when using WWAN (3G/Edge/GPRS) // When YES, bandwidth will be automatically throttled when using WWAN (3G/Edge/GPRS)
// Wifi will not be throttled // Wifi will not be throttled
static BOOL shouldThrottleBandwithForWWANOnly = NO; static BOOL shouldThrottleBandwidthForWWANOnly = NO;
#endif #endif
// Mediates access to the session cookies so requests // Mediates access to the session cookies so requests
@ -392,7 +392,7 @@ static NSOperationQueue *sharedQueue = nil;
[connectionInfo release]; [connectionInfo release];
[requestID release]; [requestID release];
[dataDecompressor release]; [dataDecompressor release];
[userAgent release]; [userAgentString release];
#if NS_BLOCKS_AVAILABLE #if NS_BLOCKS_AVAILABLE
[self releaseBlocksOnMainThread]; [self releaseBlocksOnMainThread];
@ -460,6 +460,11 @@ static NSOperationQueue *sharedQueue = nil;
[authenticationNeededBlock release]; [authenticationNeededBlock release];
authenticationNeededBlock = nil; authenticationNeededBlock = nil;
} }
if (requestRedirectedBlock) {
[blocks addObject:requestRedirectedBlock];
[requestRedirectedBlock release];
requestRedirectedBlock = nil;
}
[[self class] performSelectorOnMainThread:@selector(releaseBlocks:) withObject:blocks waitUntilDone:[NSThread isMainThread]]; [[self class] performSelectorOnMainThread:@selector(releaseBlocks:) withObject:blocks waitUntilDone:[NSThread isMainThread]];
} }
// Always called on main thread // Always called on main thread
@ -696,7 +701,7 @@ static NSOperationQueue *sharedQueue = nil;
- (void)cancelOnRequestThread - (void)cancelOnRequestThread
{ {
#if DEBUG_REQUEST_STATUS #if DEBUG_REQUEST_STATUS
NSLog(@"[STATUS] Request cancelled: %@",self); ASI_DEBUG_LOG(@"[STATUS] Request cancelled: %@",self);
#endif #endif
[[self cancelledLock] lock]; [[self cancelledLock] lock];
@ -786,7 +791,7 @@ static NSOperationQueue *sharedQueue = nil;
- (void)startSynchronous - (void)startSynchronous
{ {
#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
NSLog(@"[STATUS] Starting synchronous request %@",self); ASI_DEBUG_LOG(@"[STATUS] Starting synchronous request %@",self);
#endif #endif
[self setSynchronous:YES]; [self setSynchronous:YES];
[self setRunLoopMode:ASIHTTPRequestRunLoopMode]; [self setRunLoopMode:ASIHTTPRequestRunLoopMode];
@ -811,7 +816,7 @@ static NSOperationQueue *sharedQueue = nil;
- (void)startAsynchronous - (void)startAsynchronous
{ {
#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
NSLog(@"[STATUS] Starting asynchronous request %@",self); ASI_DEBUG_LOG(@"[STATUS] Starting asynchronous request %@",self);
#endif #endif
[sharedQueue addOperation:self]; [sharedQueue addOperation:self];
} }
@ -843,6 +848,7 @@ static NSOperationQueue *sharedQueue = nil;
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
if ([ASIHTTPRequest isMultitaskingSupported] && [self shouldContinueWhenAppEntersBackground]) { if ([ASIHTTPRequest isMultitaskingSupported] && [self shouldContinueWhenAppEntersBackground]) {
if (!backgroundTask || backgroundTask == UIBackgroundTaskInvalid) {
backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
// Synchronize the cleanup call on the main thread in case // Synchronize the cleanup call on the main thread in case
// the task actually finishes at around the same time. // the task actually finishes at around the same time.
@ -855,6 +861,7 @@ static NSOperationQueue *sharedQueue = nil;
} }
}); });
}]; }];
}
} }
#endif #endif
@ -962,7 +969,7 @@ static NSOperationQueue *sharedQueue = nil;
// Do we want to send credentials before we are asked for them? // Do we want to send credentials before we are asked for them?
if (![self shouldPresentCredentialsBeforeChallenge]) { if (![self shouldPresentCredentialsBeforeChallenge]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will not send credentials to the server until it asks for them",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ will not send credentials to the server until it asks for them",self);
#endif #endif
return; return;
} }
@ -977,7 +984,7 @@ static NSOperationQueue *sharedQueue = nil;
[self addBasicAuthenticationHeaderWithUsername:[self username] andPassword:[self password]]; [self addBasicAuthenticationHeaderWithUsername:[self username] andPassword:[self password]];
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ has a username and password set, and was manually configured to use BASIC. Will send credentials without waiting for an authentication challenge",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ has a username and password set, and was manually configured to use BASIC. Will send credentials without waiting for an authentication challenge",self);
#endif #endif
} else { } else {
@ -996,12 +1003,12 @@ static NSOperationQueue *sharedQueue = nil;
if (CFHTTPMessageApplyCredentialDictionary(request, (CFHTTPAuthenticationRef)[credentials objectForKey:@"Authentication"], (CFDictionaryRef)[credentials objectForKey:@"Credentials"], NULL)) { if (CFHTTPMessageApplyCredentialDictionary(request, (CFHTTPAuthenticationRef)[credentials objectForKey:@"Authentication"], (CFDictionaryRef)[credentials objectForKey:@"Credentials"], NULL)) {
[self setAuthenticationScheme:[credentials objectForKey:@"AuthenticationScheme"]]; [self setAuthenticationScheme:[credentials objectForKey:@"AuthenticationScheme"]];
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ found cached credentials (%@), will reuse without waiting for an authentication challenge",self,[credentials objectForKey:@"AuthenticationScheme"]); ASI_DEBUG_LOG(@"[AUTH] Request %@ found cached credentials (%@), will reuse without waiting for an authentication challenge",self,[credentials objectForKey:@"AuthenticationScheme"]);
#endif #endif
} else { } else {
[[self class] removeAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]]; [[self class] removeAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]];
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Failed to apply cached credentials to request %@. These will be removed from the session store, and this request will wait for an authentication challenge",self); ASI_DEBUG_LOG(@"[AUTH] Failed to apply cached credentials to request %@. These will be removed from the session store, and this request will wait for an authentication challenge",self);
#endif #endif
} }
@ -1011,7 +1018,7 @@ static NSOperationQueue *sharedQueue = nil;
NSDictionary *usernameAndPassword = [credentials objectForKey:@"Credentials"]; NSDictionary *usernameAndPassword = [credentials objectForKey:@"Credentials"];
[self addBasicAuthenticationHeaderWithUsername:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername] andPassword:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationPassword]]; [self addBasicAuthenticationHeaderWithUsername:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername] andPassword:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationPassword]];
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ found cached BASIC credentials from a previous request. Will send credentials without waiting for an authentication challenge",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ found cached BASIC credentials from a previous request. Will send credentials without waiting for an authentication challenge",self);
#endif #endif
} }
} }
@ -1081,12 +1088,12 @@ static NSOperationQueue *sharedQueue = nil;
// Build and set the user agent string if the request does not already have a custom user agent specified // Build and set the user agent string if the request does not already have a custom user agent specified
if (![[self requestHeaders] objectForKey:@"User-Agent"]) { if (![[self requestHeaders] objectForKey:@"User-Agent"]) {
NSString *userAgentString = [self userAgent]; NSString *tempUserAgentString = [self userAgentString];
if (!userAgentString) { if (!tempUserAgentString) {
userAgentString = [ASIHTTPRequest defaultUserAgentString]; tempUserAgentString = [ASIHTTPRequest defaultUserAgentString];
} }
if (userAgentString) { if (tempUserAgentString) {
[self addRequestHeader:@"User-Agent" value:userAgentString]; [self addRequestHeader:@"User-Agent" value:tempUserAgentString];
} }
} }
@ -1169,7 +1176,7 @@ static NSOperationQueue *sharedQueue = nil;
} else { } else {
[self setPostBodyReadStream:[ASIInputStream inputStreamWithFileAtPath:[self postBodyFilePath] request:self]]; [self setPostBodyReadStream:[ASIInputStream inputStreamWithFileAtPath:[self postBodyFilePath] request:self]];
} }
[self setReadStream:[(NSInputStream *)CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream]) autorelease]]; [self setReadStream:[NSMakeCollectable(CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream])) autorelease]];
} else { } else {
// If we have a request body, we'll stream it from memory using our custom stream, so that we can measure bandwidth use and it can be bandwidth-throttled if necessary // If we have a request body, we'll stream it from memory using our custom stream, so that we can measure bandwidth use and it can be bandwidth-throttled if necessary
@ -1179,10 +1186,10 @@ static NSOperationQueue *sharedQueue = nil;
} else if ([self postBody]) { } else if ([self postBody]) {
[self setPostBodyReadStream:[ASIInputStream inputStreamWithData:[self postBody] request:self]]; [self setPostBodyReadStream:[ASIInputStream inputStreamWithData:[self postBody] request:self]];
} }
[self setReadStream:[(NSInputStream *)CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream]) autorelease]]; [self setReadStream:[NSMakeCollectable(CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream])) autorelease]];
} else { } else {
[self setReadStream:[(NSInputStream *)CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request) autorelease]]; [self setReadStream:[NSMakeCollectable(CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request)) autorelease]];
} }
} }
@ -1200,15 +1207,26 @@ static NSOperationQueue *sharedQueue = nil;
if([[[[self url] scheme] lowercaseString] isEqualToString:@"https"]) { if([[[[self url] scheme] lowercaseString] isEqualToString:@"https"]) {
NSMutableDictionary *sslProperties = [NSMutableDictionary dictionaryWithCapacity:1];
// Tell CFNetwork not to validate SSL certificates // Tell CFNetwork not to validate SSL certificates
if (![self validatesSecureCertificate]) { if (![self validatesSecureCertificate]) {
[sslProperties setObject:(NSString *)kCFBooleanFalse forKey:(NSString *)kCFStreamSSLValidatesCertificateChain]; // see: http://iphonedevelopment.blogspot.com/2010/05/nsstream-tcp-and-ssl.html
NSDictionary *sslProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithBool:YES], kCFStreamSSLAllowsExpiredCertificates,
[NSNumber numberWithBool:YES], kCFStreamSSLAllowsAnyRoot,
[NSNumber numberWithBool:NO], kCFStreamSSLValidatesCertificateChain,
kCFNull,kCFStreamSSLPeerName,
nil];
CFReadStreamSetProperty((CFReadStreamRef)[self readStream],
kCFStreamPropertySSLSettings,
(CFTypeRef)sslProperties);
[sslProperties release];
} }
// Tell CFNetwork to use a client certificate // Tell CFNetwork to use a client certificate
if (clientCertificateIdentity) { if (clientCertificateIdentity) {
NSMutableDictionary *sslProperties = [NSMutableDictionary dictionaryWithCapacity:1];
NSMutableArray *certificates = [NSMutableArray arrayWithCapacity:[clientCertificates count]+1]; NSMutableArray *certificates = [NSMutableArray arrayWithCapacity:[clientCertificates count]+1];
@ -1219,12 +1237,14 @@ static NSOperationQueue *sharedQueue = nil;
for (id cert in clientCertificates) { for (id cert in clientCertificates) {
[certificates addObject:cert]; [certificates addObject:cert];
} }
[sslProperties setObject:certificates forKey:(NSString *)kCFStreamSSLCertificates]; [sslProperties setObject:certificates forKey:(NSString *)kCFStreamSSLCertificates];
}
CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertySSLSettings, sslProperties); CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertySSLSettings, sslProperties);
} }
}
// //
// Handle proxy settings // Handle proxy settings
// //
@ -1288,7 +1308,7 @@ static NSOperationQueue *sharedQueue = nil;
// Check if we should have expired this connection // Check if we should have expired this connection
} else if ([[[self connectionInfo] objectForKey:@"expires"] timeIntervalSinceNow] < 0) { } else if ([[[self connectionInfo] objectForKey:@"expires"] timeIntervalSinceNow] < 0) {
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"[CONNECTION] Not re-using connection #%i because it has expired",[[[self connectionInfo] objectForKey:@"id"] intValue]); ASI_DEBUG_LOG(@"[CONNECTION] Not re-using connection #%i because it has expired",[[[self connectionInfo] objectForKey:@"id"] intValue]);
#endif #endif
[persistentConnectionsPool removeObject:[self connectionInfo]]; [persistentConnectionsPool removeObject:[self connectionInfo]];
[self setConnectionInfo:nil]; [self setConnectionInfo:nil];
@ -1296,7 +1316,7 @@ static NSOperationQueue *sharedQueue = nil;
} else if ([[self connectionInfo] objectForKey:@"request"] != nil) { } else if ([[self connectionInfo] objectForKey:@"request"] != nil) {
//Some other request reused this connection already - we'll have to create a new one //Some other request reused this connection already - we'll have to create a new one
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"%@ - Not re-using connection #%i for request #%i because it is already used by request #%i",self,[[[self connectionInfo] objectForKey:@"id"] intValue],[[self requestID] intValue],[[[self connectionInfo] objectForKey:@"request"] intValue]); ASI_DEBUG_LOG(@"%@ - Not re-using connection #%i for request #%i because it is already used by request #%i",self,[[[self connectionInfo] objectForKey:@"id"] intValue],[[self requestID] intValue],[[[self connectionInfo] objectForKey:@"request"] intValue]);
#endif #endif
[self setConnectionInfo:nil]; [self setConnectionInfo:nil];
} }
@ -1340,7 +1360,7 @@ static NSOperationQueue *sharedQueue = nil;
CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue); CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue);
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"[CONNECTION] Request #%@ will use connection #%i",[self requestID],[[[self connectionInfo] objectForKey:@"id"] intValue]); ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ will use connection #%i",[self requestID],[[[self connectionInfo] objectForKey:@"id"] intValue]);
#endif #endif
@ -1351,7 +1371,7 @@ static NSOperationQueue *sharedQueue = nil;
} else { } else {
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"[CONNECTION] Request %@ will not use a persistent connection",self); ASI_DEBUG_LOG(@"[CONNECTION] Request %@ will not use a persistent connection",self);
#endif #endif
} }
@ -1519,7 +1539,7 @@ static NSOperationQueue *sharedQueue = nil;
[self setLastBytesSent:totalBytesSent]; [self setLastBytesSent:totalBytesSent];
// Find out how much data we've uploaded so far // Find out how much data we've uploaded so far
[self setTotalBytesSent:[NSMakeCollectable([(NSNumber *)CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount) autorelease]) unsignedLongLongValue]]; [self setTotalBytesSent:[[NSMakeCollectable(CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount)) autorelease] unsignedLongLongValue]];
if (totalBytesSent > lastBytesSent) { if (totalBytesSent > lastBytesSent) {
// We've uploaded more data, reset the timeout // We've uploaded more data, reset the timeout
@ -1528,7 +1548,7 @@ static NSOperationQueue *sharedQueue = nil;
#if DEBUG_REQUEST_STATUS #if DEBUG_REQUEST_STATUS
if ([self totalBytesSent] == [self postLength]) { if ([self totalBytesSent] == [self postLength]) {
NSLog(@"[STATUS] Request %@ finished uploading data",self); ASI_DEBUG_LOG(@"[STATUS] Request %@ finished uploading data",self);
} }
#endif #endif
} }
@ -1985,7 +2005,7 @@ static NSOperationQueue *sharedQueue = nil;
- (void)requestFinished - (void)requestFinished
{ {
#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
NSLog(@"[STATUS] Request finished: %@",self); ASI_DEBUG_LOG(@"[STATUS] Request finished: %@",self);
#endif #endif
if ([self error] || [self mainRequest]) { if ([self error] || [self mainRequest]) {
return; return;
@ -2052,7 +2072,7 @@ static NSOperationQueue *sharedQueue = nil;
- (void)failWithError:(NSError *)theError - (void)failWithError:(NSError *)theError
{ {
#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
NSLog(@"[STATUS] Request %@: %@",self,(theError == ASIRequestCancelledError ? @"Cancelled" : @"Failed")); ASI_DEBUG_LOG(@"[STATUS] Request %@: %@",self,(theError == ASIRequestCancelledError ? @"Cancelled" : @"Failed"));
#endif #endif
[self setComplete:YES]; [self setComplete:YES];
@ -2060,7 +2080,7 @@ static NSOperationQueue *sharedQueue = nil;
if (theError && [theError code] != ASIAuthenticationErrorType && [theError code] != ASITooMuchRedirectionErrorType) { if (theError && [theError code] != ASIAuthenticationErrorType && [theError code] != ASITooMuchRedirectionErrorType) {
[connectionsLock lock]; [connectionsLock lock];
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"[CONNECTION] Request #%@ failed and will invalidate connection #%@",[self requestID],[[self connectionInfo] objectForKey:@"id"]); ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ failed and will invalidate connection #%@",[self requestID],[[self connectionInfo] objectForKey:@"id"]);
#endif #endif
[[self connectionInfo] removeObjectForKey:@"request"]; [[self connectionInfo] removeObjectForKey:@"request"];
[persistentConnectionsPool removeObject:[self connectionInfo]]; [persistentConnectionsPool removeObject:[self connectionInfo]];
@ -2128,13 +2148,13 @@ static NSOperationQueue *sharedQueue = nil;
#if DEBUG_REQUEST_STATUS #if DEBUG_REQUEST_STATUS
if ([self totalBytesSent] == [self postLength]) { if ([self totalBytesSent] == [self postLength]) {
NSLog(@"[STATUS] Request %@ received response headers",self); ASI_DEBUG_LOG(@"[STATUS] Request %@ received response headers",self);
} }
#endif #endif
[self setResponseHeaders:[(NSDictionary *)CFHTTPMessageCopyAllHeaderFields(message) autorelease]]; [self setResponseHeaders:[NSMakeCollectable(CFHTTPMessageCopyAllHeaderFields(message)) autorelease]];
[self setResponseStatusCode:(int)CFHTTPMessageGetResponseStatusCode(message)]; [self setResponseStatusCode:(int)CFHTTPMessageGetResponseStatusCode(message)];
[self setResponseStatusMessage:[(NSString *)CFHTTPMessageCopyResponseStatusLine(message) autorelease]]; [self setResponseStatusMessage:[NSMakeCollectable(CFHTTPMessageCopyResponseStatusLine(message)) autorelease]];
if ([self downloadCache] && ([[self downloadCache] canUseCachedDataForRequest:self])) { if ([self downloadCache] && ([[self downloadCache] canUseCachedDataForRequest:self])) {
@ -2156,7 +2176,7 @@ static NSOperationQueue *sharedQueue = nil;
} else { } else {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
if ([self authenticationScheme]) { if ([self authenticationScheme]) {
NSLog(@"[AUTH] Request %@ has passed %@ authentication",self,[self authenticationScheme]); ASI_DEBUG_LOG(@"[AUTH] Request %@ has passed %@ authentication",self,[self authenticationScheme]);
} }
#endif #endif
} }
@ -2168,7 +2188,7 @@ static NSOperationQueue *sharedQueue = nil;
if (!requestAuthentication && [[self authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic] && [self username] && [self password] && [self useSessionPersistence]) { if (!requestAuthentication && [[self authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic] && [self username] && [self password] && [self useSessionPersistence]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ passed BASIC authentication, and will save credentials in the session store for future use",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ passed BASIC authentication, and will save credentials in the session store for future use",self);
#endif #endif
NSMutableDictionary *newCredentials = [NSMutableDictionary dictionaryWithCapacity:2]; NSMutableDictionary *newCredentials = [NSMutableDictionary dictionaryWithCapacity:2];
@ -2238,7 +2258,7 @@ static NSOperationQueue *sharedQueue = nil;
NSString *connectionHeader = [[[self responseHeaders] objectForKey:@"Connection"] lowercaseString]; NSString *connectionHeader = [[[self responseHeaders] objectForKey:@"Connection"] lowercaseString];
NSString *httpVersion = NSMakeCollectable([(NSString *)CFHTTPMessageCopyVersion(message) autorelease]); NSString *httpVersion = [NSMakeCollectable(CFHTTPMessageCopyVersion(message)) autorelease];
// Don't re-use the connection if the server is HTTP 1.0 and didn't send Connection: Keep-Alive // Don't re-use the connection if the server is HTTP 1.0 and didn't send Connection: Keep-Alive
if (![httpVersion isEqualToString:(NSString *)kCFHTTPVersion1_0] || [connectionHeader isEqualToString:@"keep-alive"]) { if (![httpVersion isEqualToString:(NSString *)kCFHTTPVersion1_0] || [connectionHeader isEqualToString:@"keep-alive"]) {
@ -2262,7 +2282,7 @@ static NSOperationQueue *sharedQueue = nil;
[self setConnectionCanBeReused:YES]; [self setConnectionCanBeReused:YES];
[self setPersistentConnectionTimeoutSeconds:timeout]; [self setPersistentConnectionTimeoutSeconds:timeout];
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"[CONNECTION] Got a keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]); ASI_DEBUG_LOG(@"[CONNECTION] Got a keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]);
#endif #endif
} }
@ -2270,7 +2290,7 @@ static NSOperationQueue *sharedQueue = nil;
} else { } else {
[self setConnectionCanBeReused:YES]; [self setConnectionCanBeReused:YES];
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"[CONNECTION] Got no keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]); ASI_DEBUG_LOG(@"[CONNECTION] Got no keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]);
#endif #endif
} }
} }
@ -2334,7 +2354,7 @@ static NSOperationQueue *sharedQueue = nil;
[self setRequestCookies:[NSMutableArray array]]; [self setRequestCookies:[NSMutableArray array]];
#if DEBUG_REQUEST_STATUS #if DEBUG_REQUEST_STATUS
NSLog(@"[STATUS] Request will redirect (code: %i): %@",responseCode,self); ASI_DEBUG_LOG(@"[STATUS] Request will redirect (code: %i): %@",responseCode,self);
#endif #endif
return YES; return YES;
@ -2523,7 +2543,7 @@ static NSOperationQueue *sharedQueue = nil;
if (user && pass) { if (user && pass) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will use credentials set on its url",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ will use credentials set on its url",self);
#endif #endif
} else { } else {
@ -2534,7 +2554,7 @@ static NSOperationQueue *sharedQueue = nil;
pass = [[self mainRequest] password]; pass = [[self mainRequest] password];
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will use credentials from its parent request",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ will use credentials from its parent request",self);
#endif #endif
// Let's try to use the ones set in this object // Let's try to use the ones set in this object
@ -2543,7 +2563,7 @@ static NSOperationQueue *sharedQueue = nil;
pass = [self password]; pass = [self password];
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will use username and password properties as credentials",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ will use username and password properties as credentials",self);
#endif #endif
} }
} }
@ -2556,7 +2576,7 @@ static NSOperationQueue *sharedQueue = nil;
pass = [authenticationCredentials password]; pass = [authenticationCredentials password];
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
if (user && pass) { if (user && pass) {
NSLog(@"[AUTH] Request %@ will use credentials from the keychain",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ will use credentials from the keychain",self);
} }
#endif #endif
} }
@ -2592,7 +2612,7 @@ static NSOperationQueue *sharedQueue = nil;
- (void)retryUsingSuppliedCredentials - (void)retryUsingSuppliedCredentials
{ {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ received credentials from its delegate or an ASIAuthenticationDialog, will retry",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ received credentials from its delegate or an ASIAuthenticationDialog, will retry",self);
#endif #endif
//If the url was changed by the delegate, our CFHTTPMessageRef will be NULL and we'll go back to the start //If the url was changed by the delegate, our CFHTTPMessageRef will be NULL and we'll go back to the start
if (!request) { if (!request) {
@ -2606,7 +2626,7 @@ static NSOperationQueue *sharedQueue = nil;
- (void)cancelAuthentication - (void)cancelAuthentication
{ {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ had authentication cancelled by its delegate or an ASIAuthenticationDialog",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ had authentication cancelled by its delegate or an ASIAuthenticationDialog",self);
#endif #endif
[self performSelector:@selector(failAuthentication) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO]; [self performSelector:@selector(failAuthentication) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];
} }
@ -2749,7 +2769,7 @@ static NSOperationQueue *sharedQueue = nil;
CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader); CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader);
proxyAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader); proxyAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader);
CFRelease(responseHeader); CFRelease(responseHeader);
[self setProxyAuthenticationScheme:[(NSString *)CFHTTPAuthenticationCopyMethod(proxyAuthentication) autorelease]]; [self setProxyAuthenticationScheme:[NSMakeCollectable(CFHTTPAuthenticationCopyMethod(proxyAuthentication)) autorelease]];
} }
// If we haven't got a CFHTTPAuthenticationRef by now, something is badly wrong, so we'll have to give up // If we haven't got a CFHTTPAuthenticationRef by now, something is badly wrong, so we'll have to give up
@ -2762,7 +2782,7 @@ static NSOperationQueue *sharedQueue = nil;
// Get the authentication realm // Get the authentication realm
[self setProxyAuthenticationRealm:nil]; [self setProxyAuthenticationRealm:nil];
if (!CFHTTPAuthenticationRequiresAccountDomain(proxyAuthentication)) { if (!CFHTTPAuthenticationRequiresAccountDomain(proxyAuthentication)) {
[self setProxyAuthenticationRealm:[(NSString *)CFHTTPAuthenticationCopyRealm(proxyAuthentication) autorelease]]; [self setProxyAuthenticationRealm:[NSMakeCollectable(CFHTTPAuthenticationCopyRealm(proxyAuthentication)) autorelease]];
} }
// See if authentication is valid // See if authentication is valid
@ -2926,12 +2946,12 @@ static NSOperationQueue *sharedQueue = nil;
CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader); CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader);
requestAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader); requestAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader);
CFRelease(responseHeader); CFRelease(responseHeader);
[self setAuthenticationScheme:[(NSString *)CFHTTPAuthenticationCopyMethod(requestAuthentication) autorelease]]; [self setAuthenticationScheme:[NSMakeCollectable(CFHTTPAuthenticationCopyMethod(requestAuthentication)) autorelease]];
} }
if (!requestAuthentication) { if (!requestAuthentication) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ failed to read authentication information from response headers",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ failed to read authentication information from response headers",self);
#endif #endif
[self cancelLoad]; [self cancelLoad];
@ -2942,7 +2962,7 @@ static NSOperationQueue *sharedQueue = nil;
// Get the authentication realm // Get the authentication realm
[self setAuthenticationRealm:nil]; [self setAuthenticationRealm:nil];
if (!CFHTTPAuthenticationRequiresAccountDomain(requestAuthentication)) { if (!CFHTTPAuthenticationRequiresAccountDomain(requestAuthentication)) {
[self setAuthenticationRealm:[(NSString *)CFHTTPAuthenticationCopyRealm(requestAuthentication) autorelease]]; [self setAuthenticationRealm:[NSMakeCollectable(CFHTTPAuthenticationCopyRealm(requestAuthentication)) autorelease]];
} }
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
@ -2953,9 +2973,9 @@ static NSOperationQueue *sharedQueue = nil;
realm = @""; realm = @"";
} }
if ([self authenticationScheme] != (NSString *)kCFHTTPAuthenticationSchemeNTLM || [self authenticationRetryCount] == 0) { if ([self authenticationScheme] != (NSString *)kCFHTTPAuthenticationSchemeNTLM || [self authenticationRetryCount] == 0) {
NSLog(@"[AUTH] Request %@ received 401 challenge and must authenticate using %@%@",self,[self authenticationScheme],realm); ASI_DEBUG_LOG(@"[AUTH] Request %@ received 401 challenge and must authenticate using %@%@",self,[self authenticationScheme],realm);
} else { } else {
NSLog(@"[AUTH] Request %@ NTLM handshake step %i",self,[self authenticationRetryCount]+1); ASI_DEBUG_LOG(@"[AUTH] Request %@ NTLM handshake step %i",self,[self authenticationRetryCount]+1);
} }
#endif #endif
@ -2970,7 +2990,7 @@ static NSOperationQueue *sharedQueue = nil;
if (err.domain == kCFStreamErrorDomainHTTP && (err.error == kCFStreamErrorHTTPAuthenticationBadUserName || err.error == kCFStreamErrorHTTPAuthenticationBadPassword)) { if (err.domain == kCFStreamErrorDomainHTTP && (err.error == kCFStreamErrorHTTPAuthenticationBadUserName || err.error == kCFStreamErrorHTTPAuthenticationBadPassword)) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ had bad credentials, will remove them from the session store if they are cached",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ had bad credentials, will remove them from the session store if they are cached",self);
#endif #endif
// Prevent more than one request from asking for credentials at once // Prevent more than one request from asking for credentials at once
@ -2984,7 +3004,7 @@ static NSOperationQueue *sharedQueue = nil;
if ([self error] || [self isCancelled]) { if ([self error] || [self isCancelled]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
@ -2997,7 +3017,7 @@ static NSOperationQueue *sharedQueue = nil;
if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) { if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]); ASI_DEBUG_LOG(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
@ -3011,7 +3031,7 @@ static NSOperationQueue *sharedQueue = nil;
if ([self willAskDelegateForCredentials]) { if ([self willAskDelegateForCredentials]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will ask its delegate for credentials to use",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask its delegate for credentials to use",self);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
@ -3020,7 +3040,7 @@ static NSOperationQueue *sharedQueue = nil;
if ([self showAuthenticationDialog]) { if ([self showAuthenticationDialog]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
@ -3030,7 +3050,7 @@ static NSOperationQueue *sharedQueue = nil;
} }
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ has no credentials to present and must give up",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ has no credentials to present and must give up",self);
#endif #endif
[self cancelLoad]; [self cancelLoad];
@ -3048,7 +3068,7 @@ static NSOperationQueue *sharedQueue = nil;
// We've failed NTLM authentication twice, we should assume our credentials are wrong // We've failed NTLM authentication twice, we should assume our credentials are wrong
} else if ([self authenticationScheme] == (NSString *)kCFHTTPAuthenticationSchemeNTLM && [self authenticationRetryCount ] == 2) { } else if ([self authenticationScheme] == (NSString *)kCFHTTPAuthenticationSchemeNTLM && [self authenticationRetryCount ] == 2) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ has failed NTLM authentication",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ has failed NTLM authentication",self);
#endif #endif
[self failWithError:ASIAuthenticationError]; [self failWithError:ASIAuthenticationError];
@ -3056,7 +3076,7 @@ static NSOperationQueue *sharedQueue = nil;
} else { } else {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ had credentials and they were not marked as bad, but we got a 401 all the same.",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ had credentials and they were not marked as bad, but we got a 401 all the same.",self);
#endif #endif
[self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]]; [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]];
@ -3072,7 +3092,7 @@ static NSOperationQueue *sharedQueue = nil;
if ([self error] || [self isCancelled]) { if ([self error] || [self isCancelled]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
@ -3085,7 +3105,7 @@ static NSOperationQueue *sharedQueue = nil;
if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) { if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]); ASI_DEBUG_LOG(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
@ -3105,7 +3125,7 @@ static NSOperationQueue *sharedQueue = nil;
[self startRequest]; [self startRequest];
} else { } else {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ failed to apply credentials",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ failed to apply credentials",self);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
[self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]]; [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]];
@ -3115,7 +3135,7 @@ static NSOperationQueue *sharedQueue = nil;
if ([self willAskDelegateForCredentials]) { if ([self willAskDelegateForCredentials]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will ask its delegate for credentials to use",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask its delegate for credentials to use",self);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
@ -3124,7 +3144,7 @@ static NSOperationQueue *sharedQueue = nil;
if ([self showAuthenticationDialog]) { if ([self showAuthenticationDialog]) {
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
@ -3132,7 +3152,7 @@ static NSOperationQueue *sharedQueue = nil;
} }
#if DEBUG_HTTP_AUTHENTICATION #if DEBUG_HTTP_AUTHENTICATION
NSLog(@"[AUTH] Request %@ has no credentials to present and must give up",self); ASI_DEBUG_LOG(@"[AUTH] Request %@ has no credentials to present and must give up",self);
#endif #endif
[delegateAuthenticationLock unlock]; [delegateAuthenticationLock unlock];
[self failWithError:ASIAuthenticationError]; [self failWithError:ASIAuthenticationError];
@ -3159,7 +3179,7 @@ static NSOperationQueue *sharedQueue = nil;
if ([self complete] || [self isCancelled]) { if ([self complete] || [self isCancelled]) {
[[self cancelledLock] unlock]; [[self cancelledLock] unlock];
[pool release]; [pool drain];
return; return;
} }
@ -3196,7 +3216,7 @@ static NSOperationQueue *sharedQueue = nil;
} }
CFRelease(self); CFRelease(self);
[pool release]; [pool drain];
} }
- (BOOL)willAskDelegateToConfirmRedirect - (BOOL)willAskDelegateToConfirmRedirect
@ -3373,7 +3393,7 @@ static NSOperationQueue *sharedQueue = nil;
{ {
#if DEBUG_REQUEST_STATUS #if DEBUG_REQUEST_STATUS
NSLog(@"[STATUS] Request %@ finished downloading data (%qu bytes)",self, [self totalBytesRead]); ASI_DEBUG_LOG(@"[STATUS] Request %@ finished downloading data (%qu bytes)",self, [self totalBytesRead]);
#endif #endif
[self setStatusTimer:nil]; [self setStatusTimer:nil];
[self setDownloadComplete:YES]; [self setDownloadComplete:YES];
@ -3385,7 +3405,7 @@ static NSOperationQueue *sharedQueue = nil;
[progressLock lock]; [progressLock lock];
// Find out how much data we've uploaded so far // Find out how much data we've uploaded so far
[self setLastBytesSent:totalBytesSent]; [self setLastBytesSent:totalBytesSent];
[self setTotalBytesSent:[NSMakeCollectable([(NSNumber *)CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount) autorelease]) unsignedLongLongValue]]; [self setTotalBytesSent:[[NSMakeCollectable(CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount)) autorelease] unsignedLongLongValue]];
[self setComplete:YES]; [self setComplete:YES];
if (![self contentLength]) { if (![self contentLength]) {
[self setContentLength:[self totalBytesRead]]; [self setContentLength:[self totalBytesRead]];
@ -3471,7 +3491,7 @@ static NSOperationQueue *sharedQueue = nil;
} }
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
if ([self requestID]) { if ([self requestID]) {
NSLog(@"[CONNECTION] Request #%@ finished using connection #%@",[self requestID], [[self connectionInfo] objectForKey:@"id"]); ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ finished using connection #%@",[self requestID], [[self connectionInfo] objectForKey:@"id"]);
} }
#endif #endif
[[self connectionInfo] removeObjectForKey:@"request"]; [[self connectionInfo] removeObjectForKey:@"request"];
@ -3495,7 +3515,7 @@ static NSOperationQueue *sharedQueue = nil;
// If request has asked delegate or ASIAuthenticationDialog for credentials // If request has asked delegate or ASIAuthenticationDialog for credentials
} else if ([self authenticationNeeded]) { } else if ([self authenticationNeeded]) {
CFRunLoopStop(CFRunLoopGetCurrent()); // Do nothing.
} }
} }
@ -3507,13 +3527,16 @@ static NSOperationQueue *sharedQueue = nil;
// dealloc won't be called when running with GC, so we'll clean these up now // dealloc won't be called when running with GC, so we'll clean these up now
if (request) { if (request) {
CFMakeCollectable(request); CFRelease(request);
request = nil;
} }
if (requestAuthentication) { if (requestAuthentication) {
CFMakeCollectable(requestAuthentication); CFRelease(requestAuthentication);
requestAuthentication = nil;
} }
if (proxyAuthentication) { if (proxyAuthentication) {
CFMakeCollectable(proxyAuthentication); CFRelease(proxyAuthentication);
proxyAuthentication = nil;
} }
BOOL wasInProgress = inProgress; BOOL wasInProgress = inProgress;
@ -3532,8 +3555,6 @@ static NSOperationQueue *sharedQueue = nil;
if (!wasFinished) if (!wasFinished)
[self didChangeValueForKey:@"isFinished"]; [self didChangeValueForKey:@"isFinished"];
CFRunLoopStop(CFRunLoopGetCurrent());
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
if ([ASIHTTPRequest isMultitaskingSupported] && [self shouldContinueWhenAppEntersBackground]) { if ([ASIHTTPRequest isMultitaskingSupported] && [self shouldContinueWhenAppEntersBackground]) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
@ -3609,7 +3630,7 @@ static NSOperationQueue *sharedQueue = nil;
[self setWillRetryRequest:NO]; [self setWillRetryRequest:NO];
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - will retry with a new connection", [[self connectionInfo] objectForKey:@"id"]); ASI_DEBUG_LOG(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - will retry with a new connection", [[self connectionInfo] objectForKey:@"id"]);
#endif #endif
[connectionsLock lock]; [connectionsLock lock];
[[self connectionInfo] removeObjectForKey:@"request"]; [[self connectionInfo] removeObjectForKey:@"request"];
@ -3621,7 +3642,7 @@ static NSOperationQueue *sharedQueue = nil;
return YES; return YES;
} }
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - we have already retried with a new connection, so we must give up", [[self connectionInfo] objectForKey:@"id"]); ASI_DEBUG_LOG(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - we have already retried with a new connection, so we must give up", [[self connectionInfo] objectForKey:@"id"]);
#endif #endif
return NO; return NO;
} }
@ -3629,7 +3650,7 @@ static NSOperationQueue *sharedQueue = nil;
- (void)handleStreamError - (void)handleStreamError
{ {
NSError *underlyingError = NSMakeCollectable([(NSError *)CFReadStreamCopyError((CFReadStreamRef)[self readStream]) autorelease]); NSError *underlyingError = [NSMakeCollectable(CFReadStreamCopyError((CFReadStreamRef)[self readStream])) autorelease];
if (![self error]) { // We may already have handled this error if (![self error]) { // We may already have handled this error
@ -3807,12 +3828,12 @@ static NSOperationQueue *sharedQueue = nil;
} else { } else {
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
NSDictionary *proxySettings = NSMakeCollectable([(NSDictionary *)CFNetworkCopySystemProxySettings() autorelease]); NSDictionary *proxySettings = [NSMakeCollectable(CFNetworkCopySystemProxySettings()) autorelease];
#else #else
NSDictionary *proxySettings = NSMakeCollectable([(NSDictionary *)SCDynamicStoreCopyProxies(NULL) autorelease]); NSDictionary *proxySettings = [NSMakeCollectable(SCDynamicStoreCopyProxies(NULL)) autorelease];
#endif #endif
proxies = NSMakeCollectable([(NSArray *)CFNetworkCopyProxiesForURL((CFURLRef)[self url], (CFDictionaryRef)proxySettings) autorelease]); proxies = [NSMakeCollectable(CFNetworkCopyProxiesForURL((CFURLRef)[self url], (CFDictionaryRef)proxySettings)) autorelease];
// Now check to see if the proxy settings contained a PAC url, we need to run the script to get the real list of proxies if so // Now check to see if the proxy settings contained a PAC url, we need to run the script to get the real list of proxies if so
NSDictionary *settings = [proxies objectAtIndex:0]; NSDictionary *settings = [proxies objectAtIndex:0];
@ -3964,7 +3985,7 @@ static NSOperationQueue *sharedQueue = nil;
// Obtain the list of proxies by running the autoconfiguration script // Obtain the list of proxies by running the autoconfiguration script
CFErrorRef err = NULL; CFErrorRef err = NULL;
NSArray *proxies = NSMakeCollectable([(NSArray *)CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)[self url], &err) autorelease]); NSArray *proxies = [NSMakeCollectable(CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)[self url], &err)) autorelease];
if (!err && [proxies count] > 0) { if (!err && [proxies count] > 0) {
NSDictionary *settings = [proxies objectAtIndex:0]; NSDictionary *settings = [proxies objectAtIndex:0];
[self setProxyHost:[settings objectForKey:(NSString *)kCFProxyHostNameKey]]; [self setProxyHost:[settings objectForKey:(NSString *)kCFProxyHostNameKey]];
@ -4009,7 +4030,7 @@ static NSOperationQueue *sharedQueue = nil;
NSDictionary *existingConnection = [persistentConnectionsPool objectAtIndex:i]; NSDictionary *existingConnection = [persistentConnectionsPool objectAtIndex:i];
if (![existingConnection objectForKey:@"request"] && [[existingConnection objectForKey:@"expires"] timeIntervalSinceNow] <= 0) { if (![existingConnection objectForKey:@"request"] && [[existingConnection objectForKey:@"expires"] timeIntervalSinceNow] <= 0) {
#if DEBUG_PERSISTENT_CONNECTIONS #if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"[CONNECTION] Closing connection #%i because it has expired",[[existingConnection objectForKey:@"id"] intValue]); ASI_DEBUG_LOG(@"[CONNECTION] Closing connection #%i because it has expired",[[existingConnection objectForKey:@"id"] intValue]);
#endif #endif
NSInputStream *stream = [existingConnection objectForKey:@"stream"]; NSInputStream *stream = [existingConnection objectForKey:@"stream"];
if (stream) { if (stream) {
@ -4023,7 +4044,6 @@ static NSOperationQueue *sharedQueue = nil;
} }
#pragma mark NSCopying #pragma mark NSCopying
- (id)copyWithZone:(NSZone *)zone - (id)copyWithZone:(NSZone *)zone
{ {
// Don't forget - this will return a retained copy! // Don't forget - this will return a retained copy!
@ -4078,6 +4098,7 @@ static NSOperationQueue *sharedQueue = nil;
[newRequest setShouldUseRFC2616RedirectBehaviour:[self shouldUseRFC2616RedirectBehaviour]]; [newRequest setShouldUseRFC2616RedirectBehaviour:[self shouldUseRFC2616RedirectBehaviour]];
[newRequest setShouldAttemptPersistentConnection:[self shouldAttemptPersistentConnection]]; [newRequest setShouldAttemptPersistentConnection:[self shouldAttemptPersistentConnection]];
[newRequest setPersistentConnectionTimeoutSeconds:[self persistentConnectionTimeoutSeconds]]; [newRequest setPersistentConnectionTimeoutSeconds:[self persistentConnectionTimeoutSeconds]];
[newRequest setAuthenticationScheme:[self authenticationScheme]];
return newRequest; return newRequest;
} }
@ -4232,7 +4253,7 @@ static NSOperationQueue *sharedQueue = nil;
if ([self username] && [self password]) { if ([self username] && [self password]) {
NSDictionary *usernameAndPassword = [theCredentials objectForKey:@"Credentials"]; NSDictionary *usernameAndPassword = [theCredentials objectForKey:@"Credentials"];
NSString *storedUsername = [usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername]; NSString *storedUsername = [usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername];
NSString *storedPassword = [usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername]; NSString *storedPassword = [usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationPassword];
if (![storedUsername isEqualToString:[self username]] || ![storedPassword isEqualToString:[self password]]) { if (![storedUsername isEqualToString:[self username]] || ![storedPassword isEqualToString:[self password]]) {
continue; continue;
} }
@ -4297,13 +4318,15 @@ static NSOperationQueue *sharedQueue = nil;
} }
} }
+ (NSMutableArray *)sessionCookies + (NSMutableArray *)sessionCookies
{ {
[sessionCookiesLock lock];
if (!sessionCookies) { if (!sessionCookies) {
[ASIHTTPRequest setSessionCookies:[[[NSMutableArray alloc] init] autorelease]]; [ASIHTTPRequest setSessionCookies:[NSMutableArray array]];
} }
return sessionCookies; NSMutableArray *cookies = [[sessionCookies retain] autorelease];
[sessionCookiesLock unlock];
return cookies;
} }
+ (void)setSessionCookies:(NSMutableArray *)newSessionCookies + (void)setSessionCookies:(NSMutableArray *)newSessionCookies
@ -4349,12 +4372,9 @@ static NSOperationQueue *sharedQueue = nil;
+ (NSString *)defaultUserAgentString + (NSString *)defaultUserAgentString
{ {
// If we already have a default user agent set, return that @synchronized (self) {
if (defaultUserAgent) {
return defaultUserAgent;
}
// Otherwise, create a new user agent string (we'll save it for later reuse) if (!defaultUserAgent) {
NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSBundle *bundle = [NSBundle bundleForClass:[self class]];
@ -4385,11 +4405,9 @@ static NSOperationQueue *sharedQueue = nil;
appVersion = (marketingVersionNumber ? marketingVersionNumber : developmentVersionNumber); appVersion = (marketingVersionNumber ? marketingVersionNumber : developmentVersionNumber);
} }
NSString *deviceName; NSString *deviceName;
NSString *OSName; NSString *OSName;
NSString *OSVersion; NSString *OSVersion;
NSString *locale = [[NSLocale currentLocale] localeIdentifier]; NSString *locale = [[NSLocale currentLocale] localeIdentifier];
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
@ -4413,18 +4431,26 @@ static NSOperationQueue *sharedQueue = nil;
err = Gestalt(gestaltSystemVersionBugFix, &versionBugFix); err = Gestalt(gestaltSystemVersionBugFix, &versionBugFix);
if (err != noErr) return nil; if (err != noErr) return nil;
OSVersion = [NSString stringWithFormat:@"%u.%u.%u", versionMajor, versionMinor, versionBugFix]; OSVersion = [NSString stringWithFormat:@"%u.%u.%u", versionMajor, versionMinor, versionBugFix];
#endif #endif
// Takes the form "My Application 1.0 (Macintosh; Mac OS X 10.5.7; en_GB)" // Takes the form "My Application 1.0 (Macintosh; Mac OS X 10.5.7; en_GB)"
[self setDefaultUserAgentString:[NSString stringWithFormat:@"%@ %@ (%@; %@ %@; %@)", appName, appVersion, deviceName, OSName, OSVersion, locale]]; [self setDefaultUserAgentString:[NSString stringWithFormat:@"%@ %@ (%@; %@ %@; %@)", appName, appVersion, deviceName, OSName, OSVersion, locale]];
return defaultUserAgent; }
return [[defaultUserAgent retain] autorelease];
}
return nil;
} }
+ (void)setDefaultUserAgentString:(NSString *)agent + (void)setDefaultUserAgentString:(NSString *)agent
{ {
@synchronized (self) {
if (defaultUserAgent == agent) {
return;
}
[defaultUserAgent release]; [defaultUserAgent release];
defaultUserAgent = [agent copy]; defaultUserAgent = [agent copy];
} }
}
#pragma mark mime-type detection #pragma mark mime-type detection
@ -4441,7 +4467,7 @@ static NSOperationQueue *sharedQueue = nil;
if (!MIMEType) { if (!MIMEType) {
return @"application/octet-stream"; return @"application/octet-stream";
} }
return NSMakeCollectable([(NSString *)MIMEType autorelease]); return [NSMakeCollectable(MIMEType) autorelease];
} }
#pragma mark bandwidth measurement / throttling #pragma mark bandwidth measurement / throttling
@ -4460,14 +4486,14 @@ static NSOperationQueue *sharedQueue = nil;
if ([self readStreamIsScheduled]) { if ([self readStreamIsScheduled]) {
[self unscheduleReadStream]; [self unscheduleReadStream];
#if DEBUG_THROTTLING #if DEBUG_THROTTLING
NSLog(@"[THROTTLING] Sleeping request %@ until after %@",self,throttleWakeUpTime); ASI_DEBUG_LOG(@"[THROTTLING] Sleeping request %@ until after %@",self,throttleWakeUpTime);
#endif #endif
} }
} else { } else {
if (![self readStreamIsScheduled]) { if (![self readStreamIsScheduled]) {
[self scheduleReadStream]; [self scheduleReadStream];
#if DEBUG_THROTTLING #if DEBUG_THROTTLING
NSLog(@"[THROTTLING] Waking up request %@",self); ASI_DEBUG_LOG(@"[THROTTLING] Waking up request %@",self);
#endif #endif
} }
} }
@ -4485,7 +4511,7 @@ static NSOperationQueue *sharedQueue = nil;
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
[bandwidthThrottlingLock lock]; [bandwidthThrottlingLock lock];
BOOL throttle = isBandwidthThrottled || (!shouldThrottleBandwithForWWANOnly && (maxBandwidthPerSecond > 0)); BOOL throttle = isBandwidthThrottled || (!shouldThrottleBandwidthForWWANOnly && (maxBandwidthPerSecond > 0));
[bandwidthThrottlingLock unlock]; [bandwidthThrottlingLock unlock];
return throttle; return throttle;
#else #else
@ -4530,7 +4556,7 @@ static NSOperationQueue *sharedQueue = nil;
} }
} }
#if DEBUG_THROTTLING #if DEBUG_THROTTLING
NSLog(@"[THROTTLING] ===Used: %u bytes of bandwidth in last measurement period===",bandwidthUsedInLastSecond); ASI_DEBUG_LOG(@"[THROTTLING] ===Used: %u bytes of bandwidth in last measurement period===",bandwidthUsedInLastSecond);
#endif #endif
[bandwidthUsageTracker addObject:[NSNumber numberWithUnsignedLong:bandwidthUsedInLastSecond]]; [bandwidthUsageTracker addObject:[NSNumber numberWithUnsignedLong:bandwidthUsedInLastSecond]];
[bandwidthMeasurementDate release]; [bandwidthMeasurementDate release];
@ -4542,6 +4568,7 @@ static NSOperationQueue *sharedQueue = nil;
for (NSNumber *bytes in bandwidthUsageTracker) { for (NSNumber *bytes in bandwidthUsageTracker) {
totalBytes += [bytes unsignedLongValue]; totalBytes += [bytes unsignedLongValue];
} }
if (measurements > 0)
averageBandwidthUsedPerSecond = totalBytes/measurements; averageBandwidthUsedPerSecond = totalBytes/measurements;
} }
@ -4565,7 +4592,7 @@ static NSOperationQueue *sharedQueue = nil;
// Are we performing bandwidth throttling? // Are we performing bandwidth throttling?
if ( if (
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
isBandwidthThrottled || (!shouldThrottleBandwithForWWANOnly && (maxBandwidthPerSecond)) isBandwidthThrottled || (!shouldThrottleBandwidthForWWANOnly && (maxBandwidthPerSecond))
#else #else
maxBandwidthPerSecond maxBandwidthPerSecond
#endif #endif
@ -4617,7 +4644,7 @@ static NSOperationQueue *sharedQueue = nil;
[ASIHTTPRequest setMaxBandwidthPerSecond:0]; [ASIHTTPRequest setMaxBandwidthPerSecond:0];
[bandwidthThrottlingLock lock]; [bandwidthThrottlingLock lock];
isBandwidthThrottled = NO; isBandwidthThrottled = NO;
shouldThrottleBandwithForWWANOnly = NO; shouldThrottleBandwidthForWWANOnly = NO;
[bandwidthThrottlingLock unlock]; [bandwidthThrottlingLock unlock];
} }
} }
@ -4625,7 +4652,7 @@ static NSOperationQueue *sharedQueue = nil;
+ (void)throttleBandwidthForWWANUsingLimit:(unsigned long)limit + (void)throttleBandwidthForWWANUsingLimit:(unsigned long)limit
{ {
[bandwidthThrottlingLock lock]; [bandwidthThrottlingLock lock];
shouldThrottleBandwithForWWANOnly = YES; shouldThrottleBandwidthForWWANOnly = YES;
maxBandwidthPerSecond = limit; maxBandwidthPerSecond = limit;
[ASIHTTPRequest registerForNetworkReachabilityNotifications]; [ASIHTTPRequest registerForNetworkReachabilityNotifications];
[bandwidthThrottlingLock unlock]; [bandwidthThrottlingLock unlock];
@ -4671,13 +4698,19 @@ static NSOperationQueue *sharedQueue = nil;
+ (void)setDefaultCache:(id <ASICacheDelegate>)cache + (void)setDefaultCache:(id <ASICacheDelegate>)cache
{ {
@synchronized (self) {
[cache retain];
[defaultCache release]; [defaultCache release];
defaultCache = [cache retain]; defaultCache = cache;
}
} }
+ (id <ASICacheDelegate>)defaultCache + (id <ASICacheDelegate>)defaultCache
{ {
return defaultCache; @synchronized(self) {
return [[defaultCache retain] autorelease];
}
return nil;
} }
@ -4740,10 +4773,14 @@ static NSOperationQueue *sharedQueue = nil;
// If you have multiple requests sharing the thread or you want to re-use the thread, you'll need to restart the runloop // If you have multiple requests sharing the thread or you want to re-use the thread, you'll need to restart the runloop
+ (NSThread *)threadForRequest:(ASIHTTPRequest *)request + (NSThread *)threadForRequest:(ASIHTTPRequest *)request
{ {
if (!networkThread) { if (networkThread == nil) {
@synchronized(self) {
if (networkThread == nil) {
networkThread = [[NSThread alloc] initWithTarget:self selector:@selector(runRequests) object:nil]; networkThread = [[NSThread alloc] initWithTarget:self selector:@selector(runRequests) object:nil];
[networkThread start]; [networkThread start];
} }
}
}
return networkThread; return networkThread;
} }
@ -4757,8 +4794,8 @@ static NSOperationQueue *sharedQueue = nil;
BOOL runAlways = YES; // Introduced to cheat Static Analyzer BOOL runAlways = YES; // Introduced to cheat Static Analyzer
while (runAlways) { while (runAlways) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CFRunLoopRun(); CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e10, true);
[pool release]; [pool drain];
} }
// Should never be called, but anyway // Should never be called, but anyway
@ -4811,6 +4848,43 @@ static NSOperationQueue *sharedQueue = nil;
return [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]; return [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease];
} }
+ (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
{
NSDictionary *responseHeaders = [request responseHeaders];
// If we weren't given a custom max-age, lets look for one in the response headers
if (!maxAge) {
NSString *cacheControl = [[responseHeaders objectForKey:@"Cache-Control"] lowercaseString];
if (cacheControl) {
NSScanner *scanner = [NSScanner scannerWithString:cacheControl];
[scanner scanUpToString:@"max-age" intoString:NULL];
if ([scanner scanString:@"max-age" intoString:NULL]) {
[scanner scanString:@"=" intoString:NULL];
[scanner scanDouble:&maxAge];
}
}
}
// RFC 2612 says max-age must override any Expires header
if (maxAge) {
NSDate *date = [NSDate date];
if ([date respondsToSelector:@selector(dateByAddingTimeInterval:)]) {
return [date dateByAddingTimeInterval:maxAge];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [date addTimeInterval:maxAge];
#pragma clang diagnostic pop
}
} else {
NSString *expires = [responseHeaders objectForKey:@"Expires"];
if (expires) {
return [ASIHTTPRequest dateFromRFC1123String:expires];
}
}
return nil;
}
// Based on hints from http://stackoverflow.com/questions/1850824/parsing-a-rfc-822-date-with-nsdateformatter // Based on hints from http://stackoverflow.com/questions/1850824/parsing-a-rfc-822-date-with-nsdateformatter
+ (NSDate *)dateFromRFC1123String:(NSString *)string + (NSDate *)dateFromRFC1123String:(NSString *)string
{ {
@ -4934,7 +5008,7 @@ static NSOperationQueue *sharedQueue = nil;
@synthesize username; @synthesize username;
@synthesize password; @synthesize password;
@synthesize userAgent; @synthesize userAgentString;
@synthesize domain; @synthesize domain;
@synthesize proxyUsername; @synthesize proxyUsername;
@synthesize proxyPassword; @synthesize proxyPassword;

View file

@ -11,6 +11,12 @@
// Debug output configuration options // Debug output configuration options
// ====== // ======
// If defined will use the specified function for debug logging
// Otherwise use NSLog
#ifndef ASI_DEBUG_LOG
#define ASI_DEBUG_LOG NSLog
#endif
// When set to 1 ASIHTTPRequests will print information about what a request is doing // When set to 1 ASIHTTPRequests will print information about what a request is doing
#ifndef DEBUG_REQUEST_STATUS #ifndef DEBUG_REQUEST_STATUS
#define DEBUG_REQUEST_STATUS 0 #define DEBUG_REQUEST_STATUS 0

View file

@ -58,9 +58,11 @@ static NSLock *readLock = nil;
} }
[request performThrottling]; [request performThrottling];
} }
[ASIHTTPRequest incrementBandwidthUsedInLastSecond:toRead];
[readLock unlock]; [readLock unlock];
return [stream read:buffer maxLength:toRead]; NSInteger rv = [stream read:buffer maxLength:toRead];
if (rv > 0)
[ASIHTTPRequest incrementBandwidthUsedInLastSecond:rv];
return rv;
} }
/* /*

View file

@ -11,10 +11,6 @@
// Known issue: You cannot use startSychronous with an ASIWebPageRequest // Known issue: You cannot use startSychronous with an ASIWebPageRequest
#import "ASIHTTPRequest.h" #import "ASIHTTPRequest.h"
#import <libxml/HTMLparser.h>
#import <libxml/xmlsave.h>
#import <libxml/xpath.h>
#import <libxml/xpathInternals.h>
@class ASINetworkQueue; @class ASINetworkQueue;
@ -52,7 +48,7 @@ typedef enum _ASIURLReplacementMode {
NSMutableDictionary *resourceList; NSMutableDictionary *resourceList;
// Used internally for parsing HTML (with libxml) // Used internally for parsing HTML (with libxml)
xmlDocPtr doc; struct _xmlDoc *doc;
// If the response is an HTML or CSS file, this will be set so the content can be correctly parsed when it has finished fetching external resources // If the response is an HTML or CSS file, this will be set so the content can be correctly parsed when it has finished fetching external resources
ASIWebContentType webContentType; ASIWebContentType webContentType;
@ -64,6 +60,9 @@ typedef enum _ASIURLReplacementMode {
// Controls what ASIWebPageRequest does with external resources. See the notes above for more. // Controls what ASIWebPageRequest does with external resources. See the notes above for more.
ASIURLReplacementMode urlReplacementMode; ASIURLReplacementMode urlReplacementMode;
// When set to NO, loading will stop when an external resource fails to load. Defaults to YES
BOOL shouldIgnoreExternalResourceErrors;
} }
// Will return a data URI that contains a base64 version of the content at this url // Will return a data URI that contains a base64 version of the content at this url
@ -77,4 +76,5 @@ typedef enum _ASIURLReplacementMode {
@property (retain, nonatomic) ASIWebPageRequest *parentRequest; @property (retain, nonatomic) ASIWebPageRequest *parentRequest;
@property (assign, nonatomic) ASIURLReplacementMode urlReplacementMode; @property (assign, nonatomic) ASIURLReplacementMode urlReplacementMode;
@property (assign, nonatomic) BOOL shouldIgnoreExternalResourceErrors;
@end @end

View file

@ -10,6 +10,10 @@
#import "ASIWebPageRequest.h" #import "ASIWebPageRequest.h"
#import "ASINetworkQueue.h" #import "ASINetworkQueue.h"
#import <CommonCrypto/CommonHMAC.h> #import <CommonCrypto/CommonHMAC.h>
#import <libxml/HTMLparser.h>
#import <libxml/xmlsave.h>
#import <libxml/xpath.h>
#import <libxml/xpathInternals.h>
// An xPath query that controls the external resources ASIWebPageRequest will fetch // An xPath query that controls the external resources ASIWebPageRequest will fetch
// By default, it will fetch stylesheets, javascript files, images, frames, iframes, and html 5 video / audio // By default, it will fetch stylesheets, javascript files, images, frames, iframes, and html 5 video / audio
@ -45,6 +49,13 @@ static NSMutableArray *requestsUsingXMLParser = nil;
} }
} }
- (id)initWithURL:(NSURL *)newURL
{
self = [super initWithURL:newURL];
[self setShouldIgnoreExternalResourceErrors:YES];
return self;
}
- (void)dealloc - (void)dealloc
{ {
[externalResourceQueue cancelAllOperations]; [externalResourceQueue cancelAllOperations];
@ -59,6 +70,9 @@ static NSMutableArray *requestsUsingXMLParser = nil;
// We override it to stop that happening, and instead do that work in the bottom of finishedFetchingExternalResources: // We override it to stop that happening, and instead do that work in the bottom of finishedFetchingExternalResources:
- (void)markAsFinished - (void)markAsFinished
{ {
if ([self error]) {
[super markAsFinished];
}
} }
// This method is normally responsible for telling delegates we are done, but it happens to be the most convenient place to parse the responses // This method is normally responsible for telling delegates we are done, but it happens to be the most convenient place to parse the responses
@ -120,6 +134,7 @@ static NSMutableArray *requestsUsingXMLParser = nil;
[[self externalResourceQueue] cancelAllOperations]; [[self externalResourceQueue] cancelAllOperations];
[self setExternalResourceQueue:[ASINetworkQueue queue]]; [self setExternalResourceQueue:[ASINetworkQueue queue]];
[[self externalResourceQueue] setDelegate:self]; [[self externalResourceQueue] setDelegate:self];
[[self externalResourceQueue] setShouldCancelAllRequestsOnFailure:[self shouldIgnoreExternalResourceErrors]];
[[self externalResourceQueue] setShowAccurateProgress:[self showAccurateProgress]]; [[self externalResourceQueue] setShowAccurateProgress:[self showAccurateProgress]];
[[self externalResourceQueue] setQueueDidFinishSelector:@selector(finishedFetchingExternalResources:)]; [[self externalResourceQueue] setQueueDidFinishSelector:@selector(finishedFetchingExternalResources:)];
[[self externalResourceQueue] setRequestDidFinishSelector:@selector(externalResourceFetchSucceeded:)]; [[self externalResourceQueue] setRequestDidFinishSelector:@selector(externalResourceFetchSucceeded:)];
@ -246,6 +261,7 @@ static NSMutableArray *requestsUsingXMLParser = nil;
[[self externalResourceQueue] cancelAllOperations]; [[self externalResourceQueue] cancelAllOperations];
[self setExternalResourceQueue:[ASINetworkQueue queue]]; [self setExternalResourceQueue:[ASINetworkQueue queue]];
[[self externalResourceQueue] setDelegate:self]; [[self externalResourceQueue] setDelegate:self];
[[self externalResourceQueue] setShouldCancelAllRequestsOnFailure:[self shouldIgnoreExternalResourceErrors]];
[[self externalResourceQueue] setShowAccurateProgress:[self showAccurateProgress]]; [[self externalResourceQueue] setShowAccurateProgress:[self showAccurateProgress]];
[[self externalResourceQueue] setQueueDidFinishSelector:@selector(finishedFetchingExternalResources:)]; [[self externalResourceQueue] setQueueDidFinishSelector:@selector(finishedFetchingExternalResources:)];
[[self externalResourceQueue] setRequestDidFinishSelector:@selector(externalResourceFetchSucceeded:)]; [[self externalResourceQueue] setRequestDidFinishSelector:@selector(externalResourceFetchSucceeded:)];
@ -292,8 +308,10 @@ static NSMutableArray *requestsUsingXMLParser = nil;
- (void)externalResourceFetchFailed:(ASIHTTPRequest *)externalResourceRequest - (void)externalResourceFetchFailed:(ASIHTTPRequest *)externalResourceRequest
{ {
if ([[self externalResourceQueue] shouldCancelAllRequestsOnFailure]) {
[self failWithError:[externalResourceRequest error]]; [self failWithError:[externalResourceRequest error]];
} }
}
- (void)finishedFetchingExternalResources:(ASINetworkQueue *)queue - (void)finishedFetchingExternalResources:(ASINetworkQueue *)queue
{ {
@ -700,4 +718,5 @@ static NSMutableArray *requestsUsingXMLParser = nil;
@synthesize resourceList; @synthesize resourceList;
@synthesize parentRequest; @synthesize parentRequest;
@synthesize urlReplacementMode; @synthesize urlReplacementMode;
@synthesize shouldIgnoreExternalResourceErrors;
@end @end

View file

@ -24,10 +24,12 @@
// Response: // Response:
// X-CDN-Enabled: True // X-CDN-Enabled: True
// X-CDN-URI: http://cdn.cloudfiles.mosso.com/c1234 // X-CDN-URI: http://cdn.cloudfiles.mosso.com/c1234
// X-CDN-SSL-URI: https://cdn.ssl.cloudfiles.mosso.com/c1234
// X-CDN-TTL: 86400 // X-CDN-TTL: 86400
+ (id)containerInfoRequest:(NSString *)containerName; + (id)containerInfoRequest:(NSString *)containerName;
- (BOOL)cdnEnabled; - (BOOL)cdnEnabled;
- (NSString *)cdnURI; - (NSString *)cdnURI;
- (NSString *)cdnSSLURI;
- (NSUInteger)cdnTTL; - (NSUInteger)cdnTTL;

View file

@ -38,15 +38,35 @@
} }
- (BOOL)cdnEnabled { - (BOOL)cdnEnabled {
return [[[self responseHeaders] objectForKey:@"X-Cdn-Enabled"] boolValue]; NSNumber *enabled = [[self responseHeaders] objectForKey:@"X-CDN-Enabled"];
if (!enabled) {
enabled = [[self responseHeaders] objectForKey:@"X-Cdn-Enabled"];
}
return [enabled boolValue];
} }
- (NSString *)cdnURI { - (NSString *)cdnURI {
return [[self responseHeaders] objectForKey:@"X-Cdn-Uri"]; NSString *uri = [[self responseHeaders] objectForKey:@"X-CDN-URI"];
if (!uri) {
uri = [[self responseHeaders] objectForKey:@"X-Cdn-Uri"];
}
return uri;
}
- (NSString *)cdnSSLURI {
NSString *uri = [[self responseHeaders] objectForKey:@"X-CDN-SSL-URI"];
if (!uri) {
uri = [[self responseHeaders] objectForKey:@"X-Cdn-Ssl-Uri"];
}
return uri;
} }
- (NSUInteger)cdnTTL { - (NSUInteger)cdnTTL {
return [[[self responseHeaders] objectForKey:@"X-Ttl"] intValue]; NSNumber *ttl = [[self responseHeaders] objectForKey:@"X-TTL"];
if (!ttl) {
ttl = [[self responseHeaders] objectForKey:@"X-Ttl"];
}
return [ttl intValue];
} }
#pragma mark - #pragma mark -
@ -130,7 +150,7 @@
if (ttl > 0) { if (ttl > 0) {
[request addRequestHeader:@"X-Ttl" value:[NSString stringWithFormat:@"%i", ttl]]; [request addRequestHeader:@"X-Ttl" value:[NSString stringWithFormat:@"%i", ttl]];
} }
[request addRequestHeader:@"X-Cdn-Enabled" value:cdnEnabled ? @"True" : @"False"]; [request addRequestHeader:@"X-CDN-Enabled" value:cdnEnabled ? @"True" : @"False"];
return request; return request;
} }

View file

@ -22,6 +22,9 @@
-(void) dealloc { -(void) dealloc {
[name release]; [name release];
[cdnURL release];
[referrerACL release];
[useragentACL release];
[super dealloc]; [super dealloc];
} }

View file

@ -130,7 +130,7 @@
object.bytes = [[[self responseHeaders] objectForKey:@"Content-Length"] intValue]; object.bytes = [[[self responseHeaders] objectForKey:@"Content-Length"] intValue];
object.contentType = [[self responseHeaders] objectForKey:@"Content-Type"]; object.contentType = [[self responseHeaders] objectForKey:@"Content-Type"];
object.lastModified = [[self responseHeaders] objectForKey:@"Last-Modified"]; object.lastModified = [[self responseHeaders] objectForKey:@"Last-Modified"];
object.metadata = [[NSMutableDictionary alloc] init]; object.metadata = [NSMutableDictionary dictionary];
for (NSString *key in [[self responseHeaders] keyEnumerator]) { for (NSString *key in [[self responseHeaders] keyEnumerator]) {
NSRange metaRange = [key rangeOfString:@"X-Object-Meta-"]; NSRange metaRange = [key rangeOfString:@"X-Object-Meta-"];

View file

@ -69,8 +69,14 @@ static NSRecursiveLock *accessDetailsLock = nil;
NSDictionary *responseHeaders = [request responseHeaders]; NSDictionary *responseHeaders = [request responseHeaders];
authToken = [responseHeaders objectForKey:@"X-Auth-Token"]; authToken = [responseHeaders objectForKey:@"X-Auth-Token"];
storageURL = [responseHeaders objectForKey:@"X-Storage-Url"]; storageURL = [responseHeaders objectForKey:@"X-Storage-Url"];
cdnManagementURL = [responseHeaders objectForKey:@"X-CDN-Management-Url"];
// there is a bug in the Cloud Files API for some older accounts that causes
// the CDN URL to come back in a slightly different header
if (!cdnManagementURL) {
cdnManagementURL = [responseHeaders objectForKey:@"X-Cdn-Management-Url"]; cdnManagementURL = [responseHeaders objectForKey:@"X-Cdn-Management-Url"];
} }
}
[accessDetailsLock unlock]; [accessDetailsLock unlock];
return [request error]; return [request error];
} }

View file

@ -19,12 +19,20 @@
return bucket; return bucket;
} }
- (void)dealloc
{
[name release];
[creationDate release];
[ownerID release];
[ownerName release];
[super dealloc];
}
- (NSString *)description - (NSString *)description
{ {
return [NSString stringWithFormat:@"Name: %@ creationDate: %@ ownerID: %@ ownerName: %@",[self name],[self creationDate],[self ownerID],[self ownerName]]; return [NSString stringWithFormat:@"Name: %@ creationDate: %@ ownerID: %@ ownerName: %@",[self name],[self creationDate],[self ownerID],[self ownerName]];
} }
@synthesize name; @synthesize name;
@synthesize creationDate; @synthesize creationDate;
@synthesize ownerID; @synthesize ownerID;

View file

@ -98,7 +98,7 @@
[queryParts addObject:[NSString stringWithFormat:@"delimiter=%@",[[self delimiter] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; [queryParts addObject:[NSString stringWithFormat:@"delimiter=%@",[[self delimiter] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
} }
if ([self maxResultCount] > 0) { if ([self maxResultCount] > 0) {
[queryParts addObject:[NSString stringWithFormat:@"max-keys=%hi",[self maxResultCount]]]; [queryParts addObject:[NSString stringWithFormat:@"max-keys=%i",[self maxResultCount]]];
} }
if ([queryParts count]) { if ([queryParts count]) {
NSString* template = @"%@?%@"; NSString* template = @"%@?%@";

View file

@ -84,9 +84,11 @@ NSString *const ASIS3StorageClassReducedRedundancy = @"REDUCED_REDUNDANCY";
ASIS3ObjectRequest *newRequest = [super copyWithZone:zone]; ASIS3ObjectRequest *newRequest = [super copyWithZone:zone];
[newRequest setBucket:[self bucket]]; [newRequest setBucket:[self bucket]];
[newRequest setKey:[self key]]; [newRequest setKey:[self key]];
[newRequest setMimeType:[self mimeType]];
[newRequest setSourceBucket:[self sourceBucket]]; [newRequest setSourceBucket:[self sourceBucket]];
[newRequest setSourceKey:[self sourceKey]]; [newRequest setSourceKey:[self sourceKey]];
[newRequest setMimeType:[self mimeType]];
[newRequest setSubResource:[self subResource]];
[newRequest setStorageClass:[self storageClass]];
return newRequest; return newRequest;
} }

View file

@ -197,6 +197,7 @@ static NSString *sharedSecretAccessKey = nil;
ASIS3Request *newRequest = [super copyWithZone:zone]; ASIS3Request *newRequest = [super copyWithZone:zone];
[newRequest setAccessKey:[self accessKey]]; [newRequest setAccessKey:[self accessKey]];
[newRequest setSecretAccessKey:[self secretAccessKey]]; [newRequest setSecretAccessKey:[self secretAccessKey]];
[newRequest setRequestScheme:[self requestScheme]];
[newRequest setAccessPolicy:[self accessPolicy]]; [newRequest setAccessPolicy:[self accessPolicy]];
return newRequest; return newRequest;
} }

View file

@ -1 +0,0 @@
../../SDWebImage/SDWebImage/NSData+GIF.h

View file

@ -119,7 +119,8 @@ extern NSObject *kTAGDataLayerObjectNotPresent;
* will be evaluated and matching tags will fire. * will be evaluated and matching tags will fire.
* *
* @param update The update object to process * @param update The update object to process
*/- (void)push:(NSDictionary*)update; */
- (void)push:(NSDictionary*)update;
/** /**
* Returns the object in the model associated with the given key. * Returns the object in the model associated with the given key.

View file

@ -4,3 +4,9 @@ and the Google Tag Manager SDK.
The libGoogleAnalyticsServices.a library contains code for both. The libGoogleAnalyticsServices.a library contains code for both.
Within the subdirectories, you can find header files and documentation Within the subdirectories, you can find header files and documentation
for each. for each.
The libAdIdAccess.a library contains functions that call the AdSupport
framework. If you would like your application to access the identifier for
advertisers (IDFA) and tracking flag provided by that framework through the
Google Tag Manager SDK macros, you will also need to add this library to your
XCode project.

View file

@ -1 +0,0 @@
../../SDWebImage/SDWebImage/NSData+GIF.h

View file

@ -192,8 +192,8 @@ CGRect IASKCGRectSwap(CGRect rect);
[super viewDidAppear:animated]; [super viewDidAppear:animated];
NSNotificationCenter *dc = [NSNotificationCenter defaultCenter]; NSNotificationCenter *dc = [NSNotificationCenter defaultCenter];
IASK_IF_IOS4_OR_GREATER([dc addObserver:self selector:@selector(synchronizeSettings) name:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication]];); [dc addObserver:self selector:@selector(synchronizeSettings) name:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication]];
IASK_IF_IOS4_OR_GREATER([dc addObserver:self selector:@selector(reload) name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]];); [dc addObserver:self selector:@selector(reload) name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]];
[dc addObserver:self selector:@selector(synchronizeSettings) name:UIApplicationWillTerminateNotification object:[UIApplication sharedApplication]]; [dc addObserver:self selector:@selector(synchronizeSettings) name:UIApplicationWillTerminateNotification object:[UIApplication sharedApplication]];
} }
@ -203,7 +203,11 @@ CGRect IASKCGRectSwap(CGRect rect);
} }
- (void)viewDidDisappear:(BOOL)animated { - (void)viewDidDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] removeObserver:self]; NSNotificationCenter *dc = [NSNotificationCenter defaultCenter];
[dc removeObserver:self name:NSUserDefaultsDidChangeNotification object:[NSUserDefaults standardUserDefaults]];
[dc removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication]];
[dc removeObserver:self name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]];
[dc removeObserver:self name:UIApplicationWillTerminateNotification object:[UIApplication sharedApplication]];
// hide the keyboard // hide the keyboard
[self.currentFirstResponder resignFirstResponder]; [self.currentFirstResponder resignFirstResponder];

View file

@ -36,6 +36,7 @@
#define kIASKAutoCorrectionType @"AutocorrectionType" #define kIASKAutoCorrectionType @"AutocorrectionType"
#define kIASKValues @"Values" #define kIASKValues @"Values"
#define kIASKTitles @"Titles" #define kIASKTitles @"Titles"
#define kIASKShortTitles @"ShortTitles"
#define kIASKViewControllerClass @"IASKViewControllerClass" #define kIASKViewControllerClass @"IASKViewControllerClass"
#define kIASKViewControllerSelector @"IASKViewControllerSelector" #define kIASKViewControllerSelector @"IASKViewControllerSelector"
#define kIASKButtonClass @"IASKButtonClass" #define kIASKButtonClass @"IASKButtonClass"

View file

@ -21,17 +21,19 @@
*/ */
@protocol IASKSettingsStore <NSObject> @protocol IASKSettingsStore <NSObject>
@required @required
- (id)objectForKey:(NSString*)key;
- (void)setObject:(id)value forKey:(NSString*)key;
- (BOOL)synchronize; // Write settings to a permanant storage. Returns YES on success, NO otherwise
@optional
- (void)setBool:(BOOL)value forKey:(NSString*)key; - (void)setBool:(BOOL)value forKey:(NSString*)key;
- (void)setFloat:(float)value forKey:(NSString*)key; - (void)setFloat:(float)value forKey:(NSString*)key;
- (void)setDouble:(double)value forKey:(NSString*)key; - (void)setDouble:(double)value forKey:(NSString*)key;
- (void)setInteger:(int)value forKey:(NSString*)key; - (void)setInteger:(int)value forKey:(NSString*)key;
- (void)setObject:(id)value forKey:(NSString*)key;
- (BOOL)boolForKey:(NSString*)key; - (BOOL)boolForKey:(NSString*)key;
- (float)floatForKey:(NSString*)key; - (float)floatForKey:(NSString*)key;
- (double)doubleForKey:(NSString*)key; - (double)doubleForKey:(NSString*)key;
- (NSInteger)integerForKey:(NSString*)key; - (NSInteger)integerForKey:(NSString*)key;
- (id)objectForKey:(NSString*)key;
- (BOOL)synchronize; // Write settings to a permanant storage. Returns YES on success, NO otherwise
@end @end

View file

@ -30,6 +30,11 @@
return nil; return nil;
} }
- (void)removeObjectForKey:(NSString*)key {
[NSException raise:@"Unimplemented"
format:@"removeObjectForKey: must be implemented in subclasses of IASKAbstractSettingsStore"];
}
- (void)setBool:(BOOL)value forKey:(NSString*)key { - (void)setBool:(BOOL)value forKey:(NSString*)key {
[self setObject:[NSNumber numberWithBool:value] forKey:key]; [self setObject:[NSNumber numberWithBool:value] forKey:key];
} }

View file

@ -44,6 +44,10 @@
return [_dict objectForKey:key]; return [_dict objectForKey:key];
} }
- (void) removeObjectForKey:(NSString *)key {
[_dict removeObjectForKey:key];
}
- (BOOL)synchronize { - (BOOL)synchronize {
return [_dict writeToFile:_filePath atomically:YES]; return [_dict writeToFile:_filePath atomically:YES];
} }

View file

@ -77,6 +77,10 @@
return [self.defaults objectForKey:key]; return [self.defaults objectForKey:key];
} }
- (void)removeObjectForKey:(NSString *)key {
[self.defaults removeObjectForKey:key];
}
- (BOOL)synchronize { - (BOOL)synchronize {
return [self.defaults synchronize]; return [self.defaults synchronize];
} }

View file

@ -40,7 +40,7 @@
- (void)_reinterpretValues:(NSDictionary*)specifierDict { - (void)_reinterpretValues:(NSDictionary*)specifierDict {
NSArray *values = [_specifierDict objectForKey:kIASKValues]; NSArray *values = [_specifierDict objectForKey:kIASKValues];
NSArray *titles = [_specifierDict objectForKey:kIASKTitles]; NSArray *titles = [_specifierDict objectForKey:kIASKTitles];
NSArray *shortTitles = [_specifierDict objectForKey:kIASKShortTitles];
NSMutableDictionary *multipleValuesDict = [NSMutableDictionary new]; NSMutableDictionary *multipleValuesDict = [NSMutableDictionary new];
if (values) { if (values) {
@ -51,6 +51,10 @@
[multipleValuesDict setObject:titles forKey:kIASKTitles]; [multipleValuesDict setObject:titles forKey:kIASKTitles];
} }
if (shortTitles) {
[multipleValuesDict setObject:shortTitles forKey:kIASKShortTitles];
}
[self setMultipleValuesDict:multipleValuesDict]; [self setMultipleValuesDict:multipleValuesDict];
} }
- (NSString*)localizedObjectForKey:(NSString*)key { - (NSString*)localizedObjectForKey:(NSString*)key {
@ -91,7 +95,10 @@
- (NSString*)titleForCurrentValue:(id)currentValue { - (NSString*)titleForCurrentValue:(id)currentValue {
NSArray *values = [self multipleValues]; NSArray *values = [self multipleValues];
NSArray *titles = [self multipleTitles]; NSArray *titles = [self multipleShortTitles];
if (!titles)
titles = [self multipleTitles];
if (values.count != titles.count) { if (values.count != titles.count) {
return nil; return nil;
} }
@ -118,6 +125,10 @@
return [_multipleValuesDict objectForKey:kIASKTitles]; return [_multipleValuesDict objectForKey:kIASKTitles];
} }
- (NSArray*)multipleShortTitles {
return [_multipleValuesDict objectForKey:kIASKShortTitles];
}
- (NSString*)file { - (NSString*)file {
return [_specifierDict objectForKey:kIASKFile]; return [_specifierDict objectForKey:kIASKFile];
} }

36
Pods/Manifest.lock generated
View file

@ -1,24 +1,26 @@
PODS: PODS:
- ASIHTTPRequest (1.8.1): - ASIHTTPRequest (1.8.2):
- ASIHTTPRequest/ASIWebPageRequest - ASIHTTPRequest/ASIWebPageRequest
- ASIHTTPRequest/CloudFiles - ASIHTTPRequest/CloudFiles
- ASIHTTPRequest/Core
- ASIHTTPRequest/S3 - ASIHTTPRequest/S3
- ASIHTTPRequest/ASIWebPageRequest (1.8.2):
- ASIHTTPRequest/Core
- ASIHTTPRequest/CloudFiles (1.8.2):
- ASIHTTPRequest/Core
- ASIHTTPRequest/Core (1.8.2):
- Reachability - Reachability
- ASIHTTPRequest/ASIWebPageRequest (1.8.1): - ASIHTTPRequest/S3 (1.8.2):
- Reachability - ASIHTTPRequest/Core
- ASIHTTPRequest/CloudFiles (1.8.1): - GoogleAnalytics-iOS-SDK (3.0.6)
- Reachability - InAppSettingsKit (2.0.1)
- ASIHTTPRequest/S3 (1.8.1): - iRate (1.9.3)
- Reachability
- GoogleAnalytics-iOS-SDK (3.0.3)
- InAppSettingsKit (2.0)
- iRate (1.9.2)
- MBProgressHUD (0.8) - MBProgressHUD (0.8)
- Reachability (3.1.1) - Reachability (3.1.1)
- SBJson (3.2) - SBJson (3.2)
- SDWebImage (3.5.2): - SDWebImage (3.5.4):
- SDWebImage/Core - SDWebImage/Core
- SDWebImage/Core (3.5.2) - SDWebImage/Core (3.5.4)
- TMQuiltView (0.0.1) - TMQuiltView (0.0.1)
- ViewDeck (2.3.1) - ViewDeck (2.3.1)
@ -35,14 +37,14 @@ DEPENDENCIES:
- ViewDeck (~> 2.3.1) - ViewDeck (~> 2.3.1)
SPEC CHECKSUMS: SPEC CHECKSUMS:
ASIHTTPRequest: 162783e0cd71bdd3ff1ceed0cd5fa9505e0116a8 ASIHTTPRequest: 4bd3ed65bf8a726292c5fa79ea5c0a2e02c97241
GoogleAnalytics-iOS-SDK: 7b0e55cfe5e70d60478a7b105f15ac71e8bc373e GoogleAnalytics-iOS-SDK: c135fb62b1e5aa003b7be97b656ccee212896cf7
InAppSettingsKit: 2b85ba925a81634860461c21274f54b130c84614 InAppSettingsKit: 5e42f626b9be9c33e3b04c0cc9523ca5eabe7ad3
iRate: 7c4bc22ab4a8752185d84bed7a98dc111c8212a5 iRate: 99aef520b335a1eb4a14a8d9ba5e8db4e1d95bbe
MBProgressHUD: 2bbc6f470111daf7f3eaa4eb12b8cbf01c4c0622 MBProgressHUD: 2bbc6f470111daf7f3eaa4eb12b8cbf01c4c0622
Reachability: be4883bb93f31e38266ae3365e5600a317aae735 Reachability: be4883bb93f31e38266ae3365e5600a317aae735
SBJson: abc2bf2baef456d5dae213f9826fe2b6fdf19861 SBJson: abc2bf2baef456d5dae213f9826fe2b6fdf19861
SDWebImage: fe7ce01ae4e0a884d168f59c9dd82d35baf8429e SDWebImage: 1a62010700adbba823b621fc217906739dbf6aa5
TMQuiltView: 520d09d6a98f1a6aa75ed92a91123ecc79bab62c TMQuiltView: 520d09d6a98f1a6aa75ed92a91123ecc79bab62c
ViewDeck: 2cdc67c4b41a10cafc7556b982f028409e33604d ViewDeck: 2cdc67c4b41a10cafc7556b982f028409e33604d

View file

@ -6,3 +6,4 @@

View file

@ -1,3 +1,3 @@
PODS_GOOGLEANALYTICS_IOS_SDK_HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libz PODS_GOOGLEANALYTICS_IOS_SDK_HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libz
PODS_GOOGLEANALYTICS_IOS_SDK_LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/GoogleAnalytics-iOS-SDK" PODS_GOOGLEANALYTICS_IOS_SDK_LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/GoogleAnalytics-iOS-SDK"
PODS_GOOGLEANALYTICS_IOS_SDK_OTHER_LDFLAGS = -lGoogleAnalyticsServices -lz -framework CFNetwork -framework CoreData -framework SystemConfiguration -weak_framework AdSupport PODS_GOOGLEANALYTICS_IOS_SDK_OTHER_LDFLAGS = -lGoogleAnalyticsServices -lz -framework CFNetwork -framework CoreData -framework SystemConfiguration

View file

@ -170,7 +170,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
iRate iRate
Version 1.9.2, January 21st, 2014 Version 1.9.3, February 5th, 2014
Copyright (C) 2011 Charcoal Design Copyright (C) 2011 Charcoal Design

View file

@ -217,7 +217,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<key>FooterText</key> <key>FooterText</key>
<string>iRate <string>iRate
Version 1.9.2, January 21st, 2014 Version 1.9.3, February 5th, 2014
Copyright (C) 2011 Charcoal Design Copyright (C) 2011 Charcoal Design

View file

@ -10,37 +10,43 @@
#define COCOAPODS_POD_AVAILABLE_ASIHTTPRequest #define COCOAPODS_POD_AVAILABLE_ASIHTTPRequest
#define COCOAPODS_VERSION_MAJOR_ASIHTTPRequest 1 #define COCOAPODS_VERSION_MAJOR_ASIHTTPRequest 1
#define COCOAPODS_VERSION_MINOR_ASIHTTPRequest 8 #define COCOAPODS_VERSION_MINOR_ASIHTTPRequest 8
#define COCOAPODS_VERSION_PATCH_ASIHTTPRequest 1 #define COCOAPODS_VERSION_PATCH_ASIHTTPRequest 2
// ASIHTTPRequest/ASIWebPageRequest // ASIHTTPRequest/ASIWebPageRequest
#define COCOAPODS_POD_AVAILABLE_ASIHTTPRequest_ASIWebPageRequest #define COCOAPODS_POD_AVAILABLE_ASIHTTPRequest_ASIWebPageRequest
#define COCOAPODS_VERSION_MAJOR_ASIHTTPRequest_ASIWebPageRequest 1 #define COCOAPODS_VERSION_MAJOR_ASIHTTPRequest_ASIWebPageRequest 1
#define COCOAPODS_VERSION_MINOR_ASIHTTPRequest_ASIWebPageRequest 8 #define COCOAPODS_VERSION_MINOR_ASIHTTPRequest_ASIWebPageRequest 8
#define COCOAPODS_VERSION_PATCH_ASIHTTPRequest_ASIWebPageRequest 1 #define COCOAPODS_VERSION_PATCH_ASIHTTPRequest_ASIWebPageRequest 2
// ASIHTTPRequest/CloudFiles // ASIHTTPRequest/CloudFiles
#define COCOAPODS_POD_AVAILABLE_ASIHTTPRequest_CloudFiles #define COCOAPODS_POD_AVAILABLE_ASIHTTPRequest_CloudFiles
#define COCOAPODS_VERSION_MAJOR_ASIHTTPRequest_CloudFiles 1 #define COCOAPODS_VERSION_MAJOR_ASIHTTPRequest_CloudFiles 1
#define COCOAPODS_VERSION_MINOR_ASIHTTPRequest_CloudFiles 8 #define COCOAPODS_VERSION_MINOR_ASIHTTPRequest_CloudFiles 8
#define COCOAPODS_VERSION_PATCH_ASIHTTPRequest_CloudFiles 1 #define COCOAPODS_VERSION_PATCH_ASIHTTPRequest_CloudFiles 2
// ASIHTTPRequest/Core
#define COCOAPODS_POD_AVAILABLE_ASIHTTPRequest_Core
#define COCOAPODS_VERSION_MAJOR_ASIHTTPRequest_Core 1
#define COCOAPODS_VERSION_MINOR_ASIHTTPRequest_Core 8
#define COCOAPODS_VERSION_PATCH_ASIHTTPRequest_Core 2
// ASIHTTPRequest/S3 // ASIHTTPRequest/S3
#define COCOAPODS_POD_AVAILABLE_ASIHTTPRequest_S3 #define COCOAPODS_POD_AVAILABLE_ASIHTTPRequest_S3
#define COCOAPODS_VERSION_MAJOR_ASIHTTPRequest_S3 1 #define COCOAPODS_VERSION_MAJOR_ASIHTTPRequest_S3 1
#define COCOAPODS_VERSION_MINOR_ASIHTTPRequest_S3 8 #define COCOAPODS_VERSION_MINOR_ASIHTTPRequest_S3 8
#define COCOAPODS_VERSION_PATCH_ASIHTTPRequest_S3 1 #define COCOAPODS_VERSION_PATCH_ASIHTTPRequest_S3 2
// GoogleAnalytics-iOS-SDK // GoogleAnalytics-iOS-SDK
#define COCOAPODS_POD_AVAILABLE_GoogleAnalytics_iOS_SDK #define COCOAPODS_POD_AVAILABLE_GoogleAnalytics_iOS_SDK
#define COCOAPODS_VERSION_MAJOR_GoogleAnalytics_iOS_SDK 3 #define COCOAPODS_VERSION_MAJOR_GoogleAnalytics_iOS_SDK 3
#define COCOAPODS_VERSION_MINOR_GoogleAnalytics_iOS_SDK 0 #define COCOAPODS_VERSION_MINOR_GoogleAnalytics_iOS_SDK 0
#define COCOAPODS_VERSION_PATCH_GoogleAnalytics_iOS_SDK 3 #define COCOAPODS_VERSION_PATCH_GoogleAnalytics_iOS_SDK 6
// InAppSettingsKit // InAppSettingsKit
#define COCOAPODS_POD_AVAILABLE_InAppSettingsKit #define COCOAPODS_POD_AVAILABLE_InAppSettingsKit
#define COCOAPODS_VERSION_MAJOR_InAppSettingsKit 2 #define COCOAPODS_VERSION_MAJOR_InAppSettingsKit 2
#define COCOAPODS_VERSION_MINOR_InAppSettingsKit 0 #define COCOAPODS_VERSION_MINOR_InAppSettingsKit 0
#define COCOAPODS_VERSION_PATCH_InAppSettingsKit 0 #define COCOAPODS_VERSION_PATCH_InAppSettingsKit 1
// MBProgressHUD // MBProgressHUD
#define COCOAPODS_POD_AVAILABLE_MBProgressHUD #define COCOAPODS_POD_AVAILABLE_MBProgressHUD
@ -64,13 +70,13 @@
#define COCOAPODS_POD_AVAILABLE_SDWebImage #define COCOAPODS_POD_AVAILABLE_SDWebImage
#define COCOAPODS_VERSION_MAJOR_SDWebImage 3 #define COCOAPODS_VERSION_MAJOR_SDWebImage 3
#define COCOAPODS_VERSION_MINOR_SDWebImage 5 #define COCOAPODS_VERSION_MINOR_SDWebImage 5
#define COCOAPODS_VERSION_PATCH_SDWebImage 2 #define COCOAPODS_VERSION_PATCH_SDWebImage 4
// SDWebImage/Core // SDWebImage/Core
#define COCOAPODS_POD_AVAILABLE_SDWebImage_Core #define COCOAPODS_POD_AVAILABLE_SDWebImage_Core
#define COCOAPODS_VERSION_MAJOR_SDWebImage_Core 3 #define COCOAPODS_VERSION_MAJOR_SDWebImage_Core 3
#define COCOAPODS_VERSION_MINOR_SDWebImage_Core 5 #define COCOAPODS_VERSION_MINOR_SDWebImage_Core 5
#define COCOAPODS_VERSION_PATCH_SDWebImage_Core 2 #define COCOAPODS_VERSION_PATCH_SDWebImage_Core 4
// TMQuiltView // TMQuiltView
#define COCOAPODS_POD_AVAILABLE_TMQuiltView #define COCOAPODS_POD_AVAILABLE_TMQuiltView
@ -88,5 +94,5 @@
#define COCOAPODS_POD_AVAILABLE_iRate #define COCOAPODS_POD_AVAILABLE_iRate
#define COCOAPODS_VERSION_MAJOR_iRate 1 #define COCOAPODS_VERSION_MAJOR_iRate 1
#define COCOAPODS_VERSION_MINOR_iRate 9 #define COCOAPODS_VERSION_MINOR_iRate 9
#define COCOAPODS_VERSION_PATCH_iRate 2 #define COCOAPODS_VERSION_PATCH_iRate 3

2
Pods/Pods.xcconfig generated
View file

@ -2,5 +2,5 @@ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/ASIHTTPRequest" "${PODS_ROOT}/Headers/GoogleAnalytics-iOS-SDK" "${PODS_ROOT}/Headers/InAppSettingsKit" "${PODS_ROOT}/Headers/MBProgressHUD" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/SBJson" "${PODS_ROOT}/Headers/SDWebImage" "${PODS_ROOT}/Headers/TMQuiltView" "${PODS_ROOT}/Headers/ViewDeck" "${PODS_ROOT}/Headers/iRate" "$(SDKROOT)/usr/include/libxml2" $(SDKROOT)/usr/include/libz HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/ASIHTTPRequest" "${PODS_ROOT}/Headers/GoogleAnalytics-iOS-SDK" "${PODS_ROOT}/Headers/InAppSettingsKit" "${PODS_ROOT}/Headers/MBProgressHUD" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/SBJson" "${PODS_ROOT}/Headers/SDWebImage" "${PODS_ROOT}/Headers/TMQuiltView" "${PODS_ROOT}/Headers/ViewDeck" "${PODS_ROOT}/Headers/iRate" "$(SDKROOT)/usr/include/libxml2" $(SDKROOT)/usr/include/libz
LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/GoogleAnalytics-iOS-SDK" LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/GoogleAnalytics-iOS-SDK"
OTHER_CFLAGS = $(inherited) "-isystem${PODS_ROOT}/Headers" "-isystem${PODS_ROOT}/Headers/ASIHTTPRequest" "-isystem${PODS_ROOT}/Headers/GoogleAnalytics-iOS-SDK" "-isystem${PODS_ROOT}/Headers/InAppSettingsKit" "-isystem${PODS_ROOT}/Headers/MBProgressHUD" "-isystem${PODS_ROOT}/Headers/Reachability" "-isystem${PODS_ROOT}/Headers/SBJson" "-isystem${PODS_ROOT}/Headers/SDWebImage" "-isystem${PODS_ROOT}/Headers/TMQuiltView" "-isystem${PODS_ROOT}/Headers/ViewDeck" "-isystem${PODS_ROOT}/Headers/iRate" OTHER_CFLAGS = $(inherited) "-isystem${PODS_ROOT}/Headers" "-isystem${PODS_ROOT}/Headers/ASIHTTPRequest" "-isystem${PODS_ROOT}/Headers/GoogleAnalytics-iOS-SDK" "-isystem${PODS_ROOT}/Headers/InAppSettingsKit" "-isystem${PODS_ROOT}/Headers/MBProgressHUD" "-isystem${PODS_ROOT}/Headers/Reachability" "-isystem${PODS_ROOT}/Headers/SBJson" "-isystem${PODS_ROOT}/Headers/SDWebImage" "-isystem${PODS_ROOT}/Headers/TMQuiltView" "-isystem${PODS_ROOT}/Headers/ViewDeck" "-isystem${PODS_ROOT}/Headers/iRate"
OTHER_LDFLAGS = -ObjC -lGoogleAnalyticsServices -lxml2.2 -lz -lz.1 -framework CFNetwork -framework CoreData -framework CoreGraphics -framework ImageIO -framework MessageUI -framework MobileCoreServices -framework QuartzCore -framework SystemConfiguration -weak_framework AdSupport OTHER_LDFLAGS = -ObjC -lGoogleAnalyticsServices -lxml2.2 -lz -lz.1 -framework CFNetwork -framework CoreData -framework CoreGraphics -framework ImageIO -framework MessageUI -framework MobileCoreServices -framework QuartzCore -framework SystemConfiguration
PODS_ROOT = ${SRCROOT}/Pods PODS_ROOT = ${SRCROOT}/Pods

File diff suppressed because it is too large Load diff

View file

@ -16,8 +16,9 @@ It provides:
- A guarantee that main thread will never be blocked - A guarantee that main thread will never be blocked
- Performances! - Performances!
- Use GCD and ARC - Use GCD and ARC
- Arm64 support
NOTE: The version 3.0 of SDWebImage isn't fully backward compatible with 2.0 and requires iOS 5.0 NOTE: The version 3.0 of SDWebImage isn't fully backward compatible with 2.0 and requires iOS 5.1.1
minimum deployement version. If you need iOS < 5.0 support, please use the last [2.0 version](https://github.com/rs/SDWebImage/tree/2.0-compat). minimum deployement version. If you need iOS < 5.0 support, please use the last [2.0 version](https://github.com/rs/SDWebImage/tree/2.0-compat).
[How is SDWebImage better than X?](https://github.com/rs/SDWebImage/wiki/How-is-SDWebImage-better-than-X%3F) [How is SDWebImage better than X?](https://github.com/rs/SDWebImage/wiki/How-is-SDWebImage-better-than-X%3F)
@ -138,7 +139,7 @@ key is an application unique identifier for the image to cache. It is generally
the image. the image.
```objective-c ```objective-c
SDImageCache *imageCache = [SDImageCache.alloc initWithNamespace:@"myNamespace"]; SDImageCache *imageCache = [[SDImageCache alloc] initWithNamespace:@"myNamespace"];
[imageCache queryDiskCacheForKey:myCacheKey done:^(UIImage *image) [imageCache queryDiskCacheForKey:myCacheKey done:^(UIImage *image)
{ {
// image is not nil if image was found // image is not nil if image was found

View file

@ -1,15 +0,0 @@
//
// NSData+GIF.h
// SDWebImage
//
// Created by Andy LaVoy on 4/28/13.
// Copyright (c) 2013 Dailymotion. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSData (GIF)
- (BOOL)sd_isGIF;
@end

View file

@ -1,32 +0,0 @@
//
// NSData+GIF.m
// SDWebImage
//
// Created by Andy LaVoy on 4/28/13.
// Copyright (c) 2013 Dailymotion. All rights reserved.
//
#import "NSData+GIF.h"
@implementation NSData (GIF)
- (BOOL)sd_isGIF
{
BOOL isGIF = NO;
uint8_t c;
[self getBytes:&c length:1];
switch (c)
{
case 0x47: // probably a GIF
isGIF = YES;
break;
default:
break;
}
return isGIF;
}
@end

View file

@ -9,12 +9,11 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SDWebImageCompat.h" #import "SDWebImageCompat.h"
enum SDImageCacheType typedef NS_ENUM(NSInteger, SDImageCacheType) {
{
/** /**
* The image wasn't available the SDWebImage caches, but was downloaded from the web. * The image wasn't available the SDWebImage caches, but was downloaded from the web.
*/ */
SDImageCacheTypeNone = 0, SDImageCacheTypeNone,
/** /**
* The image was obtained from the disk cache. * The image was obtained from the disk cache.
*/ */
@ -24,7 +23,6 @@ enum SDImageCacheType
*/ */
SDImageCacheTypeMemory SDImageCacheTypeMemory
}; };
typedef enum SDImageCacheType SDImageCacheType;
/** /**
* SDImageCache maintains a memory cache and an optional disk cache. Disk cache write operations are performed * SDImageCache maintains a memory cache and an optional disk cache. Disk cache write operations are performed
@ -45,7 +43,7 @@ typedef enum SDImageCacheType SDImageCacheType;
/** /**
* The maximum size of the cache, in bytes. * The maximum size of the cache, in bytes.
*/ */
@property (assign, nonatomic) unsigned long long maxCacheSize; @property (assign, nonatomic) NSUInteger maxCacheSize;
/** /**
* Returns global shared cache instance * Returns global shared cache instance
@ -144,6 +142,7 @@ typedef enum SDImageCacheType SDImageCacheType;
* Clear all disk cached images * Clear all disk cached images
*/ */
- (void)clearDisk; - (void)clearDisk;
- (void)clearDiskOnCompletion:(void (^)())completion;
/** /**
* Remove all expired cached image from disk * Remove all expired cached image from disk
@ -153,7 +152,7 @@ typedef enum SDImageCacheType SDImageCacheType;
/** /**
* Get the size used by the disk cache * Get the size used by the disk cache
*/ */
- (unsigned long long)getSize; - (NSUInteger)getSize;
/** /**
* Get the number of images in the disk cache * Get the number of images in the disk cache
@ -163,7 +162,7 @@ typedef enum SDImageCacheType SDImageCacheType;
/** /**
* Asynchronously calculate the disk cache's size. * Asynchronously calculate the disk cache's size.
*/ */
- (void)calculateSizeWithCompletionBlock:(void (^)(NSUInteger fileCount, unsigned long long totalSize))completionBlock; - (void)calculateSizeWithCompletionBlock:(void (^)(NSUInteger fileCount, NSUInteger totalSize))completionBlock;
/** /**
* Check if image exists in cache already * Check if image exists in cache already

View file

@ -10,8 +10,6 @@
#import "SDWebImageDecoder.h" #import "SDWebImageDecoder.h"
#import "UIImage+MultiFormat.h" #import "UIImage+MultiFormat.h"
#import <CommonCrypto/CommonDigest.h> #import <CommonCrypto/CommonDigest.h>
#import <mach/mach.h>
#import <mach/mach_host.h>
static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week
// PNG signature bytes and data (below) // PNG signature bytes and data (below)
@ -19,13 +17,11 @@ static unsigned char kPNGSignatureBytes[8] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A
static NSData *kPNGSignatureData = nil; static NSData *kPNGSignatureData = nil;
BOOL ImageDataHasPNGPreffix(NSData *data); BOOL ImageDataHasPNGPreffix(NSData *data);
BOOL ImageDataHasPNGPreffix(NSData *data)
{ BOOL ImageDataHasPNGPreffix(NSData *data) {
NSUInteger pngSignatureLength = [kPNGSignatureData length]; NSUInteger pngSignatureLength = [kPNGSignatureData length];
if ([data length] >= pngSignatureLength) if ([data length] >= pngSignatureLength) {
{ if ([[data subdataWithRange:NSMakeRange(0, pngSignatureLength)] isEqualToData:kPNGSignatureData]) {
if ([[data subdataWithRange:NSMakeRange(0, pngSignatureLength)] isEqualToData:kPNGSignatureData])
{
return YES; return YES;
} }
} }
@ -43,32 +39,26 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
@end @end
@implementation SDImageCache @implementation SDImageCache {
{
NSFileManager *_fileManager; NSFileManager *_fileManager;
} }
+ (SDImageCache *)sharedImageCache + (SDImageCache *)sharedImageCache {
{
static dispatch_once_t once; static dispatch_once_t once;
static id instance; static id instance;
dispatch_once(&once, ^ dispatch_once(&once, ^{
{ instance = [self new];
instance = self.new;
kPNGSignatureData = [NSData dataWithBytes:kPNGSignatureBytes length:8]; kPNGSignatureData = [NSData dataWithBytes:kPNGSignatureBytes length:8];
}); });
return instance; return instance;
} }
- (id)init - (id)init {
{
return [self initWithNamespace:@"default"]; return [self initWithNamespace:@"default"];
} }
- (id)initWithNamespace:(NSString *)ns - (id)initWithNamespace:(NSString *)ns {
{ if ((self = [super init])) {
if ((self = [super init]))
{
NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns]; NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns];
// Create IO serial queue // Create IO serial queue
@ -85,9 +75,8 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
_diskCachePath = [paths[0] stringByAppendingPathComponent:fullNamespace]; _diskCachePath = [paths[0] stringByAppendingPathComponent:fullNamespace];
dispatch_sync(_ioQueue, ^ dispatch_sync(_ioQueue, ^{
{ _fileManager = [NSFileManager new];
_fileManager = NSFileManager.new;
}); });
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
@ -112,43 +101,35 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
return self; return self;
} }
- (void)dealloc - (void)dealloc {
{
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
SDDispatchQueueRelease(_ioQueue); SDDispatchQueueRelease(_ioQueue);
} }
- (void)addReadOnlyCachePath:(NSString *)path - (void)addReadOnlyCachePath:(NSString *)path {
{ if (!self.customPaths) {
if (!self.customPaths) self.customPaths = [NSMutableArray new];
{
self.customPaths = NSMutableArray.new;
} }
if (![self.customPaths containsObject:path]) if (![self.customPaths containsObject:path]) {
{
[self.customPaths addObject:path]; [self.customPaths addObject:path];
} }
} }
#pragma mark SDImageCache (private) #pragma mark SDImageCache (private)
- (NSString *)cachePathForKey:(NSString *)key inPath:(NSString *)path - (NSString *)cachePathForKey:(NSString *)key inPath:(NSString *)path {
{
NSString *filename = [self cachedFileNameForKey:key]; NSString *filename = [self cachedFileNameForKey:key];
return [path stringByAppendingPathComponent:filename]; return [path stringByAppendingPathComponent:filename];
} }
- (NSString *)defaultCachePathForKey:(NSString *)key - (NSString *)defaultCachePathForKey:(NSString *)key {
{
return [self cachePathForKey:key inPath:self.diskCachePath]; return [self cachePathForKey:key inPath:self.diskCachePath];
} }
- (NSString *)cachedFileNameForKey:(NSString *)key - (NSString *)cachedFileNameForKey:(NSString *)key {
{
const char *str = [key UTF8String]; const char *str = [key UTF8String];
if (str == NULL) if (str == NULL) {
{
str = ""; str = "";
} }
unsigned char r[CC_MD5_DIGEST_LENGTH]; unsigned char r[CC_MD5_DIGEST_LENGTH];
@ -161,23 +142,18 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
#pragma mark ImageCache #pragma mark ImageCache
- (void)storeImage:(UIImage *)image recalculateFromImage:(BOOL)recalculate imageData:(NSData *)imageData forKey:(NSString *)key toDisk:(BOOL)toDisk - (void)storeImage:(UIImage *)image recalculateFromImage:(BOOL)recalculate imageData:(NSData *)imageData forKey:(NSString *)key toDisk:(BOOL)toDisk {
{ if (!image || !key) {
if (!image || !key)
{
return; return;
} }
[self.memCache setObject:image forKey:key cost:image.size.height * image.size.width * image.scale]; [self.memCache setObject:image forKey:key cost:image.size.height * image.size.width * image.scale];
if (toDisk) if (toDisk) {
{ dispatch_async(self.ioQueue, ^{
dispatch_async(self.ioQueue, ^
{
NSData *data = imageData; NSData *data = imageData;
if (image && (recalculate || !data)) if (image && (recalculate || !data)) {
{
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
// We need to determine if the image is a PNG or a JPEG // We need to determine if the image is a PNG or a JPEG
// PNGs are easier to detect because they have a unique signature (http://www.w3.org/TR/PNG-Structure.html) // PNGs are easier to detect because they have a unique signature (http://www.w3.org/TR/PNG-Structure.html)
@ -189,17 +165,14 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
BOOL imageIsPng = YES; BOOL imageIsPng = YES;
// But if we have an image data, we will look at the preffix // But if we have an image data, we will look at the preffix
if ([imageData length] >= [kPNGSignatureData length]) if ([imageData length] >= [kPNGSignatureData length]) {
{
imageIsPng = ImageDataHasPNGPreffix(imageData); imageIsPng = ImageDataHasPNGPreffix(imageData);
} }
if (imageIsPng) if (imageIsPng) {
{
data = UIImagePNGRepresentation(image); data = UIImagePNGRepresentation(image);
} }
else else {
{
data = UIImageJPEGRepresentation(image, (CGFloat)1.0); data = UIImageJPEGRepresentation(image, (CGFloat)1.0);
} }
#else #else
@ -207,13 +180,11 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
#endif #endif
} }
if (data) if (data) {
{
// Can't use defaultManager another thread // Can't use defaultManager another thread
NSFileManager *fileManager = NSFileManager.new; NSFileManager *fileManager = [NSFileManager new];
if (![fileManager fileExistsAtPath:_diskCachePath]) if (![fileManager fileExistsAtPath:_diskCachePath]) {
{
[fileManager createDirectoryAtPath:_diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL]; [fileManager createDirectoryAtPath:_diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL];
} }
@ -223,45 +194,37 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
} }
} }
- (void)storeImage:(UIImage *)image forKey:(NSString *)key - (void)storeImage:(UIImage *)image forKey:(NSString *)key {
{
[self storeImage:image recalculateFromImage:YES imageData:nil forKey:key toDisk:YES]; [self storeImage:image recalculateFromImage:YES imageData:nil forKey:key toDisk:YES];
} }
- (void)storeImage:(UIImage *)image forKey:(NSString *)key toDisk:(BOOL)toDisk - (void)storeImage:(UIImage *)image forKey:(NSString *)key toDisk:(BOOL)toDisk {
{
[self storeImage:image recalculateFromImage:YES imageData:nil forKey:key toDisk:toDisk]; [self storeImage:image recalculateFromImage:YES imageData:nil forKey:key toDisk:toDisk];
} }
- (BOOL)diskImageExistsWithKey:(NSString *)key - (BOOL)diskImageExistsWithKey:(NSString *)key {
{
__block BOOL exists = NO; __block BOOL exists = NO;
dispatch_sync(_ioQueue, ^ dispatch_sync(_ioQueue, ^{
{
exists = [_fileManager fileExistsAtPath:[self defaultCachePathForKey:key]]; exists = [_fileManager fileExistsAtPath:[self defaultCachePathForKey:key]];
}); });
return exists; return exists;
} }
- (UIImage *)imageFromMemoryCacheForKey:(NSString *)key - (UIImage *)imageFromMemoryCacheForKey:(NSString *)key {
{
return [self.memCache objectForKey:key]; return [self.memCache objectForKey:key];
} }
- (UIImage *)imageFromDiskCacheForKey:(NSString *)key - (UIImage *)imageFromDiskCacheForKey:(NSString *)key {
{
// First check the in-memory cache... // First check the in-memory cache...
UIImage *image = [self imageFromMemoryCacheForKey:key]; UIImage *image = [self imageFromMemoryCacheForKey:key];
if (image) if (image) {
{
return image; return image;
} }
// Second check the disk cache... // Second check the disk cache...
UIImage *diskImage = [self diskImageForKey:key]; UIImage *diskImage = [self diskImageForKey:key];
if (diskImage) if (diskImage) {
{
CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale; CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale;
[self.memCache setObject:diskImage forKey:key cost:cost]; [self.memCache setObject:diskImage forKey:key cost:cost];
} }
@ -269,17 +232,14 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
return diskImage; return diskImage;
} }
- (NSData *)diskImageDataBySearchingAllPathsForKey:(NSString *)key - (NSData *)diskImageDataBySearchingAllPathsForKey:(NSString *)key {
{
NSString *defaultPath = [self defaultCachePathForKey:key]; NSString *defaultPath = [self defaultCachePathForKey:key];
NSData *data = [NSData dataWithContentsOfFile:defaultPath]; NSData *data = [NSData dataWithContentsOfFile:defaultPath];
if (data) if (data) {
{
return data; return data;
} }
for (NSString *path in self.customPaths) for (NSString *path in self.customPaths) {
{
NSString *filePath = [self cachePathForKey:key inPath:path]; NSString *filePath = [self cachePathForKey:key inPath:path];
NSData *imageData = [NSData dataWithContentsOfFile:filePath]; NSData *imageData = [NSData dataWithContentsOfFile:filePath];
if (imageData) { if (imageData) {
@ -290,65 +250,53 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
return nil; return nil;
} }
- (UIImage *)diskImageForKey:(NSString *)key - (UIImage *)diskImageForKey:(NSString *)key {
{
NSData *data = [self diskImageDataBySearchingAllPathsForKey:key]; NSData *data = [self diskImageDataBySearchingAllPathsForKey:key];
if (data) if (data) {
{
UIImage *image = [UIImage sd_imageWithData:data]; UIImage *image = [UIImage sd_imageWithData:data];
image = [self scaledImageForKey:key image:image]; image = [self scaledImageForKey:key image:image];
image = [UIImage decodedImageWithImage:image]; image = [UIImage decodedImageWithImage:image];
return image; return image;
} }
else else {
{
return nil; return nil;
} }
} }
- (UIImage *)scaledImageForKey:(NSString *)key image:(UIImage *)image - (UIImage *)scaledImageForKey:(NSString *)key image:(UIImage *)image {
{
return SDScaledImageForKey(key, image); return SDScaledImageForKey(key, image);
} }
- (NSOperation *)queryDiskCacheForKey:(NSString *)key done:(void (^)(UIImage *image, SDImageCacheType cacheType))doneBlock - (NSOperation *)queryDiskCacheForKey:(NSString *)key done:(void (^)(UIImage *image, SDImageCacheType cacheType))doneBlock {
{ NSOperation *operation = [NSOperation new];
NSOperation *operation = NSOperation.new;
if (!doneBlock) return nil; if (!doneBlock) return nil;
if (!key) if (!key) {
{
doneBlock(nil, SDImageCacheTypeNone); doneBlock(nil, SDImageCacheTypeNone);
return nil; return nil;
} }
// First check the in-memory cache... // First check the in-memory cache...
UIImage *image = [self imageFromMemoryCacheForKey:key]; UIImage *image = [self imageFromMemoryCacheForKey:key];
if (image) if (image) {
{
doneBlock(image, SDImageCacheTypeMemory); doneBlock(image, SDImageCacheTypeMemory);
return nil; return nil;
} }
dispatch_async(self.ioQueue, ^ dispatch_async(self.ioQueue, ^{
{ if (operation.isCancelled) {
if (operation.isCancelled)
{
return; return;
} }
@autoreleasepool @autoreleasepool {
{
UIImage *diskImage = [self diskImageForKey:key]; UIImage *diskImage = [self diskImageForKey:key];
if (diskImage) if (diskImage) {
{
CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale; CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale;
[self.memCache setObject:diskImage forKey:key cost:cost]; [self.memCache setObject:diskImage forKey:key cost:cost];
} }
dispatch_main_sync_safe(^ dispatch_main_sync_safe(^{
{
doneBlock(diskImage, SDImageCacheTypeDisk); doneBlock(diskImage, SDImageCacheTypeDisk);
}); });
} }
@ -357,60 +305,59 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
return operation; return operation;
} }
- (void)removeImageForKey:(NSString *)key - (void)removeImageForKey:(NSString *)key {
{
[self removeImageForKey:key fromDisk:YES]; [self removeImageForKey:key fromDisk:YES];
} }
- (void)removeImageForKey:(NSString *)key fromDisk:(BOOL)fromDisk - (void)removeImageForKey:(NSString *)key fromDisk:(BOOL)fromDisk {
{ if (key == nil) {
if (key == nil)
{
return; return;
} }
[self.memCache removeObjectForKey:key]; [self.memCache removeObjectForKey:key];
if (fromDisk) if (fromDisk) {
{ dispatch_async(self.ioQueue, ^{
dispatch_async(self.ioQueue, ^
{
[[NSFileManager defaultManager] removeItemAtPath:[self defaultCachePathForKey:key] error:nil]; [[NSFileManager defaultManager] removeItemAtPath:[self defaultCachePathForKey:key] error:nil];
}); });
} }
} }
- (void)setMaxMemoryCost:(NSUInteger)maxMemoryCost - (void)setMaxMemoryCost:(NSUInteger)maxMemoryCost {
{
self.memCache.totalCostLimit = maxMemoryCost; self.memCache.totalCostLimit = maxMemoryCost;
} }
- (NSUInteger)maxMemoryCost - (NSUInteger)maxMemoryCost {
{
return self.memCache.totalCostLimit; return self.memCache.totalCostLimit;
} }
- (void)clearMemory - (void)clearMemory {
{
[self.memCache removeAllObjects]; [self.memCache removeAllObjects];
} }
- (void)clearDisk - (void)clearDisk {
{ [self clearDiskOnCompletion:nil];
dispatch_async(self.ioQueue, ^ }
- (void)clearDiskOnCompletion:(void (^)())completion
{ {
dispatch_async(self.ioQueue, ^{
[[NSFileManager defaultManager] removeItemAtPath:self.diskCachePath error:nil]; [[NSFileManager defaultManager] removeItemAtPath:self.diskCachePath error:nil];
[[NSFileManager defaultManager] createDirectoryAtPath:self.diskCachePath [[NSFileManager defaultManager] createDirectoryAtPath:self.diskCachePath
withIntermediateDirectories:YES withIntermediateDirectories:YES
attributes:nil attributes:nil
error:NULL]; error:NULL];
if (completion) {
dispatch_main_sync_safe(^{
completion();
});
}
}); });
} }
- (void)cleanDisk - (void)cleanDisk {
{ dispatch_async(self.ioQueue, ^{
dispatch_async(self.ioQueue, ^
{
NSFileManager *fileManager = [NSFileManager defaultManager]; NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES]; NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES];
NSArray *resourceKeys = @[NSURLIsDirectoryKey, NSURLContentModificationDateKey, NSURLTotalFileAllocatedSizeKey]; NSArray *resourceKeys = @[NSURLIsDirectoryKey, NSURLContentModificationDateKey, NSURLTotalFileAllocatedSizeKey];
@ -423,61 +370,53 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow:-self.maxCacheAge]; NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow:-self.maxCacheAge];
NSMutableDictionary *cacheFiles = [NSMutableDictionary dictionary]; NSMutableDictionary *cacheFiles = [NSMutableDictionary dictionary];
unsigned long long currentCacheSize = 0; NSUInteger currentCacheSize = 0;
// Enumerate all of the files in the cache directory. This loop has two purposes: // Enumerate all of the files in the cache directory. This loop has two purposes:
// //
// 1. Removing files that are older than the expiration date. // 1. Removing files that are older than the expiration date.
// 2. Storing file attributes for the size-based cleanup pass. // 2. Storing file attributes for the size-based cleanup pass.
for (NSURL *fileURL in fileEnumerator) for (NSURL *fileURL in fileEnumerator) {
{
NSDictionary *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:NULL]; NSDictionary *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:NULL];
// Skip directories. // Skip directories.
if ([resourceValues[NSURLIsDirectoryKey] boolValue]) if ([resourceValues[NSURLIsDirectoryKey] boolValue]) {
{
continue; continue;
} }
// Remove files that are older than the expiration date; // Remove files that are older than the expiration date;
NSDate *modificationDate = resourceValues[NSURLContentModificationDateKey]; NSDate *modificationDate = resourceValues[NSURLContentModificationDateKey];
if ([[modificationDate laterDate:expirationDate] isEqualToDate:expirationDate]) if ([[modificationDate laterDate:expirationDate] isEqualToDate:expirationDate]) {
{
[fileManager removeItemAtURL:fileURL error:nil]; [fileManager removeItemAtURL:fileURL error:nil];
continue; continue;
} }
// Store a reference to this file and account for its total size. // Store a reference to this file and account for its total size.
NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey]; NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey];
currentCacheSize += [totalAllocatedSize unsignedLongLongValue]; currentCacheSize += [totalAllocatedSize unsignedIntegerValue];
[cacheFiles setObject:resourceValues forKey:fileURL]; [cacheFiles setObject:resourceValues forKey:fileURL];
} }
// If our remaining disk cache exceeds a configured maximum size, perform a second // If our remaining disk cache exceeds a configured maximum size, perform a second
// size-based cleanup pass. We delete the oldest files first. // size-based cleanup pass. We delete the oldest files first.
if (self.maxCacheSize > 0 && currentCacheSize > self.maxCacheSize) if (self.maxCacheSize > 0 && currentCacheSize > self.maxCacheSize) {
{
// Target half of our maximum cache size for this cleanup pass. // Target half of our maximum cache size for this cleanup pass.
const unsigned long long desiredCacheSize = self.maxCacheSize / 2; const NSUInteger desiredCacheSize = self.maxCacheSize / 2;
// Sort the remaining cache files by their last modification time (oldest first). // Sort the remaining cache files by their last modification time (oldest first).
NSArray *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent NSArray *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent
usingComparator:^NSComparisonResult(id obj1, id obj2) usingComparator:^NSComparisonResult(id obj1, id obj2) {
{
return [obj1[NSURLContentModificationDateKey] compare:obj2[NSURLContentModificationDateKey]]; return [obj1[NSURLContentModificationDateKey] compare:obj2[NSURLContentModificationDateKey]];
}]; }];
// Delete files until we fall below our desired cache size. // Delete files until we fall below our desired cache size.
for (NSURL *fileURL in sortedFiles) for (NSURL *fileURL in sortedFiles) {
{ if ([fileManager removeItemAtURL:fileURL error:nil]) {
if ([fileManager removeItemAtURL:fileURL error:nil])
{
NSDictionary *resourceValues = cacheFiles[fileURL]; NSDictionary *resourceValues = cacheFiles[fileURL];
NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey]; NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey];
currentCacheSize -= [totalAllocatedSize unsignedLongLongValue]; currentCacheSize -= [totalAllocatedSize unsignedIntegerValue];
if (currentCacheSize < desiredCacheSize) if (currentCacheSize < desiredCacheSize) {
{
break; break;
} }
} }
@ -486,11 +425,9 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
}); });
} }
- (void)backgroundCleanDisk - (void)backgroundCleanDisk {
{
UIApplication *application = [UIApplication sharedApplication]; UIApplication *application = [UIApplication sharedApplication];
__block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^ __block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
{
// Clean up any unfinished task business by marking where you // Clean up any unfinished task business by marking where you
// stopped or ending the task outright. // stopped or ending the task outright.
[application endBackgroundTask:bgTask]; [application endBackgroundTask:bgTask];
@ -498,8 +435,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
}]; }];
// Start the long-running task and return immediately. // Start the long-running task and return immediately.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
{
// Do the work associated with the task, preferably in chunks. // Do the work associated with the task, preferably in chunks.
[self cleanDisk]; [self cleanDisk];
@ -508,12 +444,10 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
}); });
} }
- (unsigned long long)getSize - (NSUInteger)getSize {
{ NSUInteger size = 0;
unsigned long long size = 0;
NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:self.diskCachePath]; NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:self.diskCachePath];
for (NSString *fileName in fileEnumerator) for (NSString *fileName in fileEnumerator) {
{
NSString *filePath = [self.diskCachePath stringByAppendingPathComponent:fileName]; NSString *filePath = [self.diskCachePath stringByAppendingPathComponent:fileName];
NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil]; NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil];
size += [attrs fileSize]; size += [attrs fileSize];
@ -521,26 +455,22 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
return size; return size;
} }
- (int)getDiskCount - (int)getDiskCount {
{
int count = 0; int count = 0;
NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:self.diskCachePath]; NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:self.diskCachePath];
for (__unused NSString *fileName in fileEnumerator) for (__unused NSString *fileName in fileEnumerator) {
{
count += 1; count += 1;
} }
return count; return count;
} }
- (void)calculateSizeWithCompletionBlock:(void (^)(NSUInteger fileCount, unsigned long long totalSize))completionBlock - (void)calculateSizeWithCompletionBlock:(void (^)(NSUInteger fileCount, NSUInteger totalSize))completionBlock {
{
NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES]; NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES];
dispatch_async(self.ioQueue, ^ dispatch_async(self.ioQueue, ^{
{
NSUInteger fileCount = 0; NSUInteger fileCount = 0;
unsigned long long totalSize = 0; NSUInteger totalSize = 0;
NSFileManager *fileManager = [NSFileManager defaultManager]; NSFileManager *fileManager = [NSFileManager defaultManager];
NSDirectoryEnumerator *fileEnumerator = [fileManager enumeratorAtURL:diskCacheURL NSDirectoryEnumerator *fileEnumerator = [fileManager enumeratorAtURL:diskCacheURL
@ -548,18 +478,15 @@ BOOL ImageDataHasPNGPreffix(NSData *data)
options:NSDirectoryEnumerationSkipsHiddenFiles options:NSDirectoryEnumerationSkipsHiddenFiles
errorHandler:NULL]; errorHandler:NULL];
for (NSURL *fileURL in fileEnumerator) for (NSURL *fileURL in fileEnumerator) {
{
NSNumber *fileSize; NSNumber *fileSize;
[fileURL getResourceValue:&fileSize forKey:NSURLFileSizeKey error:NULL]; [fileURL getResourceValue:&fileSize forKey:NSURLFileSizeKey error:NULL];
totalSize += [fileSize unsignedLongLongValue]; totalSize += [fileSize unsignedIntegerValue];
fileCount += 1; fileCount += 1;
} }
if (completionBlock) if (completionBlock) {
{ dispatch_main_sync_safe(^{
dispatch_main_sync_safe(^
{
completionBlock(fileCount, totalSize); completionBlock(fileCount, totalSize);
}); });
} }

View file

@ -26,7 +26,17 @@
#define UIImageView NSImageView #define UIImageView NSImageView
#endif #endif
#else #else
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif
#ifndef NS_ENUM
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#endif
#ifndef NS_OPTIONS
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
#endif #endif
#if OS_OBJECT_USE_OBJC #if OS_OBJECT_USE_OBJC

View file

@ -12,30 +12,23 @@
#error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
#endif #endif
inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) {
{ if ([image.images count] > 0) {
if ([image.images count] > 0)
{
NSMutableArray *scaledImages = [NSMutableArray array]; NSMutableArray *scaledImages = [NSMutableArray array];
for (UIImage *tempImage in image.images) for (UIImage *tempImage in image.images) {
{
[scaledImages addObject:SDScaledImageForKey(key, tempImage)]; [scaledImages addObject:SDScaledImageForKey(key, tempImage)];
} }
return [UIImage animatedImageWithImages:scaledImages duration:image.duration]; return [UIImage animatedImageWithImages:scaledImages duration:image.duration];
} }
else else {
{ if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
{
CGFloat scale = 1.0; CGFloat scale = 1.0;
if (key.length >= 8) if (key.length >= 8) {
{
// Search @2x. at the end of the string, before a 3 to 4 extension length (only if key len is 8 or more @2x. + 4 len ext) // Search @2x. at the end of the string, before a 3 to 4 extension length (only if key len is 8 or more @2x. + 4 len ext)
NSRange range = [key rangeOfString:@"@2x." options:0 range:NSMakeRange(key.length - 8, 5)]; NSRange range = [key rangeOfString:@"@2x." options:0 range:NSMakeRange(key.length - 8, 5)];
if (range.location != NSNotFound) if (range.location != NSNotFound) {
{
scale = 2.0; scale = 2.0;
} }
} }

View file

@ -12,10 +12,8 @@
@implementation UIImage (ForceDecode) @implementation UIImage (ForceDecode)
+ (UIImage *)decodedImageWithImage:(UIImage *)image + (UIImage *)decodedImageWithImage:(UIImage *)image {
{ if (image.images) {
if (image.images)
{
// Do not decode animated images // Do not decode animated images
return image; return image;
} }
@ -34,8 +32,7 @@
// CGBitmapContextCreate doesn't support kCGImageAlphaNone with RGB. // CGBitmapContextCreate doesn't support kCGImageAlphaNone with RGB.
// https://developer.apple.com/library/mac/#qa/qa1037/_index.html // https://developer.apple.com/library/mac/#qa/qa1037/_index.html
if (infoMask == kCGImageAlphaNone && CGColorSpaceGetNumberOfComponents(colorSpace) > 1) if (infoMask == kCGImageAlphaNone && CGColorSpaceGetNumberOfComponents(colorSpace) > 1) {
{
// Unset the old alpha info. // Unset the old alpha info.
bitmapInfo &= ~kCGBitmapAlphaInfoMask; bitmapInfo &= ~kCGBitmapAlphaInfoMask;
@ -43,8 +40,7 @@
bitmapInfo |= kCGImageAlphaNoneSkipFirst; bitmapInfo |= kCGImageAlphaNoneSkipFirst;
} }
// Some PNGs tell us they have alpha but only 3 components. Odd. // Some PNGs tell us they have alpha but only 3 components. Odd.
else if (!anyNonAlpha && CGColorSpaceGetNumberOfComponents(colorSpace) == 3) else if (!anyNonAlpha && CGColorSpaceGetNumberOfComponents(colorSpace) == 3) {
{
// Unset the old alpha info. // Unset the old alpha info.
bitmapInfo &= ~kCGBitmapAlphaInfoMask; bitmapInfo &= ~kCGBitmapAlphaInfoMask;
bitmapInfo |= kCGImageAlphaPremultipliedFirst; bitmapInfo |= kCGImageAlphaPremultipliedFirst;

View file

@ -10,8 +10,7 @@
#import "SDWebImageCompat.h" #import "SDWebImageCompat.h"
#import "SDWebImageOperation.h" #import "SDWebImageOperation.h"
typedef enum typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
{
SDWebImageDownloaderLowPriority = 1 << 0, SDWebImageDownloaderLowPriority = 1 << 0,
SDWebImageDownloaderProgressiveDownload = 1 << 1, SDWebImageDownloaderProgressiveDownload = 1 << 1,
/** /**
@ -40,10 +39,9 @@ typedef enum
*/ */
SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6 SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6
} SDWebImageDownloaderOptions; };
typedef enum typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {
{
SDWebImageDownloaderFIFOExecutionOrder, SDWebImageDownloaderFIFOExecutionOrder,
/** /**
* Default value. All download operations will execute in queue style (first-in-first-out). * Default value. All download operations will execute in queue style (first-in-first-out).
@ -52,12 +50,13 @@ typedef enum
/** /**
* All download operations will execute in stack style (last-in-first-out). * All download operations will execute in stack style (last-in-first-out).
*/ */
} SDWebImageDownloaderExecutionOrder; };
extern NSString *const SDWebImageDownloadStartNotification; extern NSString *const SDWebImageDownloadStartNotification;
extern NSString *const SDWebImageDownloadStopNotification; extern NSString *const SDWebImageDownloadStopNotification;
typedef void(^SDWebImageDownloaderProgressBlock)(NSUInteger receivedSize, long long expectedSize); typedef void(^SDWebImageDownloaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize);
typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage *image, NSData *data, NSError *error, BOOL finished); typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage *image, NSData *data, NSError *error, BOOL finished);
/** /**

View file

@ -29,12 +29,10 @@ static NSString *const kCompletedCallbackKey = @"completed";
@implementation SDWebImageDownloader @implementation SDWebImageDownloader
+ (void)initialize + (void)initialize {
{
// Bind SDNetworkActivityIndicator if available (download it here: http://github.com/rs/SDNetworkActivityIndicator ) // Bind SDNetworkActivityIndicator if available (download it here: http://github.com/rs/SDNetworkActivityIndicator )
// To use it, just add #import "SDNetworkActivityIndicator.h" in addition to the SDWebImage import // To use it, just add #import "SDNetworkActivityIndicator.h" in addition to the SDWebImage import
if (NSClassFromString(@"SDNetworkActivityIndicator")) if (NSClassFromString(@"SDNetworkActivityIndicator")) {
{
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks" #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
@ -54,22 +52,21 @@ static NSString *const kCompletedCallbackKey = @"completed";
} }
} }
+ (SDWebImageDownloader *)sharedDownloader + (SDWebImageDownloader *)sharedDownloader {
{
static dispatch_once_t once; static dispatch_once_t once;
static id instance; static id instance;
dispatch_once(&once, ^{instance = self.new;}); dispatch_once(&once, ^{
instance = [self new];
});
return instance; return instance;
} }
- (id)init - (id)init {
{ if ((self = [super init])) {
if ((self = [super init]))
{
_executionOrder = SDWebImageDownloaderFIFOExecutionOrder; _executionOrder = SDWebImageDownloaderFIFOExecutionOrder;
_downloadQueue = NSOperationQueue.new; _downloadQueue = [NSOperationQueue new];
_downloadQueue.maxConcurrentOperationCount = 2; _downloadQueue.maxConcurrentOperationCount = 2;
_URLCallbacks = NSMutableDictionary.new; _URLCallbacks = [NSMutableDictionary new];
_HTTPHeaders = [NSMutableDictionary dictionaryWithObject:@"image/webp,image/*;q=0.8" forKey:@"Accept"]; _HTTPHeaders = [NSMutableDictionary dictionaryWithObject:@"image/webp,image/*;q=0.8" forKey:@"Accept"];
_barrierQueue = dispatch_queue_create("com.hackemist.SDWebImageDownloaderBarrierQueue", DISPATCH_QUEUE_CONCURRENT); _barrierQueue = dispatch_queue_create("com.hackemist.SDWebImageDownloaderBarrierQueue", DISPATCH_QUEUE_CONCURRENT);
_downloadTimeout = 15.0; _downloadTimeout = 15.0;
@ -77,103 +74,87 @@ static NSString *const kCompletedCallbackKey = @"completed";
return self; return self;
} }
- (void)dealloc - (void)dealloc {
{
[self.downloadQueue cancelAllOperations]; [self.downloadQueue cancelAllOperations];
SDDispatchQueueRelease(_barrierQueue); SDDispatchQueueRelease(_barrierQueue);
} }
- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field - (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field {
{ if (value) {
if (value)
{
self.HTTPHeaders[field] = value; self.HTTPHeaders[field] = value;
} }
else else {
{
[self.HTTPHeaders removeObjectForKey:field]; [self.HTTPHeaders removeObjectForKey:field];
} }
} }
- (NSString *)valueForHTTPHeaderField:(NSString *)field - (NSString *)valueForHTTPHeaderField:(NSString *)field {
{
return self.HTTPHeaders[field]; return self.HTTPHeaders[field];
} }
- (void)setMaxConcurrentDownloads:(NSInteger)maxConcurrentDownloads - (void)setMaxConcurrentDownloads:(NSInteger)maxConcurrentDownloads {
{
_downloadQueue.maxConcurrentOperationCount = maxConcurrentDownloads; _downloadQueue.maxConcurrentOperationCount = maxConcurrentDownloads;
} }
- (NSUInteger)currentDownloadCount - (NSUInteger)currentDownloadCount {
{
return _downloadQueue.operationCount; return _downloadQueue.operationCount;
} }
- (NSInteger)maxConcurrentDownloads - (NSInteger)maxConcurrentDownloads {
{
return _downloadQueue.maxConcurrentOperationCount; return _downloadQueue.maxConcurrentOperationCount;
} }
- (id<SDWebImageOperation>)downloadImageWithURL:(NSURL *)url options:(SDWebImageDownloaderOptions)options progress:(void (^)(NSUInteger, long long))progressBlock completed:(void (^)(UIImage *, NSData *, NSError *, BOOL))completedBlock - (id <SDWebImageOperation>)downloadImageWithURL:(NSURL *)url options:(SDWebImageDownloaderOptions)options progress:(void (^)(NSInteger, NSInteger))progressBlock completed:(void (^)(UIImage *, NSData *, NSError *, BOOL))completedBlock {
{
__block SDWebImageDownloaderOperation *operation; __block SDWebImageDownloaderOperation *operation;
__weak SDWebImageDownloader *wself = self; __weak SDWebImageDownloader *wself = self;
[self addProgressCallback:progressBlock andCompletedBlock:completedBlock forURL:url createCallback:^ [self addProgressCallback:progressBlock andCompletedBlock:completedBlock forURL:url createCallback:^{
{
NSTimeInterval timeoutInterval = wself.downloadTimeout; NSTimeInterval timeoutInterval = wself.downloadTimeout;
if (timeoutInterval == 0.0) { if (timeoutInterval == 0.0) {
timeoutInterval = 15.0; timeoutInterval = 15.0;
} }
// In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise
NSMutableURLRequest *request = [NSMutableURLRequest.alloc initWithURL:url cachePolicy:(options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData) timeoutInterval:timeoutInterval]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:(options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData) timeoutInterval:timeoutInterval];
request.HTTPShouldHandleCookies = (options & SDWebImageDownloaderHandleCookies); request.HTTPShouldHandleCookies = (options & SDWebImageDownloaderHandleCookies);
request.HTTPShouldUsePipelining = YES; request.HTTPShouldUsePipelining = YES;
if (wself.headersFilter) if (wself.headersFilter) {
{
request.allHTTPHeaderFields = wself.headersFilter(url, [wself.HTTPHeaders copy]); request.allHTTPHeaderFields = wself.headersFilter(url, [wself.HTTPHeaders copy]);
} }
else else {
{
request.allHTTPHeaderFields = wself.HTTPHeaders; request.allHTTPHeaderFields = wself.HTTPHeaders;
} }
operation = [SDWebImageDownloaderOperation.alloc initWithRequest:request options:options progress:^(NSUInteger receivedSize, long long expectedSize) operation = [[SDWebImageDownloaderOperation alloc] initWithRequest:request
{ options:options
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
if (!wself) return; if (!wself) return;
SDWebImageDownloader *sself = wself; SDWebImageDownloader *sself = wself;
NSArray *callbacksForURL = [sself callbacksForURL:url]; NSArray *callbacksForURL = [sself callbacksForURL:url];
for (NSDictionary *callbacks in callbacksForURL) for (NSDictionary *callbacks in callbacksForURL) {
{
SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey]; SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey];
if (callback) callback(receivedSize, expectedSize); if (callback) callback(receivedSize, expectedSize);
} }
} }
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
{
if (!wself) return; if (!wself) return;
SDWebImageDownloader *sself = wself; SDWebImageDownloader *sself = wself;
NSArray *callbacksForURL = [sself callbacksForURL:url]; NSArray *callbacksForURL = [sself callbacksForURL:url];
if (finished) if (finished) {
{
[sself removeCallbacksForURL:url]; [sself removeCallbacksForURL:url];
} }
for (NSDictionary *callbacks in callbacksForURL) for (NSDictionary *callbacks in callbacksForURL) {
{
SDWebImageDownloaderCompletedBlock callback = callbacks[kCompletedCallbackKey]; SDWebImageDownloaderCompletedBlock callback = callbacks[kCompletedCallbackKey];
if (callback) callback(image, data, error, finished); if (callback) callback(image, data, error, finished);
} }
} }
cancelled:^ cancelled:^{
{
if (!wself) return; if (!wself) return;
SDWebImageDownloader *sself = wself; SDWebImageDownloader *sself = wself;
[sself removeCallbacksForURL:url]; [sself removeCallbacksForURL:url];
}]; }];
[wself.downloadQueue addOperation:operation]; [wself.downloadQueue addOperation:operation];
if (wself.executionOrder == SDWebImageDownloaderLIFOExecutionOrder) if (wself.executionOrder == SDWebImageDownloaderLIFOExecutionOrder) {
{
// Emulate LIFO execution order by systematically adding new operations as last operation's dependency // Emulate LIFO execution order by systematically adding new operations as last operation's dependency
[wself.lastAddedOperation addDependency:operation]; [wself.lastAddedOperation addDependency:operation];
wself.lastAddedOperation = operation; wself.lastAddedOperation = operation;
@ -183,56 +164,46 @@ static NSString *const kCompletedCallbackKey = @"completed";
return operation; return operation;
} }
- (void)addProgressCallback:(void (^)(NSUInteger, long long))progressBlock andCompletedBlock:(void (^)(UIImage *, NSData *data, NSError *, BOOL))completedBlock forURL:(NSURL *)url createCallback:(void (^)())createCallback - (void)addProgressCallback:(void (^)(NSInteger, NSInteger))progressBlock andCompletedBlock:(void (^)(UIImage *, NSData *data, NSError *, BOOL))completedBlock forURL:(NSURL *)url createCallback:(void (^)())createCallback {
{
// The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data. // The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data.
if(url == nil) if (url == nil) {
{ if (completedBlock != nil) {
if (completedBlock != nil)
{
completedBlock(nil, nil, nil, NO); completedBlock(nil, nil, nil, NO);
} }
return; return;
} }
dispatch_barrier_sync(self.barrierQueue, ^ dispatch_barrier_sync(self.barrierQueue, ^{
{
BOOL first = NO; BOOL first = NO;
if (!self.URLCallbacks[url]) if (!self.URLCallbacks[url]) {
{ self.URLCallbacks[url] = [NSMutableArray new];
self.URLCallbacks[url] = NSMutableArray.new;
first = YES; first = YES;
} }
// Handle single download of simultaneous download request for the same URL // Handle single download of simultaneous download request for the same URL
NSMutableArray *callbacksForURL = self.URLCallbacks[url]; NSMutableArray *callbacksForURL = self.URLCallbacks[url];
NSMutableDictionary *callbacks = NSMutableDictionary.new; NSMutableDictionary *callbacks = [NSMutableDictionary new];
if (progressBlock) callbacks[kProgressCallbackKey] = [progressBlock copy]; if (progressBlock) callbacks[kProgressCallbackKey] = [progressBlock copy];
if (completedBlock) callbacks[kCompletedCallbackKey] = [completedBlock copy]; if (completedBlock) callbacks[kCompletedCallbackKey] = [completedBlock copy];
[callbacksForURL addObject:callbacks]; [callbacksForURL addObject:callbacks];
self.URLCallbacks[url] = callbacksForURL; self.URLCallbacks[url] = callbacksForURL;
if (first) if (first) {
{
createCallback(); createCallback();
} }
}); });
} }
- (NSArray *)callbacksForURL:(NSURL *)url - (NSArray *)callbacksForURL:(NSURL *)url {
{
__block NSArray *callbacksForURL; __block NSArray *callbacksForURL;
dispatch_sync(self.barrierQueue, ^ dispatch_sync(self.barrierQueue, ^{
{
callbacksForURL = self.URLCallbacks[url]; callbacksForURL = self.URLCallbacks[url];
}); });
return [callbacksForURL copy]; return [callbacksForURL copy];
} }
- (void)removeCallbacksForURL:(NSURL *)url - (void)removeCallbacksForURL:(NSURL *)url {
{ dispatch_barrier_async(self.barrierQueue, ^{
dispatch_barrier_async(self.barrierQueue, ^
{
[self.URLCallbacks removeObjectForKey:url]; [self.URLCallbacks removeObjectForKey:url];
}); });
} }

View file

@ -19,7 +19,7 @@
@property (assign, nonatomic, getter = isExecuting) BOOL executing; @property (assign, nonatomic, getter = isExecuting) BOOL executing;
@property (assign, nonatomic, getter = isFinished) BOOL finished; @property (assign, nonatomic, getter = isFinished) BOOL finished;
@property (assign, nonatomic) long long expectedSize; @property (assign, nonatomic) NSInteger expectedSize;
@property (strong, nonatomic) NSMutableData *imageData; @property (strong, nonatomic) NSMutableData *imageData;
@property (strong, nonatomic) NSURLConnection *connection; @property (strong, nonatomic) NSURLConnection *connection;
@property (strong, atomic) NSThread *thread; @property (strong, atomic) NSThread *thread;
@ -30,16 +30,14 @@
@end @end
@implementation SDWebImageDownloaderOperation @implementation SDWebImageDownloaderOperation {
{
size_t width, height; size_t width, height;
UIImageOrientation orientation;
BOOL responseFromCached; BOOL responseFromCached;
} }
- (id)initWithRequest:(NSURLRequest *)request options:(SDWebImageDownloaderOptions)options progress:(void (^)(NSUInteger, long long))progressBlock completed:(void (^)(UIImage *, NSData *, NSError *, BOOL))completedBlock cancelled:(void (^)())cancelBlock - (id)initWithRequest:(NSURLRequest *)request options:(SDWebImageDownloaderOptions)options progress:(void (^)(NSInteger, NSInteger))progressBlock completed:(void (^)(UIImage *, NSData *, NSError *, BOOL))completedBlock cancelled:(void (^)())cancelBlock {
{ if ((self = [super init])) {
if ((self = [super init]))
{
_request = request; _request = request;
_options = options; _options = options;
_progressBlock = [progressBlock copy]; _progressBlock = [progressBlock copy];
@ -53,27 +51,21 @@
return self; return self;
} }
- (void)start - (void)start {
{ @synchronized (self) {
@synchronized(self) if (self.isCancelled) {
{
if (self.isCancelled)
{
self.finished = YES; self.finished = YES;
[self reset]; [self reset];
return; return;
} }
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
if ([self shouldContinueWhenAppEntersBackground]) if ([self shouldContinueWhenAppEntersBackground]) {
{
__weak __typeof__ (self) wself = self; __weak __typeof__ (self) wself = self;
self.backgroundTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^ self.backgroundTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
{
__strong __typeof (wself) sself = wself; __strong __typeof (wself) sself = wself;
if (sself) if (sself) {
{
[sself cancel]; [sself cancel];
[[UIApplication sharedApplication] endBackgroundTask:sself.backgroundTaskId]; [[UIApplication sharedApplication] endBackgroundTask:sself.backgroundTaskId];
@ -84,76 +76,62 @@
#endif #endif
self.executing = YES; self.executing = YES;
self.connection = [NSURLConnection.alloc initWithRequest:self.request delegate:self startImmediately:NO]; self.connection = [[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO];
self.thread = [NSThread currentThread]; self.thread = [NSThread currentThread];
} }
[self.connection start]; [self.connection start];
if (self.connection) if (self.connection) {
{ if (self.progressBlock) {
if (self.progressBlock) self.progressBlock(0, NSURLResponseUnknownLength);
{
self.progressBlock(0, -1);
} }
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:self]; [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:self];
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_5_1) if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_5_1) {
{
// Make sure to run the runloop in our background thread so it can process downloaded data // Make sure to run the runloop in our background thread so it can process downloaded data
// Note: we use a timeout to work around an issue with NSURLConnection cancel under iOS 5 // Note: we use a timeout to work around an issue with NSURLConnection cancel under iOS 5
// not waking up the runloop, leading to dead threads (see https://github.com/rs/SDWebImage/issues/466) // not waking up the runloop, leading to dead threads (see https://github.com/rs/SDWebImage/issues/466)
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 10, false); CFRunLoopRunInMode(kCFRunLoopDefaultMode, 10, false);
} }
else else {
{
CFRunLoopRun(); CFRunLoopRun();
} }
if (!self.isFinished) if (!self.isFinished) {
{
[self.connection cancel]; [self.connection cancel];
[self connection:self.connection didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorTimedOut userInfo:@{NSURLErrorFailingURLErrorKey : self.request.URL}]]; [self connection:self.connection didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorTimedOut userInfo:@{NSURLErrorFailingURLErrorKey : self.request.URL}]];
} }
} }
else else {
{ if (self.completedBlock) {
if (self.completedBlock)
{
self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Connection can't be initialized"}], YES); self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Connection can't be initialized"}], YES);
} }
} }
} }
- (void)cancel - (void)cancel {
{ @synchronized (self) {
@synchronized(self) if (self.thread) {
{
if (self.thread)
{
[self performSelector:@selector(cancelInternalAndStop) onThread:self.thread withObject:nil waitUntilDone:NO]; [self performSelector:@selector(cancelInternalAndStop) onThread:self.thread withObject:nil waitUntilDone:NO];
} }
else else {
{
[self cancelInternal]; [self cancelInternal];
} }
} }
} }
- (void)cancelInternalAndStop - (void)cancelInternalAndStop {
{
[self cancelInternal]; [self cancelInternal];
CFRunLoopStop(CFRunLoopGetCurrent()); CFRunLoopStop(CFRunLoopGetCurrent());
} }
- (void)cancelInternal - (void)cancelInternal {
{
if (self.isFinished) return; if (self.isFinished) return;
[super cancel]; [super cancel];
if (self.cancelBlock) self.cancelBlock(); if (self.cancelBlock) self.cancelBlock();
if (self.connection) if (self.connection) {
{
[self.connection cancel]; [self.connection cancel];
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:self]; [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:self];
@ -166,15 +144,13 @@
[self reset]; [self reset];
} }
- (void)done - (void)done {
{
self.finished = YES; self.finished = YES;
self.executing = NO; self.executing = NO;
[self reset]; [self reset];
} }
- (void)reset - (void)reset {
{
self.cancelBlock = nil; self.cancelBlock = nil;
self.completedBlock = nil; self.completedBlock = nil;
self.progressBlock = nil; self.progressBlock = nil;
@ -183,48 +159,40 @@
self.thread = nil; self.thread = nil;
} }
- (void)setFinished:(BOOL)finished - (void)setFinished:(BOOL)finished {
{
[self willChangeValueForKey:@"isFinished"]; [self willChangeValueForKey:@"isFinished"];
_finished = finished; _finished = finished;
[self didChangeValueForKey:@"isFinished"]; [self didChangeValueForKey:@"isFinished"];
} }
- (void)setExecuting:(BOOL)executing - (void)setExecuting:(BOOL)executing {
{
[self willChangeValueForKey:@"isExecuting"]; [self willChangeValueForKey:@"isExecuting"];
_executing = executing; _executing = executing;
[self didChangeValueForKey:@"isExecuting"]; [self didChangeValueForKey:@"isExecuting"];
} }
- (BOOL)isConcurrent - (BOOL)isConcurrent {
{
return YES; return YES;
} }
#pragma mark NSURLConnection (delegate) #pragma mark NSURLConnection (delegate)
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
{ if (![response respondsToSelector:@selector(statusCode)] || [((NSHTTPURLResponse *)response) statusCode] < 400) {
if (![response respondsToSelector:@selector(statusCode)] || [((NSHTTPURLResponse *)response) statusCode] < 400) NSInteger expected = response.expectedContentLength > 0 ? (NSInteger)response.expectedContentLength : 0;
{
NSUInteger expected = response.expectedContentLength > 0 ? (NSUInteger)response.expectedContentLength : 0;
self.expectedSize = expected; self.expectedSize = expected;
if (self.progressBlock) if (self.progressBlock) {
{
self.progressBlock(0, expected); self.progressBlock(0, expected);
} }
self.imageData = [NSMutableData.alloc initWithCapacity:expected]; self.imageData = [[NSMutableData alloc] initWithCapacity:expected];
} }
else else {
{
[self.connection cancel]; [self.connection cancel];
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil];
if (self.completedBlock) if (self.completedBlock) {
{
self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:[((NSHTTPURLResponse *)response) statusCode] userInfo:nil], YES); self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:[((NSHTTPURLResponse *)response) statusCode] userInfo:nil], YES);
} }
@ -232,73 +200,72 @@
} }
} }
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
{
[self.imageData appendData:data]; [self.imageData appendData:data];
if ((self.options & SDWebImageDownloaderProgressiveDownload) && self.expectedSize > 0 && self.completedBlock) if ((self.options & SDWebImageDownloaderProgressiveDownload) && self.expectedSize > 0 && self.completedBlock) {
{
// The following code is from http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/ // The following code is from http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/
// Thanks to the author @Nyx0uf // Thanks to the author @Nyx0uf
// Get the total bytes downloaded // Get the total bytes downloaded
const NSUInteger totalSize = self.imageData.length; const NSInteger totalSize = self.imageData.length;
// Update the data source, we must pass ALL the data, not just the new bytes // Update the data source, we must pass ALL the data, not just the new bytes
CGImageSourceRef imageSource = CGImageSourceCreateIncremental(NULL); CGImageSourceRef imageSource = CGImageSourceCreateIncremental(NULL);
CGImageSourceUpdateData(imageSource, (__bridge CFDataRef)self.imageData, totalSize == self.expectedSize); CGImageSourceUpdateData(imageSource, (__bridge CFDataRef)self.imageData, totalSize == self.expectedSize);
if (width + height == 0) if (width + height == 0) {
{
CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL); CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL);
if (properties) if (properties) {
{ NSInteger orientationValue = -1;
CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight); CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight);
if (val) CFNumberGetValue(val, kCFNumberLongType, &height); if (val) CFNumberGetValue(val, kCFNumberLongType, &height);
val = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth); val = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth);
if (val) CFNumberGetValue(val, kCFNumberLongType, &width); if (val) CFNumberGetValue(val, kCFNumberLongType, &width);
val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation);
if (val) CFNumberGetValue(val, kCFNumberNSIntegerType, &orientationValue);
CFRelease(properties); CFRelease(properties);
}
// When we draw to Core Graphics, we lose orientation information,
// which means the image below born of initWithCGIImage will be
// oriented incorrectly sometimes. (Unlike the image born of initWithData
// in connectionDidFinishLoading.) So save it here and pass it on later.
orientation = [[self class] orientationFromPropertyValue:(orientationValue == -1 ? 1 : orientationValue)];
} }
if (width + height > 0 && totalSize < self.expectedSize) }
{
if (width + height > 0 && totalSize < self.expectedSize) {
// Create the image // Create the image
CGImageRef partialImageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL); CGImageRef partialImageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL);
#ifdef TARGET_OS_IPHONE #ifdef TARGET_OS_IPHONE
// Workaround for iOS anamorphic image // Workaround for iOS anamorphic image
if (partialImageRef) if (partialImageRef) {
{
const size_t partialHeight = CGImageGetHeight(partialImageRef); const size_t partialHeight = CGImageGetHeight(partialImageRef);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef bmContext = CGBitmapContextCreate(NULL, width, height, 8, width * 4, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst); CGContextRef bmContext = CGBitmapContextCreate(NULL, width, height, 8, width * 4, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
CGColorSpaceRelease(colorSpace); CGColorSpaceRelease(colorSpace);
if (bmContext) if (bmContext) {
{
CGContextDrawImage(bmContext, (CGRect){.origin.x = 0.0f, .origin.y = 0.0f, .size.width = width, .size.height = partialHeight}, partialImageRef); CGContextDrawImage(bmContext, (CGRect){.origin.x = 0.0f, .origin.y = 0.0f, .size.width = width, .size.height = partialHeight}, partialImageRef);
CGImageRelease(partialImageRef); CGImageRelease(partialImageRef);
partialImageRef = CGBitmapContextCreateImage(bmContext); partialImageRef = CGBitmapContextCreateImage(bmContext);
CGContextRelease(bmContext); CGContextRelease(bmContext);
} }
else else {
{
CGImageRelease(partialImageRef); CGImageRelease(partialImageRef);
partialImageRef = nil; partialImageRef = nil;
} }
} }
#endif #endif
if (partialImageRef) if (partialImageRef) {
{ UIImage *image = [UIImage imageWithCGImage:partialImageRef scale:1 orientation:orientation];
UIImage *image = [UIImage imageWithCGImage:partialImageRef];
UIImage *scaledImage = [self scaledImageForKey:self.request.URL.absoluteString image:image]; UIImage *scaledImage = [self scaledImageForKey:self.request.URL.absoluteString image:image];
image = [UIImage decodedImageWithImage:scaledImage]; image = [UIImage decodedImageWithImage:scaledImage];
CGImageRelease(partialImageRef); CGImageRelease(partialImageRef);
dispatch_main_sync_safe(^ dispatch_main_sync_safe(^{
{ if (self.completedBlock) {
if (self.completedBlock)
{
self.completedBlock(image, nil, nil, NO); self.completedBlock(image, nil, nil, NO);
} }
}); });
@ -308,19 +275,39 @@
CFRelease(imageSource); CFRelease(imageSource);
} }
if (self.progressBlock) if (self.progressBlock) {
{
self.progressBlock(self.imageData.length, self.expectedSize); self.progressBlock(self.imageData.length, self.expectedSize);
} }
} }
- (UIImage *)scaledImageForKey:(NSString *)key image:(UIImage *)image + (UIImageOrientation)orientationFromPropertyValue:(NSInteger)value {
{ switch (value) {
case 1:
return UIImageOrientationUp;
case 3:
return UIImageOrientationDown;
case 8:
return UIImageOrientationLeft;
case 6:
return UIImageOrientationRight;
case 2:
return UIImageOrientationUpMirrored;
case 4:
return UIImageOrientationDownMirrored;
case 5:
return UIImageOrientationLeftMirrored;
case 7:
return UIImageOrientationRightMirrored;
default:
return UIImageOrientationUp;
}
}
- (UIImage *)scaledImageForKey:(NSString *)key image:(UIImage *)image {
return SDScaledImageForKey(key, image); return SDScaledImageForKey(key, image);
} }
- (void)connectionDidFinishLoading:(NSURLConnection *)aConnection - (void)connectionDidFinishLoading:(NSURLConnection *)aConnection {
{
CFRunLoopStop(CFRunLoopGetCurrent()); CFRunLoopStop(CFRunLoopGetCurrent());
self.connection = nil; self.connection = nil;
@ -328,16 +315,13 @@
SDWebImageDownloaderCompletedBlock completionBlock = self.completedBlock; SDWebImageDownloaderCompletedBlock completionBlock = self.completedBlock;
if (completionBlock) if (completionBlock) {
{ if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached) {
if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached)
{
completionBlock(nil, nil, nil, YES); completionBlock(nil, nil, nil, YES);
self.completionBlock = nil; self.completionBlock = nil;
[self done]; [self done];
} }
else else {
{
UIImage *image = [UIImage sd_imageWithData:self.imageData]; UIImage *image = [UIImage sd_imageWithData:self.imageData];
@ -348,66 +332,54 @@
image = [UIImage decodedImageWithImage:image]; image = [UIImage decodedImageWithImage:image];
} }
if (CGSizeEqualToSize(image.size, CGSizeZero)) if (CGSizeEqualToSize(image.size, CGSizeZero)) {
{
completionBlock(nil, nil, [NSError errorWithDomain:@"SDWebImageErrorDomain" code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}], YES); completionBlock(nil, nil, [NSError errorWithDomain:@"SDWebImageErrorDomain" code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}], YES);
} }
else else {
{
completionBlock(image, self.imageData, nil, YES); completionBlock(image, self.imageData, nil, YES);
} }
self.completionBlock = nil; self.completionBlock = nil;
[self done]; [self done];
} }
} }
else else {
{
[self done]; [self done];
} }
} }
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
{
CFRunLoopStop(CFRunLoopGetCurrent()); CFRunLoopStop(CFRunLoopGetCurrent());
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil];
if (self.completedBlock) if (self.completedBlock) {
{
self.completedBlock(nil, nil, error, YES); self.completedBlock(nil, nil, error, YES);
} }
[self done]; [self done];
} }
- (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse - (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse {
{
responseFromCached = NO; // If this method is called, it means the response wasn't read from cache responseFromCached = NO; // If this method is called, it means the response wasn't read from cache
if (self.request.cachePolicy == NSURLRequestReloadIgnoringLocalCacheData) if (self.request.cachePolicy == NSURLRequestReloadIgnoringLocalCacheData) {
{
// Prevents caching of responses // Prevents caching of responses
return nil; return nil;
} }
else else {
{
return cachedResponse; return cachedResponse;
} }
} }
- (BOOL)shouldContinueWhenAppEntersBackground - (BOOL)shouldContinueWhenAppEntersBackground {
{
return self.options & SDWebImageDownloaderContinueInBackground; return self.options & SDWebImageDownloaderContinueInBackground;
} }
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
{
return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]; return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
} }
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
{
BOOL trustAllCertificates = (self.options & SDWebImageDownloaderAllowInvalidSSLCertificates); BOOL trustAllCertificates = (self.options & SDWebImageDownloaderAllowInvalidSSLCertificates);
if (trustAllCertificates && [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) if (trustAllCertificates && [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
{
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]
forAuthenticationChallenge:challenge]; forAuthenticationChallenge:challenge];
} }

View file

@ -11,8 +11,7 @@
#import "SDWebImageDownloader.h" #import "SDWebImageDownloader.h"
#import "SDImageCache.h" #import "SDImageCache.h"
typedef enum typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
{
/** /**
* By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying. * By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying.
* This flag disable this blacklisting. * This flag disable this blacklisting.
@ -57,9 +56,10 @@ typedef enum
* Useful for testing purposes. Use with caution in production. * Useful for testing purposes. Use with caution in production.
*/ */
SDWebImageAllowInvalidSSLCertificates = 1 << 7 SDWebImageAllowInvalidSSLCertificates = 1 << 7
} SDWebImageOptions; };
typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType); typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType);
typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished); typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished);

View file

@ -7,7 +7,6 @@
*/ */
#import "SDWebImageManager.h" #import "SDWebImageManager.h"
#import "UIImage+GIF.h"
#import <objc/message.h> #import <objc/message.h>
@interface SDWebImageCombinedOperation : NSObject <SDWebImageOperation> @interface SDWebImageCombinedOperation : NSObject <SDWebImageOperation>
@ -29,110 +28,91 @@
@implementation SDWebImageManager @implementation SDWebImageManager
+ (id)sharedManager + (id)sharedManager {
{
static dispatch_once_t once; static dispatch_once_t once;
static id instance; static id instance;
dispatch_once(&once, ^{instance = self.new;}); dispatch_once(&once, ^{
instance = [self new];
});
return instance; return instance;
} }
- (id)init - (id)init {
{ if ((self = [super init])) {
if ((self = [super init]))
{
_imageCache = [self createCache]; _imageCache = [self createCache];
_imageDownloader = SDWebImageDownloader.new; _imageDownloader = [SDWebImageDownloader new];
_failedURLs = NSMutableArray.new; _failedURLs = [NSMutableArray new];
_runningOperations = NSMutableArray.new; _runningOperations = [NSMutableArray new];
} }
return self; return self;
} }
- (SDImageCache *)createCache - (SDImageCache *)createCache {
{
return [SDImageCache sharedImageCache]; return [SDImageCache sharedImageCache];
} }
- (NSString *)cacheKeyForURL:(NSURL *)url - (NSString *)cacheKeyForURL:(NSURL *)url {
{ if (self.cacheKeyFilter) {
if (self.cacheKeyFilter)
{
return self.cacheKeyFilter(url); return self.cacheKeyFilter(url);
} }
else else {
{
return [url absoluteString]; return [url absoluteString];
} }
} }
- (BOOL)diskImageExistsForURL:(NSURL *)url - (BOOL)diskImageExistsForURL:(NSURL *)url {
{
NSString *key = [self cacheKeyForURL:url]; NSString *key = [self cacheKeyForURL:url];
return [self.imageCache diskImageExistsWithKey:key]; return [self.imageCache diskImageExistsWithKey:key];
} }
- (id<SDWebImageOperation>)downloadWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedWithFinishedBlock)completedBlock - (id <SDWebImageOperation>)downloadWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedWithFinishedBlock)completedBlock {
{
// Invoking this method without a completedBlock is pointless // Invoking this method without a completedBlock is pointless
NSParameterAssert(completedBlock); NSParameterAssert(completedBlock);
// Very common mistake is to send the URL using NSString object instead of NSURL. For some strange reason, XCode won't // Very common mistake is to send the URL using NSString object instead of NSURL. For some strange reason, XCode won't
// throw any warning for this type mismatch. Here we failsafe this error by allowing URLs to be passed as NSString. // throw any warning for this type mismatch. Here we failsafe this error by allowing URLs to be passed as NSString.
if ([url isKindOfClass:NSString.class]) if ([url isKindOfClass:NSString.class]) {
{
url = [NSURL URLWithString:(NSString *)url]; url = [NSURL URLWithString:(NSString *)url];
} }
// Prevents app crashing on argument type error like sending NSNull instead of NSURL // Prevents app crashing on argument type error like sending NSNull instead of NSURL
if (![url isKindOfClass:NSURL.class]) if (![url isKindOfClass:NSURL.class]) {
{
url = nil; url = nil;
} }
__block SDWebImageCombinedOperation *operation = SDWebImageCombinedOperation.new; __block SDWebImageCombinedOperation *operation = [SDWebImageCombinedOperation new];
__weak SDWebImageCombinedOperation *weakOperation = operation; __weak SDWebImageCombinedOperation *weakOperation = operation;
BOOL isFailedUrl = NO; BOOL isFailedUrl = NO;
@synchronized(self.failedURLs) @synchronized (self.failedURLs) {
{
isFailedUrl = [self.failedURLs containsObject:url]; isFailedUrl = [self.failedURLs containsObject:url];
} }
if (!url || (!(options & SDWebImageRetryFailed) && isFailedUrl)) if (!url || (!(options & SDWebImageRetryFailed) && isFailedUrl)) {
{ dispatch_main_sync_safe(^{
dispatch_main_sync_safe(^
{
NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist userInfo:nil]; NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist userInfo:nil];
completedBlock(nil, error, SDImageCacheTypeNone, YES); completedBlock(nil, error, SDImageCacheTypeNone, YES);
}); });
return operation; return operation;
} }
@synchronized(self.runningOperations) @synchronized (self.runningOperations) {
{
[self.runningOperations addObject:operation]; [self.runningOperations addObject:operation];
} }
NSString *key = [self cacheKeyForURL:url]; NSString *key = [self cacheKeyForURL:url];
operation.cacheOperation = [self.imageCache queryDiskCacheForKey:key done:^(UIImage *image, SDImageCacheType cacheType) operation.cacheOperation = [self.imageCache queryDiskCacheForKey:key done:^(UIImage *image, SDImageCacheType cacheType) {
{ if (operation.isCancelled) {
if (operation.isCancelled) @synchronized (self.runningOperations) {
{
@synchronized(self.runningOperations)
{
[self.runningOperations removeObject:operation]; [self.runningOperations removeObject:operation];
} }
return; return;
} }
if ((!image || options & SDWebImageRefreshCached) && (![self.delegate respondsToSelector:@selector(imageManager:shouldDownloadImageForURL:)] || [self.delegate imageManager:self shouldDownloadImageForURL:url])) if ((!image || options & SDWebImageRefreshCached) && (![self.delegate respondsToSelector:@selector(imageManager:shouldDownloadImageForURL:)] || [self.delegate imageManager:self shouldDownloadImageForURL:url])) {
{ if (image && options & SDWebImageRefreshCached) {
if (image && options & SDWebImageRefreshCached) dispatch_main_sync_safe(^{
{
dispatch_main_sync_safe(^
{
// If image was found in the cache bug SDWebImageRefreshCached is provided, notify about the cached image // If image was found in the cache bug SDWebImageRefreshCached is provided, notify about the cached image
// AND try to re-download it in order to let a chance to NSURLCache to refresh it from server. // AND try to re-download it in order to let a chance to NSURLCache to refresh it from server.
completedBlock(image, nil, cacheType, YES); completedBlock(image, nil, cacheType, YES);
@ -147,108 +127,85 @@
if (options & SDWebImageContinueInBackground) downloaderOptions |= SDWebImageDownloaderContinueInBackground; if (options & SDWebImageContinueInBackground) downloaderOptions |= SDWebImageDownloaderContinueInBackground;
if (options & SDWebImageHandleCookies) downloaderOptions |= SDWebImageDownloaderHandleCookies; if (options & SDWebImageHandleCookies) downloaderOptions |= SDWebImageDownloaderHandleCookies;
if (options & SDWebImageAllowInvalidSSLCertificates) downloaderOptions |= SDWebImageDownloaderAllowInvalidSSLCertificates; if (options & SDWebImageAllowInvalidSSLCertificates) downloaderOptions |= SDWebImageDownloaderAllowInvalidSSLCertificates;
if (image && options & SDWebImageRefreshCached) if (image && options & SDWebImageRefreshCached) {
{
// force progressive off if image already cached but forced refreshing // force progressive off if image already cached but forced refreshing
downloaderOptions &= ~SDWebImageDownloaderProgressiveDownload; downloaderOptions &= ~SDWebImageDownloaderProgressiveDownload;
// ignore image read from NSURLCache if image if cached but force refreshing // ignore image read from NSURLCache if image if cached but force refreshing
downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse; downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse;
} }
id<SDWebImageOperation> subOperation = [self.imageDownloader downloadImageWithURL:url options:downloaderOptions progress:progressBlock completed:^(UIImage *downloadedImage, NSData *data, NSError *error, BOOL finished) id <SDWebImageOperation> subOperation = [self.imageDownloader downloadImageWithURL:url options:downloaderOptions progress:progressBlock completed:^(UIImage *downloadedImage, NSData *data, NSError *error, BOOL finished) {
{ if (weakOperation.isCancelled) {
if (weakOperation.isCancelled) dispatch_main_sync_safe(^{
{
dispatch_main_sync_safe(^
{
completedBlock(nil, nil, SDImageCacheTypeNone, finished); completedBlock(nil, nil, SDImageCacheTypeNone, finished);
}); });
} }
else if (error) else if (error) {
{ dispatch_main_sync_safe(^{
dispatch_main_sync_safe(^
{
completedBlock(nil, error, SDImageCacheTypeNone, finished); completedBlock(nil, error, SDImageCacheTypeNone, finished);
}); });
if (error.code != NSURLErrorNotConnectedToInternet) if (error.code != NSURLErrorNotConnectedToInternet) {
{ @synchronized (self.failedURLs) {
@synchronized(self.failedURLs)
{
[self.failedURLs addObject:url]; [self.failedURLs addObject:url];
} }
} }
} }
else else {
{
BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly); BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly);
if (options & SDWebImageRefreshCached && image && !downloadedImage) if (options & SDWebImageRefreshCached && image && !downloadedImage) {
{
// Image refresh hit the NSURLCache cache, do not call the completion block // Image refresh hit the NSURLCache cache, do not call the completion block
} }
// NOTE: We don't call transformDownloadedImage delegate method on animated images as most transformation code would mangle it // NOTE: We don't call transformDownloadedImage delegate method on animated images as most transformation code would mangle it
else if (downloadedImage && !downloadedImage.images && [self.delegate respondsToSelector:@selector(imageManager:transformDownloadedImage:withURL:)]) else if (downloadedImage && !downloadedImage.images && [self.delegate respondsToSelector:@selector(imageManager:transformDownloadedImage:withURL:)]) {
{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^
{
UIImage *transformedImage = [self.delegate imageManager:self transformDownloadedImage:downloadedImage withURL:url]; UIImage *transformedImage = [self.delegate imageManager:self transformDownloadedImage:downloadedImage withURL:url];
dispatch_main_sync_safe(^ dispatch_main_sync_safe(^{
{
completedBlock(transformedImage, nil, SDImageCacheTypeNone, finished); completedBlock(transformedImage, nil, SDImageCacheTypeNone, finished);
}); });
if (transformedImage && finished) if (transformedImage && finished) {
{
BOOL imageWasTransformed = ![transformedImage isEqual:downloadedImage]; BOOL imageWasTransformed = ![transformedImage isEqual:downloadedImage];
[self.imageCache storeImage:transformedImage recalculateFromImage:imageWasTransformed imageData:data forKey:key toDisk:cacheOnDisk]; [self.imageCache storeImage:transformedImage recalculateFromImage:imageWasTransformed imageData:data forKey:key toDisk:cacheOnDisk];
} }
}); });
} }
else else {
{ dispatch_main_sync_safe(^{
dispatch_main_sync_safe(^
{
completedBlock(downloadedImage, nil, SDImageCacheTypeNone, finished); completedBlock(downloadedImage, nil, SDImageCacheTypeNone, finished);
}); });
if (downloadedImage && finished) if (downloadedImage && finished) {
{
[self.imageCache storeImage:downloadedImage recalculateFromImage:NO imageData:data forKey:key toDisk:cacheOnDisk]; [self.imageCache storeImage:downloadedImage recalculateFromImage:NO imageData:data forKey:key toDisk:cacheOnDisk];
} }
} }
} }
if (finished) if (finished) {
{ @synchronized (self.runningOperations) {
@synchronized(self.runningOperations)
{
[self.runningOperations removeObject:operation]; [self.runningOperations removeObject:operation];
} }
} }
}]; }];
operation.cancelBlock = ^{[subOperation cancel];}; operation.cancelBlock = ^{
[subOperation cancel];
};
} }
else if (image) else if (image) {
{ dispatch_main_sync_safe(^{
dispatch_main_sync_safe(^
{
completedBlock(image, nil, cacheType, YES); completedBlock(image, nil, cacheType, YES);
}); });
@synchronized(self.runningOperations) @synchronized (self.runningOperations) {
{
[self.runningOperations removeObject:operation]; [self.runningOperations removeObject:operation];
} }
} }
else else {
{
// Image not in cache and download disallowed by delegate // Image not in cache and download disallowed by delegate
dispatch_main_sync_safe(^ dispatch_main_sync_safe(^{
{
completedBlock(nil, nil, SDImageCacheTypeNone, YES); completedBlock(nil, nil, SDImageCacheTypeNone, YES);
}); });
@synchronized(self.runningOperations) @synchronized (self.runningOperations) {
{
[self.runningOperations removeObject:operation]; [self.runningOperations removeObject:operation];
} }
} }
@ -257,17 +214,14 @@
return operation; return operation;
} }
- (void)cancelAll - (void)cancelAll {
{ @synchronized (self.runningOperations) {
@synchronized(self.runningOperations)
{
[self.runningOperations makeObjectsPerformSelector:@selector(cancel)]; [self.runningOperations makeObjectsPerformSelector:@selector(cancel)];
[self.runningOperations removeAllObjects]; [self.runningOperations removeAllObjects];
} }
} }
- (BOOL)isRunning - (BOOL)isRunning {
{
return self.runningOperations.count > 0; return self.runningOperations.count > 0;
} }
@ -275,28 +229,22 @@
@implementation SDWebImageCombinedOperation @implementation SDWebImageCombinedOperation
- (void)setCancelBlock:(void (^)())cancelBlock - (void)setCancelBlock:(void (^)())cancelBlock {
{ if (self.isCancelled) {
if (self.isCancelled)
{
if (cancelBlock) cancelBlock(); if (cancelBlock) cancelBlock();
} }
else else {
{
_cancelBlock = [cancelBlock copy]; _cancelBlock = [cancelBlock copy];
} }
} }
- (void)cancel - (void)cancel {
{
self.cancelled = YES; self.cancelled = YES;
if (self.cacheOperation) if (self.cacheOperation) {
{
[self.cacheOperation cancel]; [self.cacheOperation cancel];
self.cacheOperation = nil; self.cacheOperation = nil;
} }
if (self.cancelBlock) if (self.cancelBlock) {
{
self.cancelBlock(); self.cancelBlock();
self.cancelBlock = nil; self.cancelBlock = nil;
} }

View file

@ -73,9 +73,10 @@
* and skips images for failed downloads and proceed to the next image in the list * and skips images for failed downloads and proceed to the next image in the list
* *
* @param urls list of URLs to prefetch * @param urls list of URLs to prefetch
* @param progressBlock block to be called when progress updates
* @param completionBlock block to be called when prefetching is completed * @param completionBlock block to be called when prefetching is completed
*/ */
- (void)prefetchURLs:(NSArray *)urls completed:(void (^)(NSUInteger finishedCount, NSUInteger skippedCount))completionBlock; - (void)prefetchURLs:(NSArray *)urls progress:(void (^)(NSUInteger, NSUInteger))progressBlock completed:(void (^)(NSUInteger, NSUInteger))completionBlock;
/** /**
* Remove and cancel queued list * Remove and cancel queued list

View file

@ -7,7 +7,6 @@
*/ */
#import "SDWebImagePrefetcher.h" #import "SDWebImagePrefetcher.h"
#import "SDWebImageManager.h"
@interface SDWebImagePrefetcher () @interface SDWebImagePrefetcher ()
@ -18,57 +17,53 @@
@property (assign, nonatomic) NSUInteger finishedCount; @property (assign, nonatomic) NSUInteger finishedCount;
@property (assign, nonatomic) NSTimeInterval startedTime; @property (assign, nonatomic) NSTimeInterval startedTime;
@property (copy, nonatomic) void (^completionBlock)(NSUInteger, NSUInteger); @property (copy, nonatomic) void (^completionBlock)(NSUInteger, NSUInteger);
@property (copy, nonatomic) void (^progressBlock)(NSUInteger, NSUInteger);
@end @end
@implementation SDWebImagePrefetcher @implementation SDWebImagePrefetcher
+ (SDWebImagePrefetcher *)sharedImagePrefetcher + (SDWebImagePrefetcher *)sharedImagePrefetcher {
{
static dispatch_once_t once; static dispatch_once_t once;
static id instance; static id instance;
dispatch_once(&once, ^{instance = self.new;}); dispatch_once(&once, ^{
instance = [self new];
});
return instance; return instance;
} }
- (id)init - (id)init {
{ if ((self = [super init])) {
if ((self = [super init])) _manager = [SDWebImageManager new];
{
_manager = SDWebImageManager.new;
_options = SDWebImageLowPriority; _options = SDWebImageLowPriority;
self.maxConcurrentDownloads = 3; self.maxConcurrentDownloads = 3;
} }
return self; return self;
} }
- (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads - (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads {
{
self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads; self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads;
} }
- (NSUInteger)maxConcurrentDownloads - (NSUInteger)maxConcurrentDownloads {
{
return self.manager.imageDownloader.maxConcurrentDownloads; return self.manager.imageDownloader.maxConcurrentDownloads;
} }
- (void)startPrefetchingAtIndex:(NSUInteger)index - (void)startPrefetchingAtIndex:(NSUInteger)index {
{
if (index >= self.prefetchURLs.count) return; if (index >= self.prefetchURLs.count) return;
self.requestedCount++; self.requestedCount++;
[self.manager downloadWithURL:self.prefetchURLs[index] options:self.options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) [self.manager downloadWithURL:self.prefetchURLs[index] options:self.options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
{
if (!finished) return; if (!finished) return;
self.finishedCount++; self.finishedCount++;
if (image) if (image) {
{ self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
#ifdef SD_VERBOSE #ifdef SD_VERBOSE
NSLog(@"Prefetched %d out of %d", self.finishedCount, self.prefetchURLs.count); NSLog(@"Prefetched %d out of %d", self.finishedCount, self.prefetchURLs.count);
#endif #endif
} }
else else {
{ self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
#ifdef SD_VERBOSE #ifdef SD_VERBOSE
NSLog(@"Prefetched %d out of %d (Failed)", self.finishedCount, [self.prefetchURLs count]); NSLog(@"Prefetched %d out of %d (Failed)", self.finishedCount, [self.prefetchURLs count]);
#endif #endif
@ -76,8 +71,7 @@
// Add last failed // Add last failed
self.skippedCount++; self.skippedCount++;
} }
if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) {
{
[self.delegate imagePrefetcher:self [self.delegate imagePrefetcher:self
didPrefetchURL:self.prefetchURLs[index] didPrefetchURL:self.prefetchURLs[index]
finishedCount:self.finishedCount finishedCount:self.finishedCount
@ -85,15 +79,12 @@
]; ];
} }
if (self.prefetchURLs.count > self.requestedCount) if (self.prefetchURLs.count > self.requestedCount) {
{
[self startPrefetchingAtIndex:self.requestedCount]; [self startPrefetchingAtIndex:self.requestedCount];
} }
else if (self.finishedCount == self.requestedCount) else if (self.finishedCount + self.skippedCount == self.requestedCount) {
{
[self reportStatus]; [self reportStatus];
if (self.completionBlock) if (self.completionBlock) {
{
self.completionBlock(self.finishedCount, self.skippedCount); self.completionBlock(self.finishedCount, self.skippedCount);
self.completionBlock = nil; self.completionBlock = nil;
} }
@ -101,14 +92,12 @@
}]; }];
} }
- (void)reportStatus - (void)reportStatus {
{
NSUInteger total = [self.prefetchURLs count]; NSUInteger total = [self.prefetchURLs count];
#ifdef SD_VERBOSE #ifdef SD_VERBOSE
NSLog(@"Finished prefetching (%d successful, %d skipped, timeElasped %.2f)", total - self.skippedCount, self.skippedCount, CFAbsoluteTimeGetCurrent() - self.startedTime); NSLog(@"Finished prefetching (%d successful, %d skipped, timeElasped %.2f)", total - self.skippedCount, self.skippedCount, CFAbsoluteTimeGetCurrent() - self.startedTime);
#endif #endif
if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) {
{
[self.delegate imagePrefetcher:self [self.delegate imagePrefetcher:self
didFinishWithTotalCount:(total - self.skippedCount) didFinishWithTotalCount:(total - self.skippedCount)
skippedCount:self.skippedCount skippedCount:self.skippedCount
@ -116,28 +105,25 @@
} }
} }
- (void)prefetchURLs:(NSArray *)urls - (void)prefetchURLs:(NSArray *)urls {
{ [self prefetchURLs:urls progress:nil completed:nil];
[self prefetchURLs:urls completed:nil];
} }
- (void)prefetchURLs:(NSArray *)urls completed:(void (^)(NSUInteger, NSUInteger))completionBlock - (void)prefetchURLs:(NSArray *)urls progress:(void (^)(NSUInteger, NSUInteger))progressBlock completed:(void (^)(NSUInteger, NSUInteger))completionBlock {
{
[self cancelPrefetching]; // Prevent duplicate prefetch request [self cancelPrefetching]; // Prevent duplicate prefetch request
self.startedTime = CFAbsoluteTimeGetCurrent(); self.startedTime = CFAbsoluteTimeGetCurrent();
self.prefetchURLs = urls; self.prefetchURLs = urls;
self.completionBlock = completionBlock; self.completionBlock = completionBlock;
self.progressBlock = progressBlock;
// Starts prefetching from the very first image on the list with the max allowed concurrency // Starts prefetching from the very first image on the list with the max allowed concurrency
NSUInteger listCount = self.prefetchURLs.count; NSUInteger listCount = self.prefetchURLs.count;
for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) {
{
[self startPrefetchingAtIndex:i]; [self startPrefetchingAtIndex:i];
} }
} }
- (void)cancelPrefetching - (void)cancelPrefetching {
{
self.prefetchURLs = nil; self.prefetchURLs = nil;
self.skippedCount = 0; self.skippedCount = 0;
self.requestedCount = 0; self.requestedCount = 0;

View file

@ -13,52 +13,42 @@ static char operationKey;
@implementation UIButton (WebCache) @implementation UIButton (WebCache)
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state {
{
[self setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; [self setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil];
} }
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder {
{
[self setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; [self setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil];
} }
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options {
{
[self setImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; [self setImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil];
} }
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletedBlock)completedBlock - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletedBlock)completedBlock {
{
[self setImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; [self setImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock];
} }
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock
{ - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock {
[self setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; [self setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock];
} }
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock {
{
[self cancelCurrentImageLoad]; [self cancelCurrentImageLoad];
[self setImage:placeholder forState:state]; [self setImage:placeholder forState:state];
if (url) if (url) {
{
__weak UIButton *wself = self; __weak UIButton *wself = self;
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
{
if (!wself) return; if (!wself) return;
dispatch_main_sync_safe(^ dispatch_main_sync_safe(^{
{
__strong UIButton *sself = wself; __strong UIButton *sself = wself;
if (!sself) return; if (!sself) return;
if (image) if (image) {
{
[sself setImage:image forState:state]; [sself setImage:image forState:state];
} }
if (completedBlock && finished) if (completedBlock && finished) {
{
completedBlock(image, error, cacheType); completedBlock(image, error, cacheType);
} }
}); });
@ -67,53 +57,42 @@ static char operationKey;
} }
} }
- (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state {
{
[self setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; [self setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil];
} }
- (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder {
{
[self setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; [self setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil];
} }
- (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options {
{
[self setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; [self setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil];
} }
- (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletedBlock)completedBlock - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletedBlock)completedBlock {
{
[self setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; [self setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock];
} }
- (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock {
{
[self setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; [self setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock];
} }
- (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock {
{
[self cancelCurrentImageLoad]; [self cancelCurrentImageLoad];
[self setBackgroundImage:placeholder forState:state]; [self setBackgroundImage:placeholder forState:state];
if (url) if (url) {
{
__weak UIButton *wself = self; __weak UIButton *wself = self;
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
{
if (!wself) return; if (!wself) return;
dispatch_main_sync_safe(^ dispatch_main_sync_safe(^{
{
__strong UIButton *sself = wself; __strong UIButton *sself = wself;
if (!sself) return; if (!sself) return;
if (image) if (image) {
{
[sself setBackgroundImage:image forState:state]; [sself setBackgroundImage:image forState:state];
} }
if (completedBlock && finished) if (completedBlock && finished) {
{
completedBlock(image, error, cacheType); completedBlock(image, error, cacheType);
} }
}); });
@ -123,12 +102,10 @@ static char operationKey;
} }
- (void)cancelCurrentImageLoad - (void)cancelCurrentImageLoad {
{
// Cancel in progress downloader from queue // Cancel in progress downloader from queue
id <SDWebImageOperation> operation = objc_getAssociatedObject(self, &operationKey); id <SDWebImageOperation> operation = objc_getAssociatedObject(self, &operationKey);
if (operation) if (operation) {
{
[operation cancel]; [operation cancel];
objc_setAssociatedObject(self, &operationKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, &operationKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }

View file

@ -6,12 +6,12 @@
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. // Copyright (c) 2012 __MyCompanyName__. All rights reserved.
// //
#import "NSData+GIF.h"
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface UIImage (GIF) @interface UIImage (GIF)
+ (UIImage *)sd_animatedGIFNamed:(NSString *)name; + (UIImage *)sd_animatedGIFNamed:(NSString *)name;
+ (UIImage *)sd_animatedGIFWithData:(NSData *)data; + (UIImage *)sd_animatedGIFWithData:(NSData *)data;
- (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size; - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size;

View file

@ -11,10 +11,8 @@
@implementation UIImage (GIF) @implementation UIImage (GIF)
+ (UIImage *)sd_animatedGIFWithData:(NSData *)data + (UIImage *)sd_animatedGIFWithData:(NSData *)data {
{ if (!data) {
if (!data)
{
return nil; return nil;
} }
@ -24,18 +22,15 @@
UIImage *animatedImage; UIImage *animatedImage;
if (count <= 1) if (count <= 1) {
{
animatedImage = [[UIImage alloc] initWithData:data]; animatedImage = [[UIImage alloc] initWithData:data];
} }
else else {
{
NSMutableArray *images = [NSMutableArray array]; NSMutableArray *images = [NSMutableArray array];
NSTimeInterval duration = 0.0f; NSTimeInterval duration = 0.0f;
for (size_t i = 0; i < count; i++) for (size_t i = 0; i < count; i++) {
{
CGImageRef image = CGImageSourceCreateImageAtIndex(source, i, NULL); CGImageRef image = CGImageSourceCreateImageAtIndex(source, i, NULL);
duration += [self frameDurationAtIndex:i source:source]; duration += [self frameDurationAtIndex:i source:source];
@ -45,8 +40,7 @@
CGImageRelease(image); CGImageRelease(image);
} }
if (!duration) if (!duration) {
{
duration = (1.0f / 10.0f) * count; duration = (1.0f / 10.0f) * count;
} }
@ -58,24 +52,20 @@
return animatedImage; return animatedImage;
} }
+ (float)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source + (float)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source {
{
float frameDuration = 0.1f; float frameDuration = 0.1f;
CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil); CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil);
NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties; NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties;
NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary]; NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary];
NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime]; NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime];
if (delayTimeUnclampedProp) if (delayTimeUnclampedProp) {
{
frameDuration = [delayTimeUnclampedProp floatValue]; frameDuration = [delayTimeUnclampedProp floatValue];
} }
else else {
{
NSNumber *delayTimeProp = gifProperties[(NSString *)kCGImagePropertyGIFDelayTime]; NSNumber *delayTimeProp = gifProperties[(NSString *)kCGImagePropertyGIFDelayTime];
if (delayTimeProp) if (delayTimeProp) {
{
frameDuration = [delayTimeProp floatValue]; frameDuration = [delayTimeProp floatValue];
} }
} }
@ -85,8 +75,7 @@
// a duration of <= 10 ms. See <rdar://problem/7689300> and <http://webkit.org/b/36082> // a duration of <= 10 ms. See <rdar://problem/7689300> and <http://webkit.org/b/36082>
// for more information. // for more information.
if (frameDuration < 0.011f) if (frameDuration < 0.011f) {
{
frameDuration = 0.100f; frameDuration = 0.100f;
} }
@ -94,18 +83,15 @@
return frameDuration; return frameDuration;
} }
+ (UIImage *)sd_animatedGIFNamed:(NSString *)name + (UIImage *)sd_animatedGIFNamed:(NSString *)name {
{
CGFloat scale = [UIScreen mainScreen].scale; CGFloat scale = [UIScreen mainScreen].scale;
if (scale > 1.0f) if (scale > 1.0f) {
{
NSString *retinaPath = [[NSBundle mainBundle] pathForResource:[name stringByAppendingString:@"@2x"] ofType:@"gif"]; NSString *retinaPath = [[NSBundle mainBundle] pathForResource:[name stringByAppendingString:@"@2x"] ofType:@"gif"];
NSData *data = [NSData dataWithContentsOfFile:retinaPath]; NSData *data = [NSData dataWithContentsOfFile:retinaPath];
if (data) if (data) {
{
return [UIImage sd_animatedGIFWithData:data]; return [UIImage sd_animatedGIFWithData:data];
} }
@ -113,21 +99,18 @@
data = [NSData dataWithContentsOfFile:path]; data = [NSData dataWithContentsOfFile:path];
if (data) if (data) {
{
return [UIImage sd_animatedGIFWithData:data]; return [UIImage sd_animatedGIFWithData:data];
} }
return [UIImage imageNamed:name]; return [UIImage imageNamed:name];
} }
else else {
{
NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"]; NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"];
NSData *data = [NSData dataWithContentsOfFile:path]; NSData *data = [NSData dataWithContentsOfFile:path];
if (data) if (data) {
{
return [UIImage sd_animatedGIFWithData:data]; return [UIImage sd_animatedGIFWithData:data];
} }
@ -135,10 +118,8 @@
} }
} }
- (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size {
{ if (CGSizeEqualToSize(self.size, size) || CGSizeEqualToSize(size, CGSizeZero)) {
if (CGSizeEqualToSize(self.size, size) || CGSizeEqualToSize(size, CGSizeZero))
{
return self; return self;
} }
@ -151,12 +132,10 @@
scaledSize.width = self.size.width * scaleFactor; scaledSize.width = self.size.width * scaleFactor;
scaledSize.height = self.size.height * scaleFactor; scaledSize.height = self.size.height * scaleFactor;
if (widthFactor > heightFactor) if (widthFactor > heightFactor) {
{
thumbnailPoint.y = (size.height - scaledSize.height) * 0.5; thumbnailPoint.y = (size.height - scaledSize.height) * 0.5;
} }
else if (widthFactor < heightFactor) else if (widthFactor < heightFactor) {
{
thumbnailPoint.x = (size.width - scaledSize.width) * 0.5; thumbnailPoint.x = (size.width - scaledSize.width) * 0.5;
} }
@ -164,8 +143,7 @@
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
for (UIImage *image in self.images) for (UIImage *image in self.images) {
{
[image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)]; [image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

View file

@ -8,6 +8,7 @@
#import "UIImage+MultiFormat.h" #import "UIImage+MultiFormat.h"
#import "UIImage+GIF.h" #import "UIImage+GIF.h"
#import "NSData+ImageContentType.h"
#ifdef SD_WEBP #ifdef SD_WEBP
#import "UIImage+WebP.h" #import "UIImage+WebP.h"
@ -15,25 +16,22 @@
@implementation UIImage (MultiFormat) @implementation UIImage (MultiFormat)
+ (UIImage *)sd_imageWithData:(NSData *)data + (UIImage *)sd_imageWithData:(NSData *)data {
{
UIImage *image; UIImage *image;
NSString *imageContentType = [NSData contentTypeForImageData:data];
if ([data sd_isGIF]) if ([imageContentType isEqualToString:@"image/gif"]) {
{
image = [UIImage sd_animatedGIFWithData:data]; image = [UIImage sd_animatedGIFWithData:data];
} }
else
{
image = [[UIImage alloc] initWithData:data];
}
#ifdef SD_WEBP #ifdef SD_WEBP
if (!image) // TODO: detect webp signature else if ([imageContentType isEqualToString:@"image/webp"])
{ {
image = [UIImage sd_imageWithWebPData:data]; image = [UIImage sd_imageWithWebPData:data];
} }
#endif #endif
else {
image = [[UIImage alloc] initWithData:data];
}
return image; return image;
} }

View file

@ -14,58 +14,46 @@ static char operationArrayKey;
@implementation UIImageView (WebCache) @implementation UIImageView (WebCache)
- (void)setImageWithURL:(NSURL *)url - (void)setImageWithURL:(NSURL *)url {
{
[self setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; [self setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil];
} }
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder {
{
[self setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; [self setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil];
} }
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options {
{
[self setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; [self setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil];
} }
- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock - (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock {
{
[self setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; [self setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock];
} }
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock {
{
[self setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; [self setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock];
} }
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock {
{
[self setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; [self setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock];
} }
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock {
{
[self cancelCurrentImageLoad]; [self cancelCurrentImageLoad];
self.image = placeholder; self.image = placeholder;
if (url) if (url) {
{
__weak UIImageView *wself = self; __weak UIImageView *wself = self;
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
{
if (!wself) return; if (!wself) return;
dispatch_main_sync_safe(^ dispatch_main_sync_safe(^{
{
if (!wself) return; if (!wself) return;
if (image) if (image) {
{
wself.image = image; wself.image = image;
[wself setNeedsLayout]; [wself setNeedsLayout];
} }
if (completedBlock && finished) if (completedBlock && finished) {
{
completedBlock(image, error, cacheType); completedBlock(image, error, cacheType);
} }
}); });
@ -74,27 +62,21 @@ static char operationArrayKey;
} }
} }
- (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs - (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs {
{
[self cancelCurrentArrayLoad]; [self cancelCurrentArrayLoad];
__weak UIImageView *wself = self; __weak UIImageView *wself = self;
NSMutableArray *operationsArray = [[NSMutableArray alloc] init]; NSMutableArray *operationsArray = [[NSMutableArray alloc] init];
for (NSURL *logoImageURL in arrayOfURLs) for (NSURL *logoImageURL in arrayOfURLs) {
{ id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
{
if (!wself) return; if (!wself) return;
dispatch_main_sync_safe(^ dispatch_main_sync_safe(^{
{
__strong UIImageView *sself = wself; __strong UIImageView *sself = wself;
[sself stopAnimating]; [sself stopAnimating];
if (sself && image) if (sself && image) {
{
NSMutableArray *currentImages = [[sself animationImages] mutableCopy]; NSMutableArray *currentImages = [[sself animationImages] mutableCopy];
if (!currentImages) if (!currentImages) {
{
currentImages = [[NSMutableArray alloc] init]; currentImages = [[NSMutableArray alloc] init];
} }
[currentImages addObject:image]; [currentImages addObject:image];
@ -111,25 +93,20 @@ static char operationArrayKey;
objc_setAssociatedObject(self, &operationArrayKey, [NSArray arrayWithArray:operationsArray], OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, &operationArrayKey, [NSArray arrayWithArray:operationsArray], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }
- (void)cancelCurrentImageLoad - (void)cancelCurrentImageLoad {
{
// Cancel in progress downloader from queue // Cancel in progress downloader from queue
id <SDWebImageOperation> operation = objc_getAssociatedObject(self, &operationKey); id <SDWebImageOperation> operation = objc_getAssociatedObject(self, &operationKey);
if (operation) if (operation) {
{
[operation cancel]; [operation cancel];
objc_setAssociatedObject(self, &operationKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, &operationKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }
} }
- (void)cancelCurrentArrayLoad - (void)cancelCurrentArrayLoad {
{
// Cancel in progress downloader from queue // Cancel in progress downloader from queue
NSArray *operations = objc_getAssociatedObject(self, &operationArrayKey); NSArray *operations = objc_getAssociatedObject(self, &operationArrayKey);
for (id<SDWebImageOperation> operation in operations) for (id <SDWebImageOperation> operation in operations) {
{ if (operation) {
if (operation)
{
[operation cancel]; [operation cancel];
} }
} }

2
Pods/iRate/LICENCE.md generated
View file

@ -1,6 +1,6 @@
iRate iRate
Version 1.9.2, January 21st, 2014 Version 1.9.3, February 5th, 2014
Copyright (C) 2011 Charcoal Design Copyright (C) 2011 Charcoal Design

View file

@ -1,6 +1,6 @@
"iRateMessageTitle" = "Đánh giá %@"; "iRateMessageTitle" = "Đánh giá %@";
"iRateAppMessage" = "Nếu bạn thích sử dụng %@, bạn có muốn giành một chút thời gian để đánh giá nó? Sẽ không lâu hơn một phút. Cảm ơn sự hỗ trợ của bạn!"; "iRateAppMessage" = "Nếu thích sử dụng %@, bạn có muốn giành một chút thời gian để đánh giá nó? Sẽ không lâu hơn một phút. Cảm ơn sự hỗ trợ của bạn!";
"iRateGameMessage" = "Nếu bạn thích chơi %@, bạn có muốn giành một chút thời gian để đánh giá nó? Sẽ không lâu hơn một phút. Cảm ơn hỗ trợ của bạn!"; "iRateGameMessage" = "Nếu thích chơi %@, bạn có muốn giành một chút thời gian để đánh giá nó? Sẽ không lâu hơn một phút. Cảm ơn sự hỗ trợ của bạn!";
"iRateCancelButton" = "Không, Cảm ơn"; "iRateCancelButton" = "Không, Cảm ơn";
"iRateRateButton" = "Đánh Giá Ngay"; "iRateRateButton" = "Đánh Giá Ngay";
"iRateRemindButton" = "Nhắc Tôi Sau"; "iRateRemindButton" = "Nhắc Tôi Sau";

View file

@ -1,7 +1,7 @@
// //
// iRate.h // iRate.h
// //
// Version 1.9.2 // Version 1.9.3
// //
// Created by Nick Lockwood on 26/01/2011. // Created by Nick Lockwood on 26/01/2011.
// Copyright 2011 Charcoal Design // Copyright 2011 Charcoal Design

View file

@ -1,7 +1,7 @@
// //
// iRate.m // iRate.m
// //
// Version 1.9.2 // Version 1.9.3
// //
// Created by Nick Lockwood on 26/01/2011. // Created by Nick Lockwood on 26/01/2011.
// Copyright 2011 Charcoal Design // Copyright 2011 Charcoal Design
@ -275,7 +275,7 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple.
return _ratingsURL; return _ratingsURL;
} }
if (!self.appStoreID) if (!self.appStoreID && self.verboseLogging)
{ {
NSLog(@"iRate could not find the App Store ID for this application. If the application is not intended for App Store release then you must specify a custom ratingsURL."); NSLog(@"iRate could not find the App Store ID for this application. If the application is not intended for App Store release then you must specify a custom ratingsURL.");
} }

View file

@ -23,22 +23,6 @@
CD490A2718A1628700CFECE0 /* OARequestParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A1418A1628700CFECE0 /* OARequestParameter.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; CD490A2718A1628700CFECE0 /* OARequestParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A1418A1628700CFECE0 /* OARequestParameter.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
CD490A2818A1628700CFECE0 /* OAServiceTicket.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A1618A1628700CFECE0 /* OAServiceTicket.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; CD490A2818A1628700CFECE0 /* OAServiceTicket.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A1618A1628700CFECE0 /* OAServiceTicket.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
CD490A2918A1628700CFECE0 /* OAToken.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A1918A1628700CFECE0 /* OAToken.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; CD490A2918A1628700CFECE0 /* OAToken.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A1918A1628700CFECE0 /* OAToken.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
CD490A4A18A1639600CFECE0 /* TSAVDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A3318A1639600CFECE0 /* TSAVDemoAppDelegate.m */; };
CD490A4B18A1639600CFECE0 /* TSAVDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A3518A1639600CFECE0 /* TSAVDemoViewController.m */; };
CD490A4C18A1639600CFECE0 /* TSAVDemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD490A3618A1639600CFECE0 /* TSAVDemoViewController.xib */; };
CD490A4D18A1639600CFECE0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A3718A1639600CFECE0 /* main.m */; };
CD490A4E18A1639600CFECE0 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD490A3818A1639600CFECE0 /* MainWindow-iPad.xib */; };
CD490A4F18A1639600CFECE0 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD490A3918A1639600CFECE0 /* MainWindow.xib */; };
CD490A5018A1639600CFECE0 /* TSAVDemo-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = CD490A3A18A1639600CFECE0 /* TSAVDemo-Info.plist */; };
CD490A5118A1639600CFECE0 /* README.mdown in Resources */ = {isa = PBXBuildFile; fileRef = CD490A3F18A1639600CFECE0 /* README.mdown */; };
CD490A5218A1639600CFECE0 /* Source Code License.rtf in Resources */ = {isa = PBXBuildFile; fileRef = CD490A4018A1639600CFECE0 /* Source Code License.rtf */; };
CD490A5318A1639600CFECE0 /* TSAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = CD490A4318A1639600CFECE0 /* TSAlertView.m */; };
CD490A5418A1639600CFECE0 /* TSAlertViewBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = CD490A4418A1639600CFECE0 /* TSAlertViewBackground.png */; };
CD490A5518A1639600CFECE0 /* TSAlertViewBackground2.png in Resources */ = {isa = PBXBuildFile; fileRef = CD490A4518A1639600CFECE0 /* TSAlertViewBackground2.png */; };
CD490A5618A1639600CFECE0 /* TSAlertViewButtonBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = CD490A4618A1639600CFECE0 /* TSAlertViewButtonBackground.png */; };
CD490A5718A1639600CFECE0 /* TSAlertViewButtonBackground_Highlighted.png in Resources */ = {isa = PBXBuildFile; fileRef = CD490A4718A1639600CFECE0 /* TSAlertViewButtonBackground_Highlighted.png */; };
CD490A5818A1639600CFECE0 /* TSAlertViewCancelButtonBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = CD490A4818A1639600CFECE0 /* TSAlertViewCancelButtonBackground.png */; };
CD490A5918A1639600CFECE0 /* TSAlertViewMessageListViewShadow.png in Resources */ = {isa = PBXBuildFile; fileRef = CD490A4918A1639600CFECE0 /* TSAlertViewMessageListViewShadow.png */; };
CDD9E4F818A144E4006EEC0D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4F718A144E4006EEC0D /* Foundation.framework */; }; CDD9E4F818A144E4006EEC0D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4F718A144E4006EEC0D /* Foundation.framework */; };
CDD9E4FA18A144E4006EEC0D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4F918A144E4006EEC0D /* CoreGraphics.framework */; }; CDD9E4FA18A144E4006EEC0D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4F918A144E4006EEC0D /* CoreGraphics.framework */; };
CDD9E4FC18A144E4006EEC0D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4FB18A144E4006EEC0D /* UIKit.framework */; }; CDD9E4FC18A144E4006EEC0D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4FB18A144E4006EEC0D /* UIKit.framework */; };
@ -175,13 +159,6 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
CD490A5B18A1639600CFECE0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = CD490A3B18A1639600CFECE0 /* TSAVDemo.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1D6058910D05DD3D006BFB54;
remoteInfo = TSAVDemo;
};
CDD9E51A18A144E4006EEC0D /* PBXContainerItemProxy */ = { CDD9E51A18A144E4006EEC0D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = CDD9E4EC18A144E4006EEC0D /* Project object */; containerPortal = CDD9E4EC18A144E4006EEC0D /* Project object */;
@ -225,27 +202,6 @@
CD490A1818A1628700CFECE0 /* OAToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OAToken.h; sourceTree = "<group>"; }; CD490A1818A1628700CFECE0 /* OAToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OAToken.h; sourceTree = "<group>"; };
CD490A1918A1628700CFECE0 /* OAToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OAToken.m; sourceTree = "<group>"; }; CD490A1918A1628700CFECE0 /* OAToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OAToken.m; sourceTree = "<group>"; };
CD490A1A18A1628700CFECE0 /* OAuthConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OAuthConsumer.h; sourceTree = "<group>"; }; CD490A1A18A1628700CFECE0 /* OAuthConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OAuthConsumer.h; sourceTree = "<group>"; };
CD490A3218A1639600CFECE0 /* TSAVDemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAVDemoAppDelegate.h; sourceTree = "<group>"; };
CD490A3318A1639600CFECE0 /* TSAVDemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSAVDemoAppDelegate.m; sourceTree = "<group>"; };
CD490A3418A1639600CFECE0 /* TSAVDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAVDemoViewController.h; sourceTree = "<group>"; };
CD490A3518A1639600CFECE0 /* TSAVDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSAVDemoViewController.m; sourceTree = "<group>"; };
CD490A3618A1639600CFECE0 /* TSAVDemoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TSAVDemoViewController.xib; sourceTree = "<group>"; };
CD490A3718A1639600CFECE0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
CD490A3818A1639600CFECE0 /* MainWindow-iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "MainWindow-iPad.xib"; sourceTree = "<group>"; };
CD490A3918A1639600CFECE0 /* MainWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
CD490A3A18A1639600CFECE0 /* TSAVDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "TSAVDemo-Info.plist"; sourceTree = "<group>"; };
CD490A3B18A1639600CFECE0 /* TSAVDemo.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = TSAVDemo.xcodeproj; sourceTree = "<group>"; };
CD490A3E18A1639600CFECE0 /* TSAVDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAVDemo_Prefix.pch; sourceTree = "<group>"; };
CD490A3F18A1639600CFECE0 /* README.mdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.mdown; sourceTree = "<group>"; };
CD490A4018A1639600CFECE0 /* Source Code License.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = "Source Code License.rtf"; sourceTree = "<group>"; };
CD490A4218A1639600CFECE0 /* TSAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAlertView.h; sourceTree = "<group>"; };
CD490A4318A1639600CFECE0 /* TSAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSAlertView.m; sourceTree = "<group>"; };
CD490A4418A1639600CFECE0 /* TSAlertViewBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewBackground.png; sourceTree = "<group>"; };
CD490A4518A1639600CFECE0 /* TSAlertViewBackground2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewBackground2.png; sourceTree = "<group>"; };
CD490A4618A1639600CFECE0 /* TSAlertViewButtonBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewButtonBackground.png; sourceTree = "<group>"; };
CD490A4718A1639600CFECE0 /* TSAlertViewButtonBackground_Highlighted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewButtonBackground_Highlighted.png; sourceTree = "<group>"; };
CD490A4818A1639600CFECE0 /* TSAlertViewCancelButtonBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewCancelButtonBackground.png; sourceTree = "<group>"; };
CD490A4918A1639600CFECE0 /* TSAlertViewMessageListViewShadow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewMessageListViewShadow.png; sourceTree = "<group>"; };
CDD9E4F418A144E4006EEC0D /* Trovebox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Trovebox.app; sourceTree = BUILT_PRODUCTS_DIR; }; CDD9E4F418A144E4006EEC0D /* Trovebox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Trovebox.app; sourceTree = BUILT_PRODUCTS_DIR; };
CDD9E4F718A144E4006EEC0D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; CDD9E4F718A144E4006EEC0D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
CDD9E4F918A144E4006EEC0D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; CDD9E4F918A144E4006EEC0D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
@ -564,72 +520,10 @@
path = Crypto; path = Crypto;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
CD490A2F18A1639600CFECE0 /* TSAlertView */ = {
isa = PBXGroup;
children = (
CD490A3018A1639600CFECE0 /* Demo */,
CD490A3F18A1639600CFECE0 /* README.mdown */,
CD490A4018A1639600CFECE0 /* Source Code License.rtf */,
CD490A4118A1639600CFECE0 /* TSAlertView */,
);
name = TSAlertView;
path = Trovebox/TSAlertView;
sourceTree = "<group>";
};
CD490A3018A1639600CFECE0 /* Demo */ = {
isa = PBXGroup;
children = (
CD490A3118A1639600CFECE0 /* Classes */,
CD490A3718A1639600CFECE0 /* main.m */,
CD490A3818A1639600CFECE0 /* MainWindow-iPad.xib */,
CD490A3918A1639600CFECE0 /* MainWindow.xib */,
CD490A3A18A1639600CFECE0 /* TSAVDemo-Info.plist */,
CD490A3B18A1639600CFECE0 /* TSAVDemo.xcodeproj */,
CD490A3E18A1639600CFECE0 /* TSAVDemo_Prefix.pch */,
);
path = Demo;
sourceTree = "<group>";
};
CD490A3118A1639600CFECE0 /* Classes */ = {
isa = PBXGroup;
children = (
CD490A3218A1639600CFECE0 /* TSAVDemoAppDelegate.h */,
CD490A3318A1639600CFECE0 /* TSAVDemoAppDelegate.m */,
CD490A3418A1639600CFECE0 /* TSAVDemoViewController.h */,
CD490A3518A1639600CFECE0 /* TSAVDemoViewController.m */,
CD490A3618A1639600CFECE0 /* TSAVDemoViewController.xib */,
);
path = Classes;
sourceTree = "<group>";
};
CD490A3C18A1639600CFECE0 /* Products */ = {
isa = PBXGroup;
children = (
CD490A5C18A1639600CFECE0 /* TSAVDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
CD490A4118A1639600CFECE0 /* TSAlertView */ = {
isa = PBXGroup;
children = (
CD490A4218A1639600CFECE0 /* TSAlertView.h */,
CD490A4318A1639600CFECE0 /* TSAlertView.m */,
CD490A4418A1639600CFECE0 /* TSAlertViewBackground.png */,
CD490A4518A1639600CFECE0 /* TSAlertViewBackground2.png */,
CD490A4618A1639600CFECE0 /* TSAlertViewButtonBackground.png */,
CD490A4718A1639600CFECE0 /* TSAlertViewButtonBackground_Highlighted.png */,
CD490A4818A1639600CFECE0 /* TSAlertViewCancelButtonBackground.png */,
CD490A4918A1639600CFECE0 /* TSAlertViewMessageListViewShadow.png */,
);
path = TSAlertView;
sourceTree = "<group>";
};
CD490A5D18A1639A00CFECE0 /* Others Codes */ = { CD490A5D18A1639A00CFECE0 /* Others Codes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
CD4909F818A1628700CFECE0 /* OAuth */, CD4909F818A1628700CFECE0 /* OAuth */,
CD490A2F18A1639600CFECE0 /* TSAlertView */,
); );
name = "Others Codes"; name = "Others Codes";
sourceTree = "<group>"; sourceTree = "<group>";
@ -1060,12 +954,6 @@
mainGroup = CDD9E4EB18A144E4006EEC0D; mainGroup = CDD9E4EB18A144E4006EEC0D;
productRefGroup = CDD9E4F518A144E4006EEC0D /* Products */; productRefGroup = CDD9E4F518A144E4006EEC0D /* Products */;
projectDirPath = ""; projectDirPath = "";
projectReferences = (
{
ProductGroup = CD490A3C18A1639600CFECE0 /* Products */;
ProjectRef = CD490A3B18A1639600CFECE0 /* TSAVDemo.xcodeproj */;
},
);
projectRoot = ""; projectRoot = "";
targets = ( targets = (
CDD9E4F318A144E4006EEC0D /* Trovebox */, CDD9E4F318A144E4006EEC0D /* Trovebox */,
@ -1074,58 +962,36 @@
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXReferenceProxy section */
CD490A5C18A1639600CFECE0 /* TSAVDemo.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = TSAVDemo.app;
remoteRef = CD490A5B18A1639600CFECE0 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
CDD9E4F218A144E4006EEC0D /* Resources */ = { CDD9E4F218A144E4006EEC0D /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
CD490A5818A1639600CFECE0 /* TSAlertViewCancelButtonBackground.png in Resources */,
CDD9E5C018A14707006EEC0D /* ProfileViewController.xib in Resources */, CDD9E5C018A14707006EEC0D /* ProfileViewController.xib in Resources */,
CDD9E58318A1469E006EEC0D /* AuthenticationViewController5.xib in Resources */, CDD9E58318A1469E006EEC0D /* AuthenticationViewController5.xib in Resources */,
CDD9E5B118A146EB006EEC0D /* NewestPhotoCelliPad.xib in Resources */, CDD9E5B118A146EB006EEC0D /* NewestPhotoCelliPad.xib in Resources */,
CDD9E5B418A146EB006EEC0D /* UploadCelliPad.xib in Resources */, CDD9E5B418A146EB006EEC0D /* UploadCelliPad.xib in Resources */,
CDD9E66618A147F2006EEC0D /* Localizable.strings in Resources */, CDD9E66618A147F2006EEC0D /* Localizable.strings in Resources */,
CDD9E58218A1469E006EEC0D /* AuthenticationViewController.xib in Resources */, CDD9E58218A1469E006EEC0D /* AuthenticationViewController.xib in Resources */,
CD490A5918A1639600CFECE0 /* TSAlertViewMessageListViewShadow.png in Resources */,
CD490A5718A1639600CFECE0 /* TSAlertViewButtonBackground_Highlighted.png in Resources */,
CDD9E59B18A146CC006EEC0D /* MenuTableViewSectionCell.xib in Resources */, CDD9E59B18A146CC006EEC0D /* MenuTableViewSectionCell.xib in Resources */,
CDD9E5B318A146EB006EEC0D /* UploadCell.xib in Resources */, CDD9E5B318A146EB006EEC0D /* UploadCell.xib in Resources */,
CD490A5418A1639600CFECE0 /* TSAlertViewBackground.png in Resources */,
CDD9E59D18A146CC006EEC0D /* MenuTableViewSearchCell.xib in Resources */, CDD9E59D18A146CC006EEC0D /* MenuTableViewSearchCell.xib in Resources */,
CDD9E5C118A14707006EEC0D /* ProfileViewControlleriPad.xib in Resources */, CDD9E5C118A14707006EEC0D /* ProfileViewControlleriPad.xib in Resources */,
CD490A4E18A1639600CFECE0 /* MainWindow-iPad.xib in Resources */,
CD490A5618A1639600CFECE0 /* TSAlertViewButtonBackground.png in Resources */,
CDD9E60118A14754006EEC0D /* MWPhotoBrowser.bundle in Resources */, CDD9E60118A14754006EEC0D /* MWPhotoBrowser.bundle in Resources */,
CDD9E5CF18A1472A006EEC0D /* PhotoViewController.xib in Resources */, CDD9E5CF18A1472A006EEC0D /* PhotoViewController.xib in Resources */,
CD490A5118A1639600CFECE0 /* README.mdown in Resources */,
CDD9E50418A144E4006EEC0D /* InfoPlist.strings in Resources */, CDD9E50418A144E4006EEC0D /* InfoPlist.strings in Resources */,
CDD9E58618A1469E006EEC0D /* MultiSiteSelectionCell.xib in Resources */, CDD9E58618A1469E006EEC0D /* MultiSiteSelectionCell.xib in Resources */,
CDD9E5B018A146EB006EEC0D /* NewestPhotoCell.xib in Resources */, CDD9E5B018A146EB006EEC0D /* NewestPhotoCell.xib in Resources */,
CDD9E5C218A14707006EEC0D /* Settings.bundle in Resources */, CDD9E5C218A14707006EEC0D /* Settings.bundle in Resources */,
CD490A5518A1639600CFECE0 /* TSAlertViewBackground2.png in Resources */,
CD490A5218A1639600CFECE0 /* Source Code License.rtf in Resources */,
CDD9E5E718A1473B006EEC0D /* ELCImagePickerController.xib in Resources */, CDD9E5E718A1473B006EEC0D /* ELCImagePickerController.xib in Resources */,
CDD9E5EA18A1473B006EEC0D /* SyncViewController.xib in Resources */, CDD9E5EA18A1473B006EEC0D /* SyncViewController.xib in Resources */,
CDD9E57F18A1469E006EEC0D /* LoginConnectViewController.xib in Resources */, CDD9E57F18A1469E006EEC0D /* LoginConnectViewController.xib in Resources */,
CDD9E50F18A144E4006EEC0D /* Images.xcassets in Resources */, CDD9E50F18A144E4006EEC0D /* Images.xcassets in Resources */,
CDD9E57C18A1469E006EEC0D /* LoginViewController5.xib in Resources */, CDD9E57C18A1469E006EEC0D /* LoginViewController5.xib in Resources */,
CD490A4C18A1639600CFECE0 /* TSAVDemoViewController.xib in Resources */,
CDD9E57D18A1469E006EEC0D /* LoginViewControlleriPad.xib in Resources */, CDD9E57D18A1469E006EEC0D /* LoginViewControlleriPad.xib in Resources */,
CDD9E59918A146CC006EEC0D /* MenuTableViewCell.xib in Resources */, CDD9E59918A146CC006EEC0D /* MenuTableViewCell.xib in Resources */,
CDD9E5E518A1473B006EEC0D /* ELCAssetPicker.xib in Resources */, CDD9E5E518A1473B006EEC0D /* ELCAssetPicker.xib in Resources */,
CD490A4F18A1639600CFECE0 /* MainWindow.xib in Resources */,
CDD9E5D018A1472A006EEC0D /* PhotoViewController5.xib in Resources */, CDD9E5D018A1472A006EEC0D /* PhotoViewController5.xib in Resources */,
CD490A5018A1639600CFECE0 /* TSAVDemo-Info.plist in Resources */,
CDD9E57B18A1469E006EEC0D /* LoginViewController.xib in Resources */, CDD9E57B18A1469E006EEC0D /* LoginViewController.xib in Resources */,
CDD9E58018A1469E006EEC0D /* LoginConnectViewController5.xib in Resources */, CDD9E58018A1469E006EEC0D /* LoginConnectViewController5.xib in Resources */,
); );
@ -1205,7 +1071,6 @@
CDD9E58118A1469E006EEC0D /* AuthenticationViewController.m in Sources */, CDD9E58118A1469E006EEC0D /* AuthenticationViewController.m in Sources */,
CD490A2618A1628700CFECE0 /* OAPlaintextSignatureProvider.m in Sources */, CD490A2618A1628700CFECE0 /* OAPlaintextSignatureProvider.m in Sources */,
CDD9E59F18A146CC006EEC0D /* UINavigationItem+Trovebox.m in Sources */, CDD9E59F18A146CC006EEC0D /* UINavigationItem+Trovebox.m in Sources */,
CD490A4D18A1639600CFECE0 /* main.m in Sources */,
CDD9E60818A14754006EEC0D /* GalleryViewController.m in Sources */, CDD9E60818A14754006EEC0D /* GalleryViewController.m in Sources */,
CD490A2018A1628700CFECE0 /* sha1.c in Sources */, CD490A2018A1628700CFECE0 /* sha1.c in Sources */,
CDD9E59818A146CC006EEC0D /* MenuTableViewCell.m in Sources */, CDD9E59818A146CC006EEC0D /* MenuTableViewCell.m in Sources */,
@ -1213,7 +1078,6 @@
CDD9E66018A147A7006EEC0D /* PhotoSHKConfigurator.m in Sources */, CDD9E66018A147A7006EEC0D /* PhotoSHKConfigurator.m in Sources */,
CD490A1D18A1628700CFECE0 /* NSURL+Base.m in Sources */, CD490A1D18A1628700CFECE0 /* NSURL+Base.m in Sources */,
CDD9E65518A147A7006EEC0D /* DateUtilities.m in Sources */, CDD9E65518A147A7006EEC0D /* DateUtilities.m in Sources */,
CD490A4B18A1639600CFECE0 /* TSAVDemoViewController.m in Sources */,
CDD9E59E18A146CC006EEC0D /* UINavigationBar+Trovebox.m in Sources */, CDD9E59E18A146CC006EEC0D /* UINavigationBar+Trovebox.m in Sources */,
CD490A1E18A1628700CFECE0 /* Base64Transcoder.c in Sources */, CD490A1E18A1628700CFECE0 /* Base64Transcoder.c in Sources */,
CDD9E60718A14754006EEC0D /* MWZoomingScrollView.m in Sources */, CDD9E60718A14754006EEC0D /* MWZoomingScrollView.m in Sources */,
@ -1239,9 +1103,7 @@
CDD9E57A18A1469E006EEC0D /* LoginViewController.m in Sources */, CDD9E57A18A1469E006EEC0D /* LoginViewController.m in Sources */,
CDD9E65618A147A7006EEC0D /* ImageManipulation.m in Sources */, CDD9E65618A147A7006EEC0D /* ImageManipulation.m in Sources */,
CDD9E59C18A146CC006EEC0D /* MenuTableViewSearchCell.m in Sources */, CDD9E59C18A146CC006EEC0D /* MenuTableViewSearchCell.m in Sources */,
CD490A4A18A1639600CFECE0 /* TSAVDemoAppDelegate.m in Sources */,
CDD9E65318A147A7006EEC0D /* UpdateUtilities.m in Sources */, CDD9E65318A147A7006EEC0D /* UpdateUtilities.m in Sources */,
CD490A5318A1639600CFECE0 /* TSAlertView.m in Sources */,
CDD9E58518A1469E006EEC0D /* MultiSiteSelectionCell.m in Sources */, CDD9E58518A1469E006EEC0D /* MultiSiteSelectionCell.m in Sources */,
CDD9E56518A1467F006EEC0D /* Synced.m in Sources */, CDD9E56518A1467F006EEC0D /* Synced.m in Sources */,
CDD9E50A18A144E4006EEC0D /* AppDelegate.m in Sources */, CDD9E50A18A144E4006EEC0D /* AppDelegate.m in Sources */,

View file

@ -1,3 +1,4 @@
// //
// Account // Account
// Trovebox // Trovebox

View file

@ -18,7 +18,6 @@
// limitations under the License. // limitations under the License.
// //
#import "TSAlertView.h"
#import "WebService.h" #import "WebService.h"
#import "MBProgressHUD.h" #import "MBProgressHUD.h"
#import "PhotoAlertView.h" #import "PhotoAlertView.h"
@ -27,7 +26,7 @@
// image cache // image cache
#import <SDWebImage/UIImageView+WebCache.h> #import <SDWebImage/UIImageView+WebCache.h>
@interface AlbumViewController : UITableViewController<TSAlertViewDelegate, UINavigationControllerDelegate> @interface AlbumViewController : UITableViewController<UIAlertViewDelegate, UINavigationControllerDelegate>
@property (nonatomic, strong) NSMutableArray *albums; @property (nonatomic, strong) NSMutableArray *albums;

View file

@ -334,22 +334,25 @@
NSLog(@"Adding new album"); NSLog(@"Adding new album");
#endif #endif
TSAlertView* av = [[TSAlertView alloc] initWithTitle:NSLocalizedString(@"Enter new album name",@"Album screen - create a new album") message:nil delegate:self UIAlertView* av = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Enter new album name",@"Album screen - create a new album") message:nil delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel",nil) cancelButtonTitle:NSLocalizedString(@"Cancel",nil)
otherButtonTitles:NSLocalizedString(@"OK",nil),nil]; otherButtonTitles:NSLocalizedString(@"OK",nil),nil];
av.style = TSAlertViewStyleInput; alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[av show]; [av show];
} }
// after animation // after animation
- (void) alertView: (TSAlertView *) alertView didDismissWithButtonIndex: (NSInteger) buttonIndex - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{ {
UITextField *textField = [alertView textFieldAtIndex:0];
// cancel // cancel
if( buttonIndex == 0 || alertView.inputTextField.text == nil || alertView.inputTextField.text.length==0) if( buttonIndex == 0 || textField.text == nil || textField.text.length==0)
return; return;
// add the new tag in the list and select it // add the new tag in the list and select it
Album *album = [[Album alloc] initWithAlbumName:alertView.inputTextField.text]; Album *album = [[Album alloc] initWithAlbumName:textField.text];
MBProgressHUD *hud =[MBProgressHUD showHUDAddedTo:self.view animated:YES]; MBProgressHUD *hud =[MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.labelText = NSLocalizedString(@"Creating",@"Creating Album"); hud.labelText = NSLocalizedString(@"Creating",@"Creating Album");

View file

@ -0,0 +1,3 @@
DLCImagePickerController.xcodeproj/xcuserdata
DLCImagePickerController.xcodeproj/project.xcworkspace
.DS_Store

View file

@ -0,0 +1,3 @@
[submodule "GPUImage"]
path = GPUImage
url = git://github.com/BradLarson/GPUImage.git

View file

@ -0,0 +1,732 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
6A0D0A01165A1CBE0028E1B6 /* BlurOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A0D0A00165A1CBE0028E1B6 /* BlurOverlayView.m */; };
6A0D0A0F165A1FFC0028E1B6 /* focus-crosshair.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D0A0D165A1FFC0028E1B6 /* focus-crosshair.png */; };
6A0D0A10165A1FFC0028E1B6 /* focus-crosshair@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D0A0E165A1FFC0028E1B6 /* focus-crosshair@2x.png */; };
6A0D0A28165A218F0028E1B6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A0D0A27165A218F0028E1B6 /* Default-568h@2x.png */; };
6A23390E15E6C17000CC6CB2 /* library@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A23390C15E6C17000CC6CB2 /* library@2x.png */; };
6A23390F15E6C17000CC6CB2 /* library.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A23390D15E6C17000CC6CB2 /* library.png */; };
6A42CF7615E46F0E0062D3E7 /* blur-on.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A42CF7415E46F0E0062D3E7 /* blur-on.png */; };
6A42CF7715E46F0E0062D3E7 /* blur-on@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A42CF7515E46F0E0062D3E7 /* blur-on@2x.png */; };
6A49CEA715E345070098304F /* blackframe.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEA615E345070098304F /* blackframe.png */; };
6A49CED815E459B00098304F /* filter-close.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CED415E459B00098304F /* filter-close.png */; };
6A49CED915E459B00098304F /* filter-close@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CED515E459B00098304F /* filter-close@2x.png */; };
6A49CEDA15E459B00098304F /* filter-open.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CED615E459B00098304F /* filter-open.png */; };
6A49CEDB15E459B00098304F /* filter-open@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CED715E459B00098304F /* filter-open@2x.png */; };
6A49CEEC15E45A5F0098304F /* camera-button.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEE815E45A5F0098304F /* camera-button.png */; };
6A49CEED15E45A5F0098304F /* camera-button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEE915E45A5F0098304F /* camera-button@2x.png */; };
6A49CEEE15E45A5F0098304F /* camera-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEEA15E45A5F0098304F /* camera-icon.png */; };
6A49CEEF15E45A5F0098304F /* camera-icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEEB15E45A5F0098304F /* camera-icon@2x.png */; };
6A49CEF215E460540098304F /* filter.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEF015E460540098304F /* filter.png */; };
6A49CEF315E460540098304F /* filter@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEF115E460540098304F /* filter@2x.png */; };
6A49CEFA15E461670098304F /* flash-auto.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEF415E461670098304F /* flash-auto.png */; };
6A49CEFB15E461670098304F /* flash-auto@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEF515E461670098304F /* flash-auto@2x.png */; };
6A49CEFC15E461670098304F /* flash-off.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEF615E461670098304F /* flash-off.png */; };
6A49CEFD15E461670098304F /* flash-off@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEF715E461670098304F /* flash-off@2x.png */; };
6A49CEFE15E461670098304F /* flash.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEF815E461670098304F /* flash.png */; };
6A49CEFF15E461670098304F /* flash@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CEF915E461670098304F /* flash@2x.png */; };
6A49CF0215E4617A0098304F /* front-camera.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CF0015E4617A0098304F /* front-camera.png */; };
6A49CF0315E4617A0098304F /* front-camera@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CF0115E4617A0098304F /* front-camera@2x.png */; };
6A49CF0615E461B30098304F /* blur.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CF0415E461B30098304F /* blur.png */; };
6A49CF0715E461B30098304F /* blur@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CF0515E461B30098304F /* blur@2x.png */; };
6A49CF0A15E461D10098304F /* close.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CF0815E461D10098304F /* close.png */; };
6A49CF0B15E461D10098304F /* close@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A49CF0915E461D10098304F /* close@2x.png */; };
6A55309515E4869600019CC9 /* 1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A55309315E4869600019CC9 /* 1.jpg */; };
6A55309615E4869600019CC9 /* 1@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A55309415E4869600019CC9 /* 1@2x.jpg */; };
6A55309915E486A600019CC9 /* 2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A55309715E486A600019CC9 /* 2.jpg */; };
6A55309A15E486A600019CC9 /* 2@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A55309815E486A600019CC9 /* 2@2x.jpg */; };
6A55309D15E486B300019CC9 /* 3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A55309B15E486B300019CC9 /* 3.jpg */; };
6A55309E15E486B300019CC9 /* 3@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A55309C15E486B300019CC9 /* 3@2x.jpg */; };
6A5530A115E486BB00019CC9 /* 4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A55309F15E486BB00019CC9 /* 4.jpg */; };
6A5530A215E486BB00019CC9 /* 4@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530A015E486BB00019CC9 /* 4@2x.jpg */; };
6A5530A515E486C300019CC9 /* 5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530A315E486C300019CC9 /* 5.jpg */; };
6A5530A615E486C300019CC9 /* 5@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530A415E486C300019CC9 /* 5@2x.jpg */; };
6A5530A915E486CB00019CC9 /* 6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530A715E486CB00019CC9 /* 6.jpg */; };
6A5530AA15E486CB00019CC9 /* 6@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530A815E486CB00019CC9 /* 6@2x.jpg */; };
6A5530AD15E486D500019CC9 /* 7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530AB15E486D500019CC9 /* 7.jpg */; };
6A5530AE15E486D500019CC9 /* 7@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530AC15E486D500019CC9 /* 7@2x.jpg */; };
6A5530B115E486DD00019CC9 /* 8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530AF15E486DD00019CC9 /* 8.jpg */; };
6A5530B215E486DD00019CC9 /* 8@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530B015E486DD00019CC9 /* 8@2x.jpg */; };
6A5530B515E486E300019CC9 /* 9.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530B315E486E300019CC9 /* 9.jpg */; };
6A5530B615E486E300019CC9 /* 9@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530B415E486E300019CC9 /* 9@2x.jpg */; };
6A5530B915E486E900019CC9 /* 10.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530B715E486E900019CC9 /* 10.jpg */; };
6A5530BA15E486E900019CC9 /* 10@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6A5530B815E486E900019CC9 /* 10@2x.jpg */; };
6A5BBDA815E2214B00B1B485 /* 02.acv in Resources */ = {isa = PBXBuildFile; fileRef = 6A5BBDA515E2214B00B1B485 /* 02.acv */; };
6A5BBDA915E2214B00B1B485 /* 06.acv in Resources */ = {isa = PBXBuildFile; fileRef = 6A5BBDA615E2214B00B1B485 /* 06.acv */; };
6A5BBDAA15E2214B00B1B485 /* 17.acv in Resources */ = {isa = PBXBuildFile; fileRef = 6A5BBDA715E2214B00B1B485 /* 17.acv */; };
6A5D9A1515E0152D001FAD14 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A1415E0152D001FAD14 /* UIKit.framework */; };
6A5D9A1715E0152D001FAD14 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A1615E0152D001FAD14 /* Foundation.framework */; };
6A5D9A1915E0152D001FAD14 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A1815E0152D001FAD14 /* CoreGraphics.framework */; };
6A5D9A1F15E0152D001FAD14 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6A5D9A1D15E0152D001FAD14 /* InfoPlist.strings */; };
6A5D9A2115E0152D001FAD14 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A5D9A2015E0152D001FAD14 /* main.m */; };
6A5D9A2515E0152E001FAD14 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A5D9A2415E0152D001FAD14 /* AppDelegate.m */; };
6A5D9A2C15E01587001FAD14 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A2B15E01587001FAD14 /* CoreMedia.framework */; };
6A5D9A2E15E01590001FAD14 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A2D15E01590001FAD14 /* CoreVideo.framework */; };
6A5D9A3015E01598001FAD14 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A2F15E01598001FAD14 /* QuartzCore.framework */; };
6A5D9A3215E015A1001FAD14 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A3115E015A1001FAD14 /* OpenGLES.framework */; };
6A5D9A3415E015B3001FAD14 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A3315E015B3001FAD14 /* AVFoundation.framework */; };
6A5D9A5715E01BD7001FAD14 /* libGPUImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A5215E01B72001FAD14 /* libGPUImage.a */; };
6A5D9A5915E01DA4001FAD14 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5D9A5815E01DA4001FAD14 /* AssetsLibrary.framework */; };
6A5D9A8815E02429001FAD14 /* DLCImagePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A5D9A8715E02429001FAD14 /* DLCImagePickerController.m */; };
6A5D9A8B15E02504001FAD14 /* PhotoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A5D9A8A15E02504001FAD14 /* PhotoViewController.m */; };
6A5D9AA115E02527001FAD14 /* mask.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A5D9A9415E02527001FAD14 /* mask.png */; };
6A5D9AA215E02527001FAD14 /* dock_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A5D9A9615E02527001FAD14 /* dock_bg.png */; };
6A5D9AA315E02527001FAD14 /* dock_bg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A5D9A9715E02527001FAD14 /* dock_bg@2x.png */; };
6A5D9AA415E02527001FAD14 /* micro_carbon.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A5D9A9815E02527001FAD14 /* micro_carbon.png */; };
6A5D9AA515E02527001FAD14 /* micro_carbon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A5D9A9915E02527001FAD14 /* micro_carbon@2x.png */; };
6A5D9AA615E02527001FAD14 /* photo_bar.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A5D9A9A15E02527001FAD14 /* photo_bar.png */; };
6A5D9AA715E02527001FAD14 /* photo_bar@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6A5D9A9B15E02527001FAD14 /* photo_bar@2x.png */; };
6A5D9AAA15E0259A001FAD14 /* DLCImagePicker.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A5D9AA915E0259A001FAD14 /* DLCImagePicker.xib */; };
7D0E5AB315E203FA009D19C9 /* purple-green.acv in Resources */ = {isa = PBXBuildFile; fileRef = 7D0E5AB115E203FA009D19C9 /* purple-green.acv */; };
7D0E5AB415E203FA009D19C9 /* yellow-red.acv in Resources */ = {isa = PBXBuildFile; fileRef = 7D0E5AB215E203FA009D19C9 /* yellow-red.acv */; };
7D0E5AB815E209AD009D19C9 /* GrayscaleContrastFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D0E5AB715E209AD009D19C9 /* GrayscaleContrastFilter.m */; };
7D1E64B915E1FA2F005A9E09 /* crossprocess.acv in Resources */ = {isa = PBXBuildFile; fileRef = 7D1E64B715E1FA2F005A9E09 /* crossprocess.acv */; };
7DEB4DC615E063420078BFAD /* sample1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 7DEB4DC515E063420078BFAD /* sample1.jpg */; };
7DFAE1BA15E22A9F00C8236F /* aqua.acv in Resources */ = {isa = PBXBuildFile; fileRef = 7DFAE1B915E22A9F00C8236F /* aqua.acv */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
6A5D9A5115E01B72001FAD14 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6A5D9A4815E01B72001FAD14 /* GPUImage.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = BCF1A33414DDB1EC00852800;
remoteInfo = GPUImage;
};
6A5D9A5315E01B72001FAD14 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6A5D9A4815E01B72001FAD14 /* GPUImage.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = BCF1A34414DDB1EC00852800;
remoteInfo = GPUImageTests;
};
6A5D9A5515E01BC2001FAD14 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6A5D9A4815E01B72001FAD14 /* GPUImage.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = BCF1A33314DDB1EC00852800;
remoteInfo = GPUImage;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
6A0D09FF165A1CBE0028E1B6 /* BlurOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlurOverlayView.h; sourceTree = "<group>"; };
6A0D0A00165A1CBE0028E1B6 /* BlurOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlurOverlayView.m; sourceTree = "<group>"; };
6A0D0A0D165A1FFC0028E1B6 /* focus-crosshair.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "focus-crosshair.png"; sourceTree = "<group>"; };
6A0D0A0E165A1FFC0028E1B6 /* focus-crosshair@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "focus-crosshair@2x.png"; sourceTree = "<group>"; };
6A0D0A27165A218F0028E1B6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../Default-568h@2x.png"; sourceTree = "<group>"; };
6A23390C15E6C17000CC6CB2 /* library@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "library@2x.png"; sourceTree = "<group>"; };
6A23390D15E6C17000CC6CB2 /* library.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = library.png; sourceTree = "<group>"; };
6A42CF7415E46F0E0062D3E7 /* blur-on.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "blur-on.png"; sourceTree = "<group>"; };
6A42CF7515E46F0E0062D3E7 /* blur-on@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "blur-on@2x.png"; sourceTree = "<group>"; };
6A49CEA615E345070098304F /* blackframe.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = blackframe.png; sourceTree = "<group>"; };
6A49CED415E459B00098304F /* filter-close.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "filter-close.png"; sourceTree = "<group>"; };
6A49CED515E459B00098304F /* filter-close@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "filter-close@2x.png"; sourceTree = "<group>"; };
6A49CED615E459B00098304F /* filter-open.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "filter-open.png"; sourceTree = "<group>"; };
6A49CED715E459B00098304F /* filter-open@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "filter-open@2x.png"; sourceTree = "<group>"; };
6A49CEE815E45A5F0098304F /* camera-button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camera-button.png"; sourceTree = "<group>"; };
6A49CEE915E45A5F0098304F /* camera-button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camera-button@2x.png"; sourceTree = "<group>"; };
6A49CEEA15E45A5F0098304F /* camera-icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camera-icon.png"; sourceTree = "<group>"; };
6A49CEEB15E45A5F0098304F /* camera-icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camera-icon@2x.png"; sourceTree = "<group>"; };
6A49CEF015E460540098304F /* filter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = filter.png; sourceTree = "<group>"; };
6A49CEF115E460540098304F /* filter@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "filter@2x.png"; sourceTree = "<group>"; };
6A49CEF415E461670098304F /* flash-auto.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "flash-auto.png"; sourceTree = "<group>"; };
6A49CEF515E461670098304F /* flash-auto@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "flash-auto@2x.png"; sourceTree = "<group>"; };
6A49CEF615E461670098304F /* flash-off.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "flash-off.png"; sourceTree = "<group>"; };
6A49CEF715E461670098304F /* flash-off@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "flash-off@2x.png"; sourceTree = "<group>"; };
6A49CEF815E461670098304F /* flash.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = flash.png; sourceTree = "<group>"; };
6A49CEF915E461670098304F /* flash@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "flash@2x.png"; sourceTree = "<group>"; };
6A49CF0015E4617A0098304F /* front-camera.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "front-camera.png"; sourceTree = "<group>"; };
6A49CF0115E4617A0098304F /* front-camera@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "front-camera@2x.png"; sourceTree = "<group>"; };
6A49CF0415E461B30098304F /* blur.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = blur.png; sourceTree = "<group>"; };
6A49CF0515E461B30098304F /* blur@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "blur@2x.png"; sourceTree = "<group>"; };
6A49CF0815E461D10098304F /* close.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = close.png; sourceTree = "<group>"; };
6A49CF0915E461D10098304F /* close@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close@2x.png"; sourceTree = "<group>"; };
6A55309315E4869600019CC9 /* 1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1.jpg; sourceTree = "<group>"; };
6A55309415E4869600019CC9 /* 1@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "1@2x.jpg"; sourceTree = "<group>"; };
6A55309715E486A600019CC9 /* 2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 2.jpg; sourceTree = "<group>"; };
6A55309815E486A600019CC9 /* 2@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "2@2x.jpg"; sourceTree = "<group>"; };
6A55309B15E486B300019CC9 /* 3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 3.jpg; sourceTree = "<group>"; };
6A55309C15E486B300019CC9 /* 3@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "3@2x.jpg"; sourceTree = "<group>"; };
6A55309F15E486BB00019CC9 /* 4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 4.jpg; sourceTree = "<group>"; };
6A5530A015E486BB00019CC9 /* 4@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "4@2x.jpg"; sourceTree = "<group>"; };
6A5530A315E486C300019CC9 /* 5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 5.jpg; sourceTree = "<group>"; };
6A5530A415E486C300019CC9 /* 5@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "5@2x.jpg"; sourceTree = "<group>"; };
6A5530A715E486CB00019CC9 /* 6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 6.jpg; sourceTree = "<group>"; };
6A5530A815E486CB00019CC9 /* 6@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "6@2x.jpg"; sourceTree = "<group>"; };
6A5530AB15E486D500019CC9 /* 7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 7.jpg; sourceTree = "<group>"; };
6A5530AC15E486D500019CC9 /* 7@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "7@2x.jpg"; sourceTree = "<group>"; };
6A5530AF15E486DD00019CC9 /* 8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 8.jpg; sourceTree = "<group>"; };
6A5530B015E486DD00019CC9 /* 8@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "8@2x.jpg"; sourceTree = "<group>"; };
6A5530B315E486E300019CC9 /* 9.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 9.jpg; sourceTree = "<group>"; };
6A5530B415E486E300019CC9 /* 9@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "9@2x.jpg"; sourceTree = "<group>"; };
6A5530B715E486E900019CC9 /* 10.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 10.jpg; sourceTree = "<group>"; };
6A5530B815E486E900019CC9 /* 10@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "10@2x.jpg"; sourceTree = "<group>"; };
6A5BBDA515E2214B00B1B485 /* 02.acv */ = {isa = PBXFileReference; lastKnownFileType = file; name = 02.acv; path = Filters/02.acv; sourceTree = "<group>"; };
6A5BBDA615E2214B00B1B485 /* 06.acv */ = {isa = PBXFileReference; lastKnownFileType = file; name = 06.acv; path = Filters/06.acv; sourceTree = "<group>"; };
6A5BBDA715E2214B00B1B485 /* 17.acv */ = {isa = PBXFileReference; lastKnownFileType = file; name = 17.acv; path = Filters/17.acv; sourceTree = "<group>"; };
6A5D9A1015E0152D001FAD14 /* DLCImagePickerController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DLCImagePickerController.app; sourceTree = BUILT_PRODUCTS_DIR; };
6A5D9A1415E0152D001FAD14 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
6A5D9A1615E0152D001FAD14 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
6A5D9A1815E0152D001FAD14 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
6A5D9A1C15E0152D001FAD14 /* DLCImagePickerController-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DLCImagePickerController-Info.plist"; sourceTree = "<group>"; };
6A5D9A1E15E0152D001FAD14 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6A5D9A2015E0152D001FAD14 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
6A5D9A2215E0152D001FAD14 /* DLCImagePickerController-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DLCImagePickerController-Prefix.pch"; sourceTree = "<group>"; };
6A5D9A2315E0152D001FAD14 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
6A5D9A2415E0152D001FAD14 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
6A5D9A2B15E01587001FAD14 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
6A5D9A2D15E01590001FAD14 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
6A5D9A2F15E01598001FAD14 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
6A5D9A3115E015A1001FAD14 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
6A5D9A3315E015B3001FAD14 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
6A5D9A4815E01B72001FAD14 /* GPUImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GPUImage.xcodeproj; path = GPUImage/framework/GPUImage.xcodeproj; sourceTree = "<group>"; };
6A5D9A5815E01DA4001FAD14 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
6A5D9A8615E02429001FAD14 /* DLCImagePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DLCImagePickerController.h; sourceTree = "<group>"; };
6A5D9A8715E02429001FAD14 /* DLCImagePickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DLCImagePickerController.m; sourceTree = "<group>"; };
6A5D9A8915E02504001FAD14 /* PhotoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoViewController.h; sourceTree = "<group>"; };
6A5D9A8A15E02504001FAD14 /* PhotoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoViewController.m; sourceTree = "<group>"; };
6A5D9A9415E02527001FAD14 /* mask.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mask.png; sourceTree = "<group>"; };
6A5D9A9615E02527001FAD14 /* dock_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = dock_bg.png; sourceTree = "<group>"; };
6A5D9A9715E02527001FAD14 /* dock_bg@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "dock_bg@2x.png"; sourceTree = "<group>"; };
6A5D9A9815E02527001FAD14 /* micro_carbon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = micro_carbon.png; sourceTree = "<group>"; };
6A5D9A9915E02527001FAD14 /* micro_carbon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "micro_carbon@2x.png"; sourceTree = "<group>"; };
6A5D9A9A15E02527001FAD14 /* photo_bar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo_bar.png; sourceTree = "<group>"; };
6A5D9A9B15E02527001FAD14 /* photo_bar@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "photo_bar@2x.png"; sourceTree = "<group>"; };
6A5D9AA915E0259A001FAD14 /* DLCImagePicker.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DLCImagePicker.xib; sourceTree = "<group>"; };
7D0E5AB115E203FA009D19C9 /* purple-green.acv */ = {isa = PBXFileReference; lastKnownFileType = file; name = "purple-green.acv"; path = "Filters/purple-green.acv"; sourceTree = "<group>"; };
7D0E5AB215E203FA009D19C9 /* yellow-red.acv */ = {isa = PBXFileReference; lastKnownFileType = file; name = "yellow-red.acv"; path = "Filters/yellow-red.acv"; sourceTree = "<group>"; };
7D0E5AB615E2099C009D19C9 /* GrayscaleContrastFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrayscaleContrastFilter.h; sourceTree = "<group>"; };
7D0E5AB715E209AD009D19C9 /* GrayscaleContrastFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GrayscaleContrastFilter.m; sourceTree = "<group>"; };
7D1E64B715E1FA2F005A9E09 /* crossprocess.acv */ = {isa = PBXFileReference; lastKnownFileType = file; name = crossprocess.acv; path = Filters/crossprocess.acv; sourceTree = "<group>"; };
7DEB4DC515E063420078BFAD /* sample1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = sample1.jpg; path = Samples/sample1.jpg; sourceTree = "<group>"; };
7DFAE1B915E22A9F00C8236F /* aqua.acv */ = {isa = PBXFileReference; lastKnownFileType = file; name = aqua.acv; path = Filters/aqua.acv; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
6A5D9A0D15E0152D001FAD14 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6A5D9A5915E01DA4001FAD14 /* AssetsLibrary.framework in Frameworks */,
6A5D9A5715E01BD7001FAD14 /* libGPUImage.a in Frameworks */,
6A5D9A3415E015B3001FAD14 /* AVFoundation.framework in Frameworks */,
6A5D9A3215E015A1001FAD14 /* OpenGLES.framework in Frameworks */,
6A5D9A3015E01598001FAD14 /* QuartzCore.framework in Frameworks */,
6A5D9A2E15E01590001FAD14 /* CoreVideo.framework in Frameworks */,
6A5D9A2C15E01587001FAD14 /* CoreMedia.framework in Frameworks */,
6A5D9A1515E0152D001FAD14 /* UIKit.framework in Frameworks */,
6A5D9A1715E0152D001FAD14 /* Foundation.framework in Frameworks */,
6A5D9A1915E0152D001FAD14 /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6A55309215E4868000019CC9 /* FilterSamples */ = {
isa = PBXGroup;
children = (
6A5530B715E486E900019CC9 /* 10.jpg */,
6A5530B815E486E900019CC9 /* 10@2x.jpg */,
6A5530B315E486E300019CC9 /* 9.jpg */,
6A5530B415E486E300019CC9 /* 9@2x.jpg */,
6A5530AF15E486DD00019CC9 /* 8.jpg */,
6A5530B015E486DD00019CC9 /* 8@2x.jpg */,
6A5530AB15E486D500019CC9 /* 7.jpg */,
6A5530AC15E486D500019CC9 /* 7@2x.jpg */,
6A5530A715E486CB00019CC9 /* 6.jpg */,
6A5530A815E486CB00019CC9 /* 6@2x.jpg */,
6A5530A315E486C300019CC9 /* 5.jpg */,
6A5530A415E486C300019CC9 /* 5@2x.jpg */,
6A55309F15E486BB00019CC9 /* 4.jpg */,
6A5530A015E486BB00019CC9 /* 4@2x.jpg */,
6A55309B15E486B300019CC9 /* 3.jpg */,
6A55309C15E486B300019CC9 /* 3@2x.jpg */,
6A55309715E486A600019CC9 /* 2.jpg */,
6A55309815E486A600019CC9 /* 2@2x.jpg */,
6A55309315E4869600019CC9 /* 1.jpg */,
6A55309415E4869600019CC9 /* 1@2x.jpg */,
);
path = FilterSamples;
sourceTree = "<group>";
};
6A5D9A0515E0152D001FAD14 = {
isa = PBXGroup;
children = (
6A5D9A8515E02429001FAD14 /* Classes */,
6A5D9AA815E0259A001FAD14 /* Resources */,
6A5D9A8C15E02527001FAD14 /* Images */,
6A5D9A1A15E0152D001FAD14 /* DLCImagePickerController */,
6A5D9A1315E0152D001FAD14 /* Frameworks */,
6A5D9A1115E0152D001FAD14 /* Products */,
);
sourceTree = "<group>";
};
6A5D9A1115E0152D001FAD14 /* Products */ = {
isa = PBXGroup;
children = (
6A5D9A1015E0152D001FAD14 /* DLCImagePickerController.app */,
);
name = Products;
sourceTree = "<group>";
};
6A5D9A1315E0152D001FAD14 /* Frameworks */ = {
isa = PBXGroup;
children = (
6A5D9A5815E01DA4001FAD14 /* AssetsLibrary.framework */,
6A5D9A4815E01B72001FAD14 /* GPUImage.xcodeproj */,
6A5D9A3315E015B3001FAD14 /* AVFoundation.framework */,
6A5D9A3115E015A1001FAD14 /* OpenGLES.framework */,
6A5D9A2F15E01598001FAD14 /* QuartzCore.framework */,
6A5D9A2D15E01590001FAD14 /* CoreVideo.framework */,
6A5D9A2B15E01587001FAD14 /* CoreMedia.framework */,
6A5D9A1415E0152D001FAD14 /* UIKit.framework */,
6A5D9A1615E0152D001FAD14 /* Foundation.framework */,
6A5D9A1815E0152D001FAD14 /* CoreGraphics.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
6A5D9A1A15E0152D001FAD14 /* DLCImagePickerController */ = {
isa = PBXGroup;
children = (
6A0D0A27165A218F0028E1B6 /* Default-568h@2x.png */,
6A5D9A2315E0152D001FAD14 /* AppDelegate.h */,
6A5D9A2415E0152D001FAD14 /* AppDelegate.m */,
6A5D9A1B15E0152D001FAD14 /* Supporting Files */,
);
path = DLCImagePickerController;
sourceTree = "<group>";
};
6A5D9A1B15E0152D001FAD14 /* Supporting Files */ = {
isa = PBXGroup;
children = (
6A5D9A1C15E0152D001FAD14 /* DLCImagePickerController-Info.plist */,
6A5D9A1D15E0152D001FAD14 /* InfoPlist.strings */,
6A5D9A2015E0152D001FAD14 /* main.m */,
6A5D9A2215E0152D001FAD14 /* DLCImagePickerController-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
6A5D9A4915E01B72001FAD14 /* Products */ = {
isa = PBXGroup;
children = (
6A5D9A5215E01B72001FAD14 /* libGPUImage.a */,
6A5D9A5415E01B72001FAD14 /* GPUImageTests.octest */,
);
name = Products;
sourceTree = "<group>";
};
6A5D9A8515E02429001FAD14 /* Classes */ = {
isa = PBXGroup;
children = (
6A0D09FF165A1CBE0028E1B6 /* BlurOverlayView.h */,
6A0D0A00165A1CBE0028E1B6 /* BlurOverlayView.m */,
7D0E5AB515E20987009D19C9 /* Filters */,
6A5D9A8915E02504001FAD14 /* PhotoViewController.h */,
6A5D9A8A15E02504001FAD14 /* PhotoViewController.m */,
6A5D9A8615E02429001FAD14 /* DLCImagePickerController.h */,
6A5D9A8715E02429001FAD14 /* DLCImagePickerController.m */,
);
path = Classes;
sourceTree = "<group>";
};
6A5D9A8C15E02527001FAD14 /* Images */ = {
isa = PBXGroup;
children = (
6A55309215E4868000019CC9 /* FilterSamples */,
7D643C2E15E05FBF0035A22D /* Samples */,
6A5D9A9215E02527001FAD14 /* Overlays */,
6A5D9A9515E02527001FAD14 /* UI */,
);
path = Images;
sourceTree = "<group>";
};
6A5D9A9215E02527001FAD14 /* Overlays */ = {
isa = PBXGroup;
children = (
6A49CEA615E345070098304F /* blackframe.png */,
6A5D9A9415E02527001FAD14 /* mask.png */,
);
path = Overlays;
sourceTree = "<group>";
};
6A5D9A9515E02527001FAD14 /* UI */ = {
isa = PBXGroup;
children = (
6A0D0A0D165A1FFC0028E1B6 /* focus-crosshair.png */,
6A0D0A0E165A1FFC0028E1B6 /* focus-crosshair@2x.png */,
6A23390C15E6C17000CC6CB2 /* library@2x.png */,
6A23390D15E6C17000CC6CB2 /* library.png */,
6A42CF7415E46F0E0062D3E7 /* blur-on.png */,
6A42CF7515E46F0E0062D3E7 /* blur-on@2x.png */,
6A49CF0815E461D10098304F /* close.png */,
6A49CF0915E461D10098304F /* close@2x.png */,
6A49CF0415E461B30098304F /* blur.png */,
6A49CF0515E461B30098304F /* blur@2x.png */,
6A49CF0015E4617A0098304F /* front-camera.png */,
6A49CF0115E4617A0098304F /* front-camera@2x.png */,
6A49CEF415E461670098304F /* flash-auto.png */,
6A49CEF515E461670098304F /* flash-auto@2x.png */,
6A49CEF615E461670098304F /* flash-off.png */,
6A49CEF715E461670098304F /* flash-off@2x.png */,
6A49CEF815E461670098304F /* flash.png */,
6A49CEF915E461670098304F /* flash@2x.png */,
6A49CEF015E460540098304F /* filter.png */,
6A49CEF115E460540098304F /* filter@2x.png */,
6A49CEE815E45A5F0098304F /* camera-button.png */,
6A49CEE915E45A5F0098304F /* camera-button@2x.png */,
6A49CEEA15E45A5F0098304F /* camera-icon.png */,
6A49CEEB15E45A5F0098304F /* camera-icon@2x.png */,
6A49CED415E459B00098304F /* filter-close.png */,
6A49CED515E459B00098304F /* filter-close@2x.png */,
6A49CED615E459B00098304F /* filter-open.png */,
6A49CED715E459B00098304F /* filter-open@2x.png */,
6A5D9A9615E02527001FAD14 /* dock_bg.png */,
6A5D9A9715E02527001FAD14 /* dock_bg@2x.png */,
6A5D9A9815E02527001FAD14 /* micro_carbon.png */,
6A5D9A9915E02527001FAD14 /* micro_carbon@2x.png */,
6A5D9A9A15E02527001FAD14 /* photo_bar.png */,
6A5D9A9B15E02527001FAD14 /* photo_bar@2x.png */,
);
path = UI;
sourceTree = "<group>";
};
6A5D9AA815E0259A001FAD14 /* Resources */ = {
isa = PBXGroup;
children = (
7D1E64B615E1F8D9005A9E09 /* Curves */,
6A5D9AA915E0259A001FAD14 /* DLCImagePicker.xib */,
);
path = Resources;
sourceTree = "<group>";
};
7D0E5AB515E20987009D19C9 /* Filters */ = {
isa = PBXGroup;
children = (
7D0E5AB615E2099C009D19C9 /* GrayscaleContrastFilter.h */,
7D0E5AB715E209AD009D19C9 /* GrayscaleContrastFilter.m */,
);
name = Filters;
sourceTree = "<group>";
};
7D1E64B615E1F8D9005A9E09 /* Curves */ = {
isa = PBXGroup;
children = (
7DFAE1B915E22A9F00C8236F /* aqua.acv */,
6A5BBDA515E2214B00B1B485 /* 02.acv */,
6A5BBDA615E2214B00B1B485 /* 06.acv */,
6A5BBDA715E2214B00B1B485 /* 17.acv */,
7D0E5AB115E203FA009D19C9 /* purple-green.acv */,
7D0E5AB215E203FA009D19C9 /* yellow-red.acv */,
7D1E64B715E1FA2F005A9E09 /* crossprocess.acv */,
);
name = Curves;
sourceTree = "<group>";
};
7D643C2E15E05FBF0035A22D /* Samples */ = {
isa = PBXGroup;
children = (
7DEB4DC515E063420078BFAD /* sample1.jpg */,
);
name = Samples;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
6A5D9A0F15E0152D001FAD14 /* DLCImagePickerController */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6A5D9A2815E0152E001FAD14 /* Build configuration list for PBXNativeTarget "DLCImagePickerController" */;
buildPhases = (
6A5D9A0C15E0152D001FAD14 /* Sources */,
6A5D9A0D15E0152D001FAD14 /* Frameworks */,
6A5D9A0E15E0152D001FAD14 /* Resources */,
);
buildRules = (
);
dependencies = (
6A5D9A5615E01BC2001FAD14 /* PBXTargetDependency */,
);
name = DLCImagePickerController;
productName = DLCImagePickerController;
productReference = 6A5D9A1015E0152D001FAD14 /* DLCImagePickerController.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
6A5D9A0715E0152D001FAD14 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = "Backspaces Inc";
};
buildConfigurationList = 6A5D9A0A15E0152D001FAD14 /* Build configuration list for PBXProject "DLCImagePickerController" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 6A5D9A0515E0152D001FAD14;
productRefGroup = 6A5D9A1115E0152D001FAD14 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 6A5D9A4915E01B72001FAD14 /* Products */;
ProjectRef = 6A5D9A4815E01B72001FAD14 /* GPUImage.xcodeproj */;
},
);
projectRoot = "";
targets = (
6A5D9A0F15E0152D001FAD14 /* DLCImagePickerController */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
6A5D9A5215E01B72001FAD14 /* libGPUImage.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libGPUImage.a;
remoteRef = 6A5D9A5115E01B72001FAD14 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
6A5D9A5415E01B72001FAD14 /* GPUImageTests.octest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GPUImageTests.octest;
remoteRef = 6A5D9A5315E01B72001FAD14 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
6A5D9A0E15E0152D001FAD14 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6A5D9A1F15E0152D001FAD14 /* InfoPlist.strings in Resources */,
6A5D9AA115E02527001FAD14 /* mask.png in Resources */,
6A5D9AA215E02527001FAD14 /* dock_bg.png in Resources */,
6A5D9AA315E02527001FAD14 /* dock_bg@2x.png in Resources */,
6A5D9AA415E02527001FAD14 /* micro_carbon.png in Resources */,
6A5D9AA515E02527001FAD14 /* micro_carbon@2x.png in Resources */,
6A5D9AA615E02527001FAD14 /* photo_bar.png in Resources */,
6A5D9AA715E02527001FAD14 /* photo_bar@2x.png in Resources */,
6A5D9AAA15E0259A001FAD14 /* DLCImagePicker.xib in Resources */,
7DEB4DC615E063420078BFAD /* sample1.jpg in Resources */,
7D1E64B915E1FA2F005A9E09 /* crossprocess.acv in Resources */,
7D0E5AB315E203FA009D19C9 /* purple-green.acv in Resources */,
7D0E5AB415E203FA009D19C9 /* yellow-red.acv in Resources */,
6A5BBDA815E2214B00B1B485 /* 02.acv in Resources */,
6A5BBDA915E2214B00B1B485 /* 06.acv in Resources */,
6A5BBDAA15E2214B00B1B485 /* 17.acv in Resources */,
7DFAE1BA15E22A9F00C8236F /* aqua.acv in Resources */,
6A49CEA715E345070098304F /* blackframe.png in Resources */,
6A49CED815E459B00098304F /* filter-close.png in Resources */,
6A49CED915E459B00098304F /* filter-close@2x.png in Resources */,
6A49CEDA15E459B00098304F /* filter-open.png in Resources */,
6A49CEDB15E459B00098304F /* filter-open@2x.png in Resources */,
6A49CEEC15E45A5F0098304F /* camera-button.png in Resources */,
6A49CEED15E45A5F0098304F /* camera-button@2x.png in Resources */,
6A49CEEE15E45A5F0098304F /* camera-icon.png in Resources */,
6A49CEEF15E45A5F0098304F /* camera-icon@2x.png in Resources */,
6A49CEF215E460540098304F /* filter.png in Resources */,
6A49CEF315E460540098304F /* filter@2x.png in Resources */,
6A49CEFA15E461670098304F /* flash-auto.png in Resources */,
6A49CEFB15E461670098304F /* flash-auto@2x.png in Resources */,
6A49CEFC15E461670098304F /* flash-off.png in Resources */,
6A49CEFD15E461670098304F /* flash-off@2x.png in Resources */,
6A49CEFE15E461670098304F /* flash.png in Resources */,
6A49CEFF15E461670098304F /* flash@2x.png in Resources */,
6A49CF0215E4617A0098304F /* front-camera.png in Resources */,
6A49CF0315E4617A0098304F /* front-camera@2x.png in Resources */,
6A49CF0615E461B30098304F /* blur.png in Resources */,
6A49CF0715E461B30098304F /* blur@2x.png in Resources */,
6A49CF0A15E461D10098304F /* close.png in Resources */,
6A49CF0B15E461D10098304F /* close@2x.png in Resources */,
6A42CF7615E46F0E0062D3E7 /* blur-on.png in Resources */,
6A42CF7715E46F0E0062D3E7 /* blur-on@2x.png in Resources */,
6A55309515E4869600019CC9 /* 1.jpg in Resources */,
6A55309615E4869600019CC9 /* 1@2x.jpg in Resources */,
6A55309915E486A600019CC9 /* 2.jpg in Resources */,
6A55309A15E486A600019CC9 /* 2@2x.jpg in Resources */,
6A55309D15E486B300019CC9 /* 3.jpg in Resources */,
6A55309E15E486B300019CC9 /* 3@2x.jpg in Resources */,
6A5530A115E486BB00019CC9 /* 4.jpg in Resources */,
6A5530A215E486BB00019CC9 /* 4@2x.jpg in Resources */,
6A5530A515E486C300019CC9 /* 5.jpg in Resources */,
6A5530A615E486C300019CC9 /* 5@2x.jpg in Resources */,
6A5530A915E486CB00019CC9 /* 6.jpg in Resources */,
6A5530AA15E486CB00019CC9 /* 6@2x.jpg in Resources */,
6A5530AD15E486D500019CC9 /* 7.jpg in Resources */,
6A5530AE15E486D500019CC9 /* 7@2x.jpg in Resources */,
6A5530B115E486DD00019CC9 /* 8.jpg in Resources */,
6A5530B215E486DD00019CC9 /* 8@2x.jpg in Resources */,
6A5530B515E486E300019CC9 /* 9.jpg in Resources */,
6A5530B615E486E300019CC9 /* 9@2x.jpg in Resources */,
6A5530B915E486E900019CC9 /* 10.jpg in Resources */,
6A5530BA15E486E900019CC9 /* 10@2x.jpg in Resources */,
6A23390E15E6C17000CC6CB2 /* library@2x.png in Resources */,
6A23390F15E6C17000CC6CB2 /* library.png in Resources */,
6A0D0A0F165A1FFC0028E1B6 /* focus-crosshair.png in Resources */,
6A0D0A10165A1FFC0028E1B6 /* focus-crosshair@2x.png in Resources */,
6A0D0A28165A218F0028E1B6 /* Default-568h@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
6A5D9A0C15E0152D001FAD14 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6A5D9A2115E0152D001FAD14 /* main.m in Sources */,
6A5D9A2515E0152E001FAD14 /* AppDelegate.m in Sources */,
6A5D9A8815E02429001FAD14 /* DLCImagePickerController.m in Sources */,
6A5D9A8B15E02504001FAD14 /* PhotoViewController.m in Sources */,
7D0E5AB815E209AD009D19C9 /* GrayscaleContrastFilter.m in Sources */,
6A0D0A01165A1CBE0028E1B6 /* BlurOverlayView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
6A5D9A5615E01BC2001FAD14 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GPUImage;
targetProxy = 6A5D9A5515E01BC2001FAD14 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
6A5D9A1D15E0152D001FAD14 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
6A5D9A1E15E0152D001FAD14 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
6A5D9A2615E0152E001FAD14 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "GPUImage/framework/**";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
SDKROOT = iphoneos;
};
name = Debug;
};
6A5D9A2715E0152E001FAD14 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "GPUImage/framework/**";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
6A5D9A2915E0152E001FAD14 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DLCImagePickerController/DLCImagePickerController-Prefix.pch";
INFOPLIST_FILE = "DLCImagePickerController/DLCImagePickerController-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
6A5D9A2A15E0152E001FAD14 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DLCImagePickerController/DLCImagePickerController-Prefix.pch";
INFOPLIST_FILE = "DLCImagePickerController/DLCImagePickerController-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6A5D9A0A15E0152D001FAD14 /* Build configuration list for PBXProject "DLCImagePickerController" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6A5D9A2615E0152E001FAD14 /* Debug */,
6A5D9A2715E0152E001FAD14 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6A5D9A2815E0152E001FAD14 /* Build configuration list for PBXNativeTarget "DLCImagePickerController" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6A5D9A2915E0152E001FAD14 /* Debug */,
6A5D9A2A15E0152E001FAD14 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 6A5D9A0715E0152D001FAD14 /* Project object */;
}

View file

@ -0,0 +1,16 @@
//
// AppDelegate.h
// DLCImagePickerController
//
// Created by Dmitri Cherniak on 8/18/12.
// Copyright (c) 2012 DLC Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (retain, nonatomic) UIViewController *rootViewController;
@end

View file

@ -0,0 +1,57 @@
//
// AppDelegate.m
// DLCImagePickerController
//
// Created by Dmitri Cherniak on 8/18/12.
// Copyright (c) 2012 DLC Inc. All rights reserved.
//
#import "AppDelegate.h"
#import "PhotoViewController.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize rootViewController = _rootViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
self.rootViewController = [[PhotoViewController alloc] init];
self.rootViewController.view.frame = [[UIScreen mainScreen] bounds];
[self.window addSubview:self.rootViewController.view];
self.window.rootViewController = self.rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end

View file

@ -3,32 +3,36 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>English</string> <string>en</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string> <string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string> <string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string> <string>com.backspaces.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>${PRODUCT_NAME}</string> <string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0</string> <string>1.0</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSMainNibFile</key> <key>UIRequiredDeviceCapabilities</key>
<string>MainWindow</string> <array>
<key>NSMainNibFile~ipad</key> <string>armv7</string>
<string>MainWindow-iPad</string> </array>
<key>UIStatusBarHidden</key> <key>UISupportedInterfaceOrientations</key>
<true/> <array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict> </dict>
</plist> </plist>

View file

@ -0,0 +1,14 @@
//
// Prefix header for all source files of the 'DLCImagePickerController' target in the 'DLCImagePickerController' project
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

View file

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View file

@ -0,0 +1,18 @@
//
// main.m
// DLCImagePickerController
//
// Created by Dmitri Cherniak on 8/18/12.
// Copyright (c) 2012 DLC Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

@ -0,0 +1 @@
Subproject commit c4795d05754e0a3428b3dd14a485cd6519c01c4b

View file

@ -0,0 +1,10 @@
Copyright (c) 2012, Dmitri Cherniak.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of this framework nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,74 @@
About
-----
DLCImagePickerController is a fast, beautiful and fun way to filter and capture your photos with OpenGL and your iPhone.
The majority of the praise should be directed towards BradLarson for his [GPUImage](https://github.com/BradLarson/GPUImage) library.
To see the camera in action [download Backspaces](http://backspac.es/download).
Setup
------
When you clone the repo, you'll need to download GPUImage assets:
```
git submodule init
git submodule update
```
Features
---------
### Live Filters
Here are some examples of the filters that are included. These are being applied to the live camera stream.
![Filters](http://i.imgur.com/rJx1l.png)
or check out on outdoor shoot with the old UI [here](http://i.imgur.com/bHNAN.png)
### Radial Blur
It also has a radial blur, that you can move and pinch to your liking on the live view or captured image
![Radial blur on and off](http://i.imgur.com/RhCcV.png)
### Front Facing Camera
There is a front facing camera
![Front facing camera](http://i.imgur.com/CqOra.png)
### Apply filters/blur after capture or retake photo
After you capture the image, you can apply new filters and toggle/move/resize the blur as you please or decide to retake it
![Filters](http://i.imgur.com/TtMMm.png)
### Use an image from your camera roll
Import a picture from your camera roll and apply a filter/blur to it
![Loaded from camera roll](http://i.imgur.com/6f2fQ.png)
Example output
---------------
These images were produced using the sample program included in this repo
[Soft filter in nice daylight](http://i.imgur.com/0OncO.jpg)
[High contrast black and white with radial blur](http://i.imgur.com/6B4iz.jpg)
Contact
--------
**Dmitri Cherniak**
+ http://twitter.com/dmitric
+ http://github.com/dmitric
**Wylie Conlon**
+ http://twitter.com/wylieconlon
+ http://github.com/wylieconlon

View file

@ -38,10 +38,8 @@
#import "MenuTableViewSectionCell.h" #import "MenuTableViewSectionCell.h"
#import "MenuTableViewCell.h" #import "MenuTableViewCell.h"
// photo picker
#import "DLCImagePickerController.h"
@interface MenuViewController : UITableViewController<IASKSettingsDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, CoreLocationControllerDelegate, DLCImagePickerDelegate> @interface MenuViewController : UITableViewController<IASKSettingsDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, CoreLocationControllerDelegate, UIImagePickerControllerDelegate>
{ {
// ask the user about location int the home screen // ask the user about location int the home screen
CoreLocationController *coreLocationController; CoreLocationController *coreLocationController;

View file

@ -361,15 +361,17 @@
self.viewDeckController.centerController = SharedAppDelegate.centerController; self.viewDeckController.centerController = SharedAppDelegate.centerController;
[self selectLatestActivity]; [self selectLatestActivity];
DLCImagePickerController *picker = [[DLCImagePickerController alloc] init]; UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self; picker.delegate = self;
[coreLocationController.locMgr startUpdatingLocation]; [coreLocationController.locMgr startUpdatingLocation];
[self presentViewController:picker animated:YES completion:nil]; [self presentViewController:picker animated:YES completion:nil];
} }
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
- (void)imagePickerController:(DLCImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { /*
// the image itself to save in the library, // the image itself to save in the library,
// this data must be a raw data on DLCImagePickerController. Remove the PNG representation // this data must be a raw data on DLCImagePickerController. Remove the PNG representation
UIImage *pickedImage = [info objectForKey:@"image"]; UIImage *pickedImage = [info objectForKey:@"image"];
@ -410,15 +412,17 @@
// stop location // stop location
[coreLocationController.locMgr stopUpdatingLocation]; [coreLocationController.locMgr stopUpdatingLocation];
*/
} }
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{ - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[picker dismissViewControllerAnimated:YES completion:^{ [picker dismissViewControllerAnimated:YES completion:^{
[coreLocationController.locMgr stopUpdatingLocation]; [coreLocationController.locMgr stopUpdatingLocation];
}]; }];
} }
//Creates an EXIF field for the current geo location. //Creates an EXIF field for the current geo location.
- (NSMutableDictionary*)currentLocation { - (NSMutableDictionary*)currentLocation {
NSMutableDictionary *locDict = [[NSMutableDictionary alloc] init]; NSMutableDictionary *locDict = [[NSMutableDictionary alloc] init];

View file

@ -1,20 +0,0 @@
//
// TSAVDemoAppDelegate.h
// TSAVDemo
//
// Created by Nick Hodapp aka Tom Swift on 1/19/11.
//
#import <UIKit/UIKit.h>
@interface TSAVDemoAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UINavigationController *viewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *viewController;
@end

View file

@ -1,87 +0,0 @@
//
// TSAVDemoAppDelegate.m
// TSAVDemo
//
// Created by Nick Hodapp aka Tom Swift on 1/19/11.
//
#import "TSAVDemoAppDelegate.h"
#import "TSAVDemoViewController.h"
@implementation TSAVDemoAppDelegate
@synthesize window;
@synthesize viewController;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
[self.window addSubview:viewController.view];
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
- (void)applicationWillTerminate:(UIApplication *)application {
/*
Called when the application is about to terminate.
See also applicationDidEnterBackground:.
*/
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
/*
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
*/
}
- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}
@end

View file

@ -1,35 +0,0 @@
//
// TSAVDemoViewController.h
// TSAVDemo
//
// Created by Nick Hodapp aka Tom Swift on 1/19/11.
//
#import <UIKit/UIKit.h>
@interface TSAVDemoViewController : UIViewController <UITextFieldDelegate, UITextViewDelegate>
{
IBOutlet UITextField* _titleTextField;
IBOutlet UITextView* _messageTextView;
IBOutlet UITextField* _widthTextField;
IBOutlet UITextField* _maxHeightTextField;
IBOutlet UITextField* _buttonCountTextField;
IBOutlet UISwitch* _stackedSwitch;
IBOutlet UISwitch* _usesTextViewSwitch;
IBOutlet UISwitch* _hasInputFieldSwitch;
}
- (void) onAddMore: (id) sender;
- (void) onShow: (id) sender;
@end

View file

@ -1,94 +0,0 @@
//
// TSAVDemoViewController.m
// TSAVDemo
//
// Created by Nick Hodapp aka Tom Swift on 1/19/11.
//
#import "TSAVDemoViewController.h"
#import "TSAlertView.h"
@implementation TSAVDemoViewController
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization.
}
return self;
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void) onAddMore:(id)sender
{
}
- (void) onShow:(id)sender
{
[_messageTextView resignFirstResponder];
[_titleTextField resignFirstResponder];
[_widthTextField resignFirstResponder];
[_maxHeightTextField resignFirstResponder];
TSAlertView* av = [[[TSAlertView alloc] init] autorelease];
av.title = _titleTextField.text;
av.message = _messageTextView.text;
for ( int i = 0 ; i < [_buttonCountTextField.text intValue] ; i++ )
{
[av addButtonWithTitle: [NSString stringWithFormat: @"Button %d", i]];
}
av.style = _hasInputFieldSwitch.on ? TSAlertViewStyleInput : TSAlertViewStyleNormal;
av.buttonLayout = _stackedSwitch.on ? TSAlertViewButtonLayoutStacked : TSAlertViewButtonLayoutNormal;
av.usesMessageTextView = _usesTextViewSwitch.on;
av.width = [_widthTextField.text floatValue];
av.maxHeight = [_maxHeightTextField.text floatValue];
[av show];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc. that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end

File diff suppressed because it is too large Load diff

View file

@ -1,726 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1056</int>
<string key="IBDocument.SystemVersion">10H574</string>
<string key="IBDocument.InterfaceBuilderVersion">823</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">132</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBProxyObject" id="427554174">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUICustomObject" id="664661524">
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUINavigationController" id="231263182">
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics" id="448205775">
<int key="IBUIStatusBarStyle">2</int>
</object>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBUIHorizontal">NO</bool>
<object class="IBUINavigationBar" key="IBUINavigationBar" id="678464893">
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{0, 0}</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="NSMutableArray" key="IBUIViewControllers">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIViewController" id="974762162">
<reference key="IBUIToolbarItems" ref="0"/>
<object class="IBUINavigationItem" key="IBUINavigationItem" id="554259637">
<string key="IBUITitle">TSAlertView</string>
<object class="IBUIBarButtonItem" key="IBUIRightBarButtonItem" id="391122569">
<string key="IBUITitle">Show</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBUIStyle">2</int>
<reference key="IBUINavigationItem" ref="554259637"/>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<reference key="IBUIParentViewController" ref="231263182"/>
<string key="IBUINibName">TSAVDemoViewController</string>
<object class="IBUISimulatedToolbarMetrics" key="IBUISimulatedBottomBarMetrics"/>
<reference key="IBUISimulatedStatusBarMetrics" ref="448205775"/>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
</object>
</object>
<object class="IBUIWindow" id="117978783">
<nil key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<string key="NSFrameSize">{768, 1004}</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<reference key="IBUISimulatedStatusBarMetrics" ref="448205775"/>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBUIResizesToFullScreen">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="664661524"/>
</object>
<int key="connectionID">4</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="664661524"/>
<reference key="destination" ref="117978783"/>
</object>
<int key="connectionID">14</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">onShow:</string>
<reference key="source" ref="391122569"/>
<reference key="destination" ref="974762162"/>
</object>
<int key="connectionID">31</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">viewController</string>
<reference key="source" ref="664661524"/>
<reference key="destination" ref="231263182"/>
</object>
<int key="connectionID">32</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">3</int>
<reference key="object" ref="664661524"/>
<reference key="parent" ref="0"/>
<string key="objectName">TSAVDemo App Delegate</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="427554174"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="117978783"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">24</int>
<reference key="object" ref="231263182"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="678464893"/>
<reference ref="974762162"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">26</int>
<reference key="object" ref="678464893"/>
<reference key="parent" ref="231263182"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">22</int>
<reference key="object" ref="974762162"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="554259637"/>
</object>
<reference key="parent" ref="231263182"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">28</int>
<reference key="object" ref="554259637"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="391122569"/>
</object>
<reference key="parent" ref="974762162"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">29</int>
<reference key="object" ref="391122569"/>
<reference key="parent" ref="554259637"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>12.IBEditorWindowLastContentRect</string>
<string>12.IBLastUsedUIStatusBarStylesToTargetRuntimesMap</string>
<string>12.IBPluginDependency</string>
<string>22.CustomClassName</string>
<string>22.IBEditorWindowLastContentRect</string>
<string>22.IBLastUsedUIStatusBarStylesToTargetRuntimesMap</string>
<string>22.IBPluginDependency</string>
<string>24.IBEditorWindowLastContentRect</string>
<string>24.IBLastUsedUIStatusBarStylesToTargetRuntimesMap</string>
<string>24.IBPluginDependency</string>
<string>26.IBPluginDependency</string>
<string>29.IBPluginDependency</string>
<string>3.CustomClassName</string>
<string>3.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIApplication</string>
<string>UIResponder</string>
<string>{{525, 346}, {320, 480}}</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">IBCocoaTouchFramework</string>
<integer value="0" key="NS.object.0"/>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>TSAVDemoViewController</string>
<string>{{0, 665}, {320, 480}}</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">IBCocoaTouchFramework</string>
<integer value="0" key="NS.object.0"/>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>{{0, 665}, {320, 480}}</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">IBCocoaTouchFramework</string>
<integer value="0" key="NS.object.0"/>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>TSAVDemoAppDelegate</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">32</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">TSAVDemoAppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>viewController</string>
<string>window</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UINavigationController</string>
<string>UIWindow</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>viewController</string>
<string>window</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">viewController</string>
<string key="candidateClassName">UINavigationController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">window</string>
<string key="candidateClassName">UIWindow</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">Classes/TSAVDemoAppDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">TSAVDemoAppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">TSAVDemoViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>onAddMore:</string>
<string>onShow:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>onAddMore:</string>
<string>onShow:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">onAddMore:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">onShow:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>_buttonCountTextField</string>
<string>_hasInputFieldSwitch</string>
<string>_maxHeightTextField</string>
<string>_messageTextView</string>
<string>_stackedSwitch</string>
<string>_titleTextField</string>
<string>_usesTextViewSwitch</string>
<string>_widthTextField</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UITextField</string>
<string>UISwitch</string>
<string>UITextField</string>
<string>UITextView</string>
<string>UISwitch</string>
<string>UITextField</string>
<string>UISwitch</string>
<string>UITextField</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>_buttonCountTextField</string>
<string>_hasInputFieldSwitch</string>
<string>_maxHeightTextField</string>
<string>_messageTextView</string>
<string>_stackedSwitch</string>
<string>_titleTextField</string>
<string>_usesTextViewSwitch</string>
<string>_widthTextField</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">_buttonCountTextField</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_hasInputFieldSwitch</string>
<string key="candidateClassName">UISwitch</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_maxHeightTextField</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_messageTextView</string>
<string key="candidateClassName">UITextView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_stackedSwitch</string>
<string key="candidateClassName">UISwitch</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_titleTextField</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_usesTextViewSwitch</string>
<string key="candidateClassName">UISwitch</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_widthTextField</string>
<string key="candidateClassName">UITextField</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">TSAVDemoViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIWindow</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="356479594">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIApplication</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIApplication.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIBarButtonItem</string>
<string key="superclassName">UIBarItem</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIBarButtonItem.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIBarItem</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIControl</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIControl.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UINavigationBar</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="746662734">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINavigationBar.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UINavigationController</string>
<string key="superclassName">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="994757512">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UINavigationItem</string>
<string key="superclassName">NSObject</string>
<reference key="sourceIdentifier" ref="746662734"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIResponder</string>
<string key="superclassName">NSObject</string>
<reference key="sourceIdentifier" ref="356479594"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIScrollView</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchBar</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchDisplayController</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISwitch</string>
<string key="superclassName">UIControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISwitch.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UITextField</string>
<string key="superclassName">UIControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="447779784">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UITextView</string>
<string key="superclassName">UIScrollView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITextView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<reference key="sourceIdentifier" ref="447779784"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<reference key="sourceIdentifier" ref="994757512"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIWindow</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIWindow.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="1056" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3100" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">TSAVDemo.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">132</string>
</data>
</archive>

View file

@ -1,713 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1056</int>
<string key="IBDocument.SystemVersion">10H574</string>
<string key="IBDocument.InterfaceBuilderVersion">823</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">132</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="24"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="427554174">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUICustomObject" id="664661524">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUINavigationController" id="231263182">
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
<object class="IBUINavigationBar" key="IBUINavigationBar" id="678464893">
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{0, 0}</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="NSArray" key="IBUIViewControllers">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIViewController" id="974762162">
<object class="NSArray" key="IBUIToolbarItems">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="IBUINavigationItem" key="IBUINavigationItem" id="554259637">
<reference key="IBUINavigationBar"/>
<string key="IBUITitle">TSAlertView</string>
<object class="IBUIBarButtonItem" key="IBUIRightBarButtonItem" id="391122569">
<string key="IBUITitle">Show</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIStyle">2</int>
<reference key="IBUINavigationItem" ref="554259637"/>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIParentViewController" ref="231263182"/>
<string key="IBUINibName">TSAVDemoViewController</string>
<object class="IBUISimulatedToolbarMetrics" key="IBUISimulatedBottomBarMetrics"/>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
</object>
</object>
<object class="IBUIWindow" id="117978783">
<nil key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<string key="NSFrameSize">{320, 480}</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIResizesToFullScreen">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="664661524"/>
</object>
<int key="connectionID">4</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="664661524"/>
<reference key="destination" ref="117978783"/>
</object>
<int key="connectionID">14</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">onShow:</string>
<reference key="source" ref="391122569"/>
<reference key="destination" ref="974762162"/>
</object>
<int key="connectionID">31</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">viewController</string>
<reference key="source" ref="664661524"/>
<reference key="destination" ref="231263182"/>
</object>
<int key="connectionID">32</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">3</int>
<reference key="object" ref="664661524"/>
<reference key="parent" ref="0"/>
<string key="objectName">TSAVDemo App Delegate</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="427554174"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="117978783"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">24</int>
<reference key="object" ref="231263182"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="678464893"/>
<reference ref="974762162"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">26</int>
<reference key="object" ref="678464893"/>
<reference key="parent" ref="231263182"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">22</int>
<reference key="object" ref="974762162"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="554259637"/>
</object>
<reference key="parent" ref="231263182"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">28</int>
<reference key="object" ref="554259637"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="391122569"/>
</object>
<reference key="parent" ref="974762162"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">29</int>
<reference key="object" ref="391122569"/>
<reference key="parent" ref="554259637"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>12.IBEditorWindowLastContentRect</string>
<string>12.IBPluginDependency</string>
<string>22.CustomClassName</string>
<string>22.IBEditorWindowLastContentRect</string>
<string>22.IBPluginDependency</string>
<string>24.IBEditorWindowLastContentRect</string>
<string>24.IBPluginDependency</string>
<string>26.IBPluginDependency</string>
<string>29.IBPluginDependency</string>
<string>3.CustomClassName</string>
<string>3.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIApplication</string>
<string>UIResponder</string>
<string>{{525, 346}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>TSAVDemoViewController</string>
<string>{{0, 665}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>{{0, 665}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>TSAVDemoAppDelegate</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">32</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">TSAVDemoAppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>viewController</string>
<string>window</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UINavigationController</string>
<string>UIWindow</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>viewController</string>
<string>window</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">viewController</string>
<string key="candidateClassName">UINavigationController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">window</string>
<string key="candidateClassName">UIWindow</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">Classes/TSAVDemoAppDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">TSAVDemoAppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">TSAVDemoViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>onAddMore:</string>
<string>onShow:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>onAddMore:</string>
<string>onShow:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">onAddMore:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">onShow:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>_buttonCountTextField</string>
<string>_hasInputFieldSwitch</string>
<string>_maxHeightTextField</string>
<string>_messageTextView</string>
<string>_stackedSwitch</string>
<string>_titleTextField</string>
<string>_usesTextViewSwitch</string>
<string>_widthTextField</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UITextField</string>
<string>UISwitch</string>
<string>UITextField</string>
<string>UITextView</string>
<string>UISwitch</string>
<string>UITextField</string>
<string>UISwitch</string>
<string>UITextField</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>_buttonCountTextField</string>
<string>_hasInputFieldSwitch</string>
<string>_maxHeightTextField</string>
<string>_messageTextView</string>
<string>_stackedSwitch</string>
<string>_titleTextField</string>
<string>_usesTextViewSwitch</string>
<string>_widthTextField</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">_buttonCountTextField</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_hasInputFieldSwitch</string>
<string key="candidateClassName">UISwitch</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_maxHeightTextField</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_messageTextView</string>
<string key="candidateClassName">UITextView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_stackedSwitch</string>
<string key="candidateClassName">UISwitch</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_titleTextField</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_usesTextViewSwitch</string>
<string key="candidateClassName">UISwitch</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_widthTextField</string>
<string key="candidateClassName">UITextField</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">TSAVDemoViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIWindow</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="356479594">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIApplication</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIApplication.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIBarButtonItem</string>
<string key="superclassName">UIBarItem</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIBarButtonItem.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIBarItem</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIControl</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIControl.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UINavigationBar</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="746662734">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINavigationBar.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UINavigationController</string>
<string key="superclassName">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="994757512">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UINavigationItem</string>
<string key="superclassName">NSObject</string>
<reference key="sourceIdentifier" ref="746662734"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIResponder</string>
<string key="superclassName">NSObject</string>
<reference key="sourceIdentifier" ref="356479594"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIScrollView</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchBar</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchDisplayController</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISwitch</string>
<string key="superclassName">UIControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISwitch.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UITextField</string>
<string key="superclassName">UIControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="447779784">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UITextView</string>
<string key="superclassName">UIScrollView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITextView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<reference key="sourceIdentifier" ref="447779784"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<reference key="sourceIdentifier" ref="994757512"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIWindow</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIWindow.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="1056" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3100" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">TSAVDemo.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">132</string>
</data>
</archive>

View file

@ -1,305 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
013DD51B12ECF0D300B34A41 /* Source Code License.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 013DD51A12ECF0D300B34A41 /* Source Code License.rtf */; };
01A538A012E954E400B0F4A4 /* TSAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 01A5389912E954E400B0F4A4 /* TSAlertView.m */; };
01A538A112E954E400B0F4A4 /* TSAlertViewMessageListViewShadow.png in Resources */ = {isa = PBXBuildFile; fileRef = 01A5389A12E954E400B0F4A4 /* TSAlertViewMessageListViewShadow.png */; };
01A538A212E954E400B0F4A4 /* TSAlertViewBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 01A5389B12E954E400B0F4A4 /* TSAlertViewBackground.png */; };
01A538A312E954E400B0F4A4 /* TSAlertViewBackground2.png in Resources */ = {isa = PBXBuildFile; fileRef = 01A5389C12E954E400B0F4A4 /* TSAlertViewBackground2.png */; };
01A538A412E954E400B0F4A4 /* TSAlertViewButtonBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 01A5389D12E954E400B0F4A4 /* TSAlertViewButtonBackground.png */; };
01A538A512E954E400B0F4A4 /* TSAlertViewButtonBackground_Highlighted.png in Resources */ = {isa = PBXBuildFile; fileRef = 01A5389E12E954E400B0F4A4 /* TSAlertViewButtonBackground_Highlighted.png */; };
01A538A612E954E400B0F4A4 /* TSAlertViewCancelButtonBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 01A5389F12E954E400B0F4A4 /* TSAlertViewCancelButtonBackground.png */; };
01A5399C12E9F4A600B0F4A4 /* TSAVDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 01A5399A12E9F4A600B0F4A4 /* TSAVDemoViewController.m */; };
01A5399D12E9F4A600B0F4A4 /* TSAVDemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 01A5399B12E9F4A600B0F4A4 /* TSAVDemoViewController.xib */; };
01A5399F12E9F4B500B0F4A4 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 01A5399E12E9F4B500B0F4A4 /* MainWindow-iPad.xib */; };
1D3623260D0F684500981E51 /* TSAVDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* TSAVDemoAppDelegate.m */; };
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
0110735812EBA60D00BAC93C /* README.mdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.mdown; path = ../README.mdown; sourceTree = SOURCE_ROOT; };
013DD51A12ECF0D300B34A41 /* Source Code License.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = "Source Code License.rtf"; path = "../Source Code License.rtf"; sourceTree = "<group>"; };
01A5389812E954E400B0F4A4 /* TSAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAlertView.h; sourceTree = "<group>"; };
01A5389912E954E400B0F4A4 /* TSAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSAlertView.m; sourceTree = "<group>"; };
01A5389A12E954E400B0F4A4 /* TSAlertViewMessageListViewShadow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewMessageListViewShadow.png; sourceTree = "<group>"; };
01A5389B12E954E400B0F4A4 /* TSAlertViewBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewBackground.png; sourceTree = "<group>"; };
01A5389C12E954E400B0F4A4 /* TSAlertViewBackground2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewBackground2.png; sourceTree = "<group>"; };
01A5389D12E954E400B0F4A4 /* TSAlertViewButtonBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewButtonBackground.png; sourceTree = "<group>"; };
01A5389E12E954E400B0F4A4 /* TSAlertViewButtonBackground_Highlighted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewButtonBackground_Highlighted.png; sourceTree = "<group>"; };
01A5389F12E954E400B0F4A4 /* TSAlertViewCancelButtonBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TSAlertViewCancelButtonBackground.png; sourceTree = "<group>"; };
01A5399912E9F4A600B0F4A4 /* TSAVDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSAVDemoViewController.h; path = Classes/TSAVDemoViewController.h; sourceTree = "<group>"; };
01A5399A12E9F4A600B0F4A4 /* TSAVDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSAVDemoViewController.m; path = Classes/TSAVDemoViewController.m; sourceTree = "<group>"; };
01A5399B12E9F4A600B0F4A4 /* TSAVDemoViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = TSAVDemoViewController.xib; path = Classes/TSAVDemoViewController.xib; sourceTree = "<group>"; };
01A5399E12E9F4B500B0F4A4 /* MainWindow-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MainWindow-iPad.xib"; sourceTree = "<group>"; };
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D3623240D0F684500981E51 /* TSAVDemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSAVDemoAppDelegate.h; path = Classes/TSAVDemoAppDelegate.h; sourceTree = "<group>"; };
1D3623250D0F684500981E51 /* TSAVDemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSAVDemoAppDelegate.m; path = Classes/TSAVDemoAppDelegate.m; sourceTree = "<group>"; };
1D6058910D05DD3D006BFB54 /* TSAVDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TSAVDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* TSAVDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAVDemo_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* TSAVDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "TSAVDemo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
01A5389712E954E400B0F4A4 /* TSAlertView */ = {
isa = PBXGroup;
children = (
01A5389812E954E400B0F4A4 /* TSAlertView.h */,
01A5389912E954E400B0F4A4 /* TSAlertView.m */,
01A5389A12E954E400B0F4A4 /* TSAlertViewMessageListViewShadow.png */,
01A5389B12E954E400B0F4A4 /* TSAlertViewBackground.png */,
01A5389C12E954E400B0F4A4 /* TSAlertViewBackground2.png */,
01A5389D12E954E400B0F4A4 /* TSAlertViewButtonBackground.png */,
01A5389E12E954E400B0F4A4 /* TSAlertViewButtonBackground_Highlighted.png */,
01A5389F12E954E400B0F4A4 /* TSAlertViewCancelButtonBackground.png */,
);
name = TSAlertView;
path = ../TSAlertView;
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
1D6058910D05DD3D006BFB54 /* TSAVDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
013DD51A12ECF0D300B34A41 /* Source Code License.rtf */,
0110735812EBA60D00BAC93C /* README.mdown */,
01A5399912E9F4A600B0F4A4 /* TSAVDemoViewController.h */,
01A5399A12E9F4A600B0F4A4 /* TSAVDemoViewController.m */,
01A5399B12E9F4A600B0F4A4 /* TSAVDemoViewController.xib */,
1D3623240D0F684500981E51 /* TSAVDemoAppDelegate.h */,
1D3623250D0F684500981E51 /* TSAVDemoAppDelegate.m */,
01A5389712E954E400B0F4A4 /* TSAlertView */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = CustomTemplate;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
32CA4F630368D1EE00C91783 /* TSAVDemo_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
01A5399E12E9F4B500B0F4A4 /* MainWindow-iPad.xib */,
28AD733E0D9D9553002E5188 /* MainWindow.xib */,
8D1107310486CEB800E47090 /* TSAVDemo-Info.plist */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
1D30AB110D05D00D00671497 /* Foundation.framework */,
288765A40DF7441C002DB57D /* CoreGraphics.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
1D6058900D05DD3D006BFB54 /* TSAVDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "TSAVDemo" */;
buildPhases = (
1D60588D0D05DD3D006BFB54 /* Resources */,
1D60588E0D05DD3D006BFB54 /* Sources */,
1D60588F0D05DD3D006BFB54 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = TSAVDemo;
productName = TSAVDemo;
productReference = 1D6058910D05DD3D006BFB54 /* TSAVDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "TSAVDemo" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectRoot = "";
targets = (
1D6058900D05DD3D006BFB54 /* TSAVDemo */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
1D60588D0D05DD3D006BFB54 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
01A538A112E954E400B0F4A4 /* TSAlertViewMessageListViewShadow.png in Resources */,
01A538A212E954E400B0F4A4 /* TSAlertViewBackground.png in Resources */,
01A538A312E954E400B0F4A4 /* TSAlertViewBackground2.png in Resources */,
01A538A412E954E400B0F4A4 /* TSAlertViewButtonBackground.png in Resources */,
01A538A512E954E400B0F4A4 /* TSAlertViewButtonBackground_Highlighted.png in Resources */,
01A538A612E954E400B0F4A4 /* TSAlertViewCancelButtonBackground.png in Resources */,
01A5399D12E9F4A600B0F4A4 /* TSAVDemoViewController.xib in Resources */,
01A5399F12E9F4B500B0F4A4 /* MainWindow-iPad.xib in Resources */,
013DD51B12ECF0D300B34A41 /* Source Code License.rtf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
1D60588E0D05DD3D006BFB54 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
1D3623260D0F684500981E51 /* TSAVDemoAppDelegate.m in Sources */,
01A538A012E954E400B0F4A4 /* TSAlertView.m in Sources */,
01A5399C12E9F4A600B0F4A4 /* TSAVDemoViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = TSAVDemo_Prefix.pch;
INFOPLIST_FILE = "TSAVDemo-Info.plist";
PRODUCT_NAME = TSAVDemo;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = TSAVDemo_Prefix.pch;
INFOPLIST_FILE = "TSAVDemo-Info.plist";
PRODUCT_NAME = TSAVDemo;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
SDKROOT = iphoneos;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "TSAVDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1D6058940D05DD3E006BFB54 /* Debug */,
1D6058950D05DD3E006BFB54 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "TSAVDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

View file

@ -1,8 +0,0 @@
//
// Prefix header for all source files of the 'TSAVDemo' target in the 'TSAVDemo' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif

View file

@ -1,16 +0,0 @@
//
// main.m
// TSAVDemo
//
// Created by Nick Hodapp aka Tom Swift on 1/19/11.
//
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}

View file

@ -1,70 +0,0 @@
TSAlertView
===========
TSAlertView is a drop-in replacement for UIAlertView in iOS, offering additional functionality:
* "buttonLayout" property. This is useful when you have two buttons and you want them to be "stacked" instead of side-by-side.
* "width" property. Controls the display width of the alert view. Make better-looking alert views on larger screens.
* "maxHeight" property. Control how tall the alert view can grow before it displays the message in a scrolling UITextView instead of a UILabel.
* "style" property. Can be TSAlertViewStyleNormal for a normal alert view.  Or it can be TSAlertViewStyleInput for an alert view that contains an input text field.  When it's an input alert view, the keyboard is shown right away, and the alert view will slide up and possibly resize if necessary.
* "usesMessageTextView" property.  Set to YES to force the alert view to use a textview for the message area.
* "backgroundImage" property.  Can be set to a custom background image.  You should set this to a UIImage which you created with stretchableImageWithLeftCapWidth:topCapHeight:
* "inputTextField" property.  Use to access the input value before the alert view is shown.  Could also set the font or text alignment prior to showing the alert view.
TSAlertView is NOT derived from UIAlertView. It is a clean implementation based on UIView.
[![](http://dl.dropbox.com/u/47535/TSAlertView/1-thumb.png)](http://dl.dropbox.com/u/47535/TSAlertView/1.png)
[![](http://dl.dropbox.com/u/47535/TSAlertView/2-thumb.png)](http://dl.dropbox.com/u/47535/TSAlertView/2.png)
[![](http://dl.dropbox.com/u/47535/TSAlertView/3-thumb.png)](http://dl.dropbox.com/u/47535/TSAlertView/3.png)
Adding TSAlertView to your project
====================================
The simplest way to add the TSAlertView to your project is to directly add the `TSAlertView` folder with source filees and resources to your project.
1. Download the latest code version from the repository (you can simply use the Download Source button and get the zip or tar archive of the master branch).
2. Extract the archive.
3. Open your project in Xcode, than drag and drop the `TSAlertView` folder, with all of its contents, to your classes group (in the Groups & Files view).
4. Make sure to select Copy items when asked.
If you have a git tracked project, you can add TSAlertView as a submodule to your project.
1. Move inside your git tracked project.
2. Add TSAlertView as a submodule using `git submodule add git://github.com/TomSwift/TSAlertView.git TSAlertView` .
3. Open your project in Xcode, than drag and drop the `TSAlertView` folder to your classes group (in the Groups & Files view).
4. Don't select Copy items and select a suitable Reference type (relative to project should work fine most of the time).
Usage
=====
A demo project is included in the Demo directory. This should give you an idea how to use the class.
Donate
======
Please consider a small donation if you use TSAlertView in your projects. It'll make me feel good.
<a href="https://www.wepay.com/donate/130885" target="_blank" ><img src="https://www.wepay.com/img/widgets/donate_with_wepay.png" alt="Donate with WePay" height="40" width="200" /></a>
License and Warranty
====================
The license for the code is included with the project; it's basically a BSD license with attribution.
You're welcome to use it in commercial, closed-source, open source, free or any other kind of software, as long as you credit me appropriately.
The TSAlertView code comes with no warranty of any kind. I hope it'll be useful to you (it certainly is to me), but I make no guarantees regarding its functionality or otherwise.
Change-log
==========
**Version 0.1** @ 01.23.11
- Initial release. Probably has a lot of bugs. The demo project isn't very good.
Thanks
======
* Matej Bukovinski, Matt Gemmell: I used your MBProgressHUD and MGSplitViewController projects as best-practice examples and templates for how to publish TSAlertView on github. Thanks!

Some files were not shown because too many files have changed in this diff Show more