From f670c1ad2549a531acc7b69b77ba2dd9bf3cbd15 Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Thu, 8 May 2014 10:28:33 +0800 Subject: [PATCH 01/37] Update README.textile --- README.textile | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/README.textile b/README.textile index 7fe1f908..e71d754d 100644 --- a/README.textile +++ b/README.textile @@ -1,32 +1,3 @@ -ASIHTTPRequest is an easy to use wrapper around the CFNetwork API that makes some of the more tedious aspects of communicating with web servers easier. It is written in Objective-C and works in both Mac OS X and iPhone applications. - -It is suitable performing basic HTTP requests and interacting with REST-based services (GET / POST / PUT / DELETE). The included ASIFormDataRequest subclass makes it easy to submit POST data and files using multipart/form-data. - -It provides: -* A straightforward interface for submitting data to and fetching data from webservers -* Download data to memory or directly to a file on disk -* Submit files on local drives as part of POST data, compatible with the HTML file input mechanism -* Stream request bodies directly from disk to the server, to conserve memory -* Resume for partial downloads -* Easy access to request and response HTTP headers -* Progress delegates (NSProgressIndicators and UIProgressViews) to show information about download AND upload progress -* Auto-magic management of upload and download progress indicators for operation queues -* Basic, Digest + NTLM authentication support, credentials are automatically re-used for the duration of a session, and can be stored for later in the Keychain. -* Cookie support -* [NEW] Requests can continue to run when your app moves to the background (iOS 4+) -* GZIP support for response data AND request bodies -* The included ASIDownloadCache class lets requests transparently cache responses, and allow requests for cached data to succeed even when there is no network available -* [NEW] ASIWebPageRequest - download complete webpages, including external resources like images and stylesheets. Pages of any size can be indefinitely cached, and displayed in a UIWebview / WebView even when you have no network connection. -* Easy to use support for Amazon S3 - no need to fiddle around signing requests yourself! -* Full support for Rackspace Cloud Files -* [NEW] Client certificates support -* Supports manual and auto-detected proxies, authenticating proxies, and PAC file auto-configuration. The built-in login dialog lets your iPhone application work transparently with authenticating proxies without any additional effort. -* Bandwidth throttling support -* Support for persistent connections -* Supports synchronous & asynchronous requests -* Get notifications about changes in your request state via delegation or [NEW] blocks (Mac OS X 10.6, iOS 4 and above) -* Comes with a broad range of unit tests - -ASIHTTPRequest is compatible with Mac OS 10.5 or later, and iOS 3.0 or later. - -Documentation is available "here":http://allseeing-i.com/ASIHTTPRequest. \ No newline at end of file +ASIHTTPRequest For Sina Cloud Storage Service +======= +Branch of ASIHTTPRequest for Sina Cloud Storage Service From eafa2afbe9af6f3dcb91023b96af84de0dd8cdd8 Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Thu, 8 May 2014 10:28:59 +0800 Subject: [PATCH 02/37] Rename README.textile to README.md --- README.textile => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.textile => README.md (100%) diff --git a/README.textile b/README.md similarity index 100% rename from README.textile rename to README.md From f0473120c96c23414ba347d634318b3b7e9d1106 Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Thu, 8 May 2014 10:33:56 +0800 Subject: [PATCH 03/37] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e71d754d..7990c55a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -ASIHTTPRequest For Sina Cloud Storage Service +ASI-SCS ======= Branch of ASIHTTPRequest for Sina Cloud Storage Service From 3630fc5bc378eabbdf42f0948cf1f23376000ad1 Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Thu, 8 May 2014 17:55:12 +0800 Subject: [PATCH 04/37] fixed errors and warnings --- Build Scripts/fetch_ios_ghunit.rb | 2 +- Build Scripts/fetch_mac_ghunit.rb | 2 +- Classes/ASIHTTPRequest.m | 4 +- Classes/CloudFiles/ASICloudFilesCDNRequest.m | 8 +- .../ASICloudFilesContainerRequest.m | 2 +- .../CloudFiles/ASICloudFilesObjectRequest.m | 2 +- Classes/Tests/ASIS3RequestTests.m | 12 +- Classes/Tests/GHUnitTestMain.m | 4 +- Mac Sample/AppDelegate.m | 15 +- Mac Sample/English.lproj/MainMenu.xib | 6917 +++-------------- Mac.xcodeproj/project.pbxproj | 36 +- iPhone Sample/GHUnitIOSTestMain.m | 5 +- iPhone Sample/InfoCell.m | 10 +- iPhone Sample/QueueViewController.m | 8 +- iPhone Sample/Resources/Default-568h@2x.png | Bin 0 -> 18594 bytes iPhone Sample/SynchronousViewController.m | 4 +- iPhone Sample/WebPageViewController.m | 8 +- iPhone Sample/iPhoneInfo.plist | 13 + iPhone.xcodeproj/project.pbxproj | 44 +- strict.xcconfig.bak | 26 + 20 files changed, 1143 insertions(+), 5979 deletions(-) create mode 100644 iPhone Sample/Resources/Default-568h@2x.png create mode 100644 strict.xcconfig.bak diff --git a/Build Scripts/fetch_ios_ghunit.rb b/Build Scripts/fetch_ios_ghunit.rb index 7ab289fc..9e7cb0c8 100755 --- a/Build Scripts/fetch_ios_ghunit.rb +++ b/Build Scripts/fetch_ios_ghunit.rb @@ -9,6 +9,6 @@ require 'net/http' if (!File.exists?('External/GHUnit/GHUnitIOS.framework')) - `curl -s http://allseeing-i.com/ASIHTTPRequest/GHUnit/GHUnit-IOS.zip > External/GHUnit/GHUnit-IOS.zip` + `curl -s http://sinastorage.com/sdk/GHUnit/GHUnitIOS-0.5.8.zip > External/GHUnit/GHUnit-IOS.zip` `unzip External/GHUnit/GHUnit-IOS.zip -d External/GHUnit/ & rm External/GHUnit/GHUnit-IOS.zip` end \ No newline at end of file diff --git a/Build Scripts/fetch_mac_ghunit.rb b/Build Scripts/fetch_mac_ghunit.rb index e1c8162c..cb86efb2 100755 --- a/Build Scripts/fetch_mac_ghunit.rb +++ b/Build Scripts/fetch_mac_ghunit.rb @@ -9,6 +9,6 @@ require 'net/http' if (!File.exists?('External/GHUnit/GHUnit.framework')) - `curl -s http://allseeing-i.com/ASIHTTPRequest/GHUnit/GHUnit-Mac.zip > External/GHUnit/GHUnit-Mac.zip` + `curl -s http://sinastorage.com/sdk/GHUnit/GHUnitOSX-0.5.8.zip > External/GHUnit/GHUnit-Mac.zip` `unzip External/GHUnit/GHUnit-Mac.zip -d External/GHUnit/ & rm External/GHUnit/GHUnit-Mac.zip` end \ No newline at end of file diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m index cb6bbeea..4d2455f5 100644 --- a/Classes/ASIHTTPRequest.m +++ b/Classes/ASIHTTPRequest.m @@ -24,7 +24,7 @@ #import "ASIDataCompressor.h" // Automatically set on build -NSString *ASIHTTPRequestVersion = @"v1.8.1-61 2011-09-19"; +NSString *ASIHTTPRequestVersion = @"v1.8.2-9 2014-05-08"; static NSString *defaultUserAgent = nil; @@ -4622,7 +4622,7 @@ + (unsigned long)maxUploadReadLength // We'll split our bandwidth allowance into 4 (which is the default for an ASINetworkQueue's max concurrent operations count) to give all running requests a fighting chance of reading data this cycle long long toRead = maxBandwidthPerSecond/4; - if (maxBandwidthPerSecond > 0 && (bandwidthUsedInLastSecond + toRead > maxBandwidthPerSecond)) { + if (maxBandwidthPerSecond > 0 && (bandwidthUsedInLastSecond + (unsigned long long)toRead > maxBandwidthPerSecond)) { toRead = (long long)maxBandwidthPerSecond-(long long)bandwidthUsedInLastSecond; if (toRead < 0) { toRead = 0; diff --git a/Classes/CloudFiles/ASICloudFilesCDNRequest.m b/Classes/CloudFiles/ASICloudFilesCDNRequest.m index 397a8273..765832c3 100644 --- a/Classes/CloudFiles/ASICloudFilesCDNRequest.m +++ b/Classes/CloudFiles/ASICloudFilesCDNRequest.m @@ -81,7 +81,7 @@ + (id)listRequestWithLimit:(NSUInteger)limit marker:(NSString *)marker enabledOn NSString *query = @"?format=xml"; if (limit > 0) { - query = [query stringByAppendingString:[NSString stringWithFormat:@"&limit=%i", limit]]; + query = [query stringByAppendingString:[NSString stringWithFormat:@"&limit=%lu", (unsigned long)limit]]; } if (marker) { @@ -89,7 +89,7 @@ + (id)listRequestWithLimit:(NSUInteger)limit marker:(NSString *)marker enabledOn } if (limit > 0) { - query = [query stringByAppendingString:[NSString stringWithFormat:@"&limit=%i", limit]]; + query = [query stringByAppendingString:[NSString stringWithFormat:@"&limit=%lu", (unsigned long)limit]]; } ASICloudFilesCDNRequest *request = [ASICloudFilesCDNRequest cdnRequestWithMethod:@"GET" query:query]; @@ -128,7 +128,7 @@ + (id)putRequestWithContainer:(NSString *)containerName { + (id)putRequestWithContainer:(NSString *)containerName ttl:(NSUInteger)ttl { ASICloudFilesCDNRequest *request = [ASICloudFilesCDNRequest cdnRequestWithMethod:@"PUT" containerName:containerName]; - [request addRequestHeader:@"X-Ttl" value:[NSString stringWithFormat:@"%i", ttl]]; + [request addRequestHeader:@"X-Ttl" value:[NSString stringWithFormat:@"%lu", (unsigned long)ttl]]; return request; } @@ -148,7 +148,7 @@ + (id)postRequestWithContainer:(NSString *)containerName { + (id)postRequestWithContainer:(NSString *)containerName cdnEnabled:(BOOL)cdnEnabled ttl:(NSUInteger)ttl { ASICloudFilesCDNRequest *request = [ASICloudFilesCDNRequest cdnRequestWithMethod:@"POST" containerName:containerName]; if (ttl > 0) { - [request addRequestHeader:@"X-Ttl" value:[NSString stringWithFormat:@"%i", ttl]]; + [request addRequestHeader:@"X-Ttl" value:[NSString stringWithFormat:@"%lu", (unsigned long)ttl]]; } [request addRequestHeader:@"X-CDN-Enabled" value:cdnEnabled ? @"True" : @"False"]; return request; diff --git a/Classes/CloudFiles/ASICloudFilesContainerRequest.m b/Classes/CloudFiles/ASICloudFilesContainerRequest.m index f6ed4ec5..02f9070e 100644 --- a/Classes/CloudFiles/ASICloudFilesContainerRequest.m +++ b/Classes/CloudFiles/ASICloudFilesContainerRequest.m @@ -64,7 +64,7 @@ + (id)listRequestWithLimit:(NSUInteger)limit marker:(NSString *)marker { NSString *queryString = @"?format=xml"; if (limit > 0) { - queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@"&limit=%i", limit]]; + queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@"&limit=%lu", (unsigned long)limit]]; } if (marker != nil) { diff --git a/Classes/CloudFiles/ASICloudFilesObjectRequest.m b/Classes/CloudFiles/ASICloudFilesObjectRequest.m index 9d1600bf..b8ebd543 100644 --- a/Classes/CloudFiles/ASICloudFilesObjectRequest.m +++ b/Classes/CloudFiles/ASICloudFilesObjectRequest.m @@ -74,7 +74,7 @@ + (NSString *)queryStringWithContainer:(NSString *)container limit:(NSUInteger)l NSString *queryString = @"?format=xml"; if (limit && limit > 0) { - queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@"&limit=%i", limit]]; + queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@"&limit=%lu", (unsigned long)limit]]; } if (marker) { queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@"&marker=%@", [marker stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; diff --git a/Classes/Tests/ASIS3RequestTests.m b/Classes/Tests/ASIS3RequestTests.m index d747e01a..c188a2dd 100644 --- a/Classes/Tests/ASIS3RequestTests.m +++ b/Classes/Tests/ASIS3RequestTests.m @@ -416,7 +416,7 @@ - (void)testListRequest GHAssertTrue(success,@"You need to supply your S3 access details to run the list test (see the top of ASIS3RequestTests.m)"); // Firstly, create and upload 5 files - int i; + short i; for (i=0; i<5; i++) { NSString *text = [NSString stringWithFormat:@"This is the content of file #%hi",i]; NSString *filePath = [[self filePathForTemporaryTestFiles] stringByAppendingPathComponent:[NSString stringWithFormat:@"%hi.txt",i]]; @@ -638,10 +638,10 @@ - (void)testQueueProgress [[self networkQueue] setShowAccurateProgress:YES]; [[self networkQueue] setMaxConcurrentOperationCount:1]; - int i; + short i; for (i=0; i<5; i++) { - NSString *key = [NSString stringWithFormat:@"stuff/file%hi.txt",i+1]; + NSString *key = [NSString stringWithFormat:@"stuff/file%hi.txt", (short)(i+1)]; ASIS3ObjectRequest *s3Request = [ASIS3ObjectRequest PUTRequestForData:data withBucket:bucket key:key]; [s3Request setSecretAccessKey:secretAccessKey]; @@ -667,12 +667,12 @@ - (void)testQueueProgress for (i=0; i<5; i++) { - NSString *key = [NSString stringWithFormat:@"stuff/file%hi.txt",i+1]; + NSString *key = [NSString stringWithFormat:@"stuff/file%hi.txt", (short)(i+1)]; ASIS3ObjectRequest *s3Request = [ASIS3ObjectRequest requestWithBucket:bucket key:key]; [s3Request setSecretAccessKey:secretAccessKey]; [s3Request setAccessKey:accessKey]; - NSString *downloadPath = [[self filePathForTemporaryTestFiles] stringByAppendingPathComponent:[NSString stringWithFormat:@"%hi.jpg",i+1]]; + NSString *downloadPath = [[self filePathForTemporaryTestFiles] stringByAppendingPathComponent:[NSString stringWithFormat:@"%hi.jpg", (short)(i+1)]]; [s3Request setDownloadDestinationPath:downloadPath]; [[self networkQueue] addOperation:s3Request]; } @@ -693,7 +693,7 @@ - (void)testQueueProgress for (i=0; i<5; i++) { - NSString *key = [NSString stringWithFormat:@"stuff/file%hi.txt",i+1]; + NSString *key = [NSString stringWithFormat:@"stuff/file%hi.txt", (short)(i+1)]; ASIS3ObjectRequest *s3Request = [ASIS3ObjectRequest DELETERequestWithBucket:bucket key:key]; [s3Request setSecretAccessKey:secretAccessKey]; diff --git a/Classes/Tests/GHUnitTestMain.m b/Classes/Tests/GHUnitTestMain.m index f947dca0..dc127f07 100644 --- a/Classes/Tests/GHUnitTestMain.m +++ b/Classes/Tests/GHUnitTestMain.m @@ -35,11 +35,11 @@ // Default exception handler void exceptionHandler(NSException *exception) { - NSLog(@"%@\n%@", [exception reason], GHUStackTraceFromException(exception)); + NSLog(@"%@\n%@", [exception reason], [GHTesting descriptionForException:exception]); } int main(int argc, char *argv[]) { - + /*! For debugging: Go into the "Get Info" contextual menu of your (test) executable (inside the "Executables" group in the left panel of XCode). diff --git a/Mac Sample/AppDelegate.m b/Mac Sample/AppDelegate.m index 8d96372d..fa475cf4 100644 --- a/Mac Sample/AppDelegate.m +++ b/Mac Sample/AppDelegate.m @@ -35,9 +35,12 @@ @implementation AppDelegate - (id)init { - [super init]; - networkQueue = [[ASINetworkQueue alloc] init]; - [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateBandwidthUsageIndicator) userInfo:nil repeats:YES]; + if (self = [super init]) { + + networkQueue = [[ASINetworkQueue alloc] init]; + [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateBandwidthUsageIndicator) userInfo:nil repeats:YES]; + } + return self; } @@ -358,15 +361,15 @@ - (void)tableViewDataFetchFinished:(ASIHTTPRequest *)request - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView { - return [[self rowData] count]; + return (NSInteger)[[self rowData] count]; } - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { if ([[aTableColumn identifier] isEqualToString:@"image"]) { - return [[[self rowData] objectAtIndex:rowIndex] objectForKey:@"image"]; + return [[[self rowData] objectAtIndex:(NSUInteger)rowIndex] objectForKey:@"image"]; } else { - return [[[self rowData] objectAtIndex:rowIndex] objectForKey:@"description"]; + return [[[self rowData] objectAtIndex:(NSUInteger)rowIndex] objectForKey:@"description"]; } } diff --git a/Mac Sample/English.lproj/MainMenu.xib b/Mac Sample/English.lproj/MainMenu.xib index a4659bb5..03a2ca5b 100644 --- a/Mac Sample/English.lproj/MainMenu.xib +++ b/Mac Sample/English.lproj/MainMenu.xib @@ -1,5874 +1,1043 @@ - - - - 1050 - 11A511 - 1617 - 1138 - 566.00 - - YES - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - - - YES - 1617 - 518 - - - - YES - NSTextView - WebView - NSMenu - NSButton - NSCustomObject - NSImageView - NSImageCell - NSTableView - NSTextField - NSWindowTemplate - NSTextFieldCell - NSButtonCell - NSTableColumn - NSView - NSScrollView - NSTabViewItem - NSProgressIndicator - NSScroller - NSMenuItem - NSTabView - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - - - YES - - YES - - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - NewApplication - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - NewApplication - - YES - - - About NewApplication - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide NewApplication - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit NewApplication - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - File - - 1048576 - 2147483647 - - - submenuAction: - - File - - YES - - - New - n - 1048576 - 2147483647 - - - - - - Open… - o - 1048576 - 2147483647 - - - - - - Open Recent - - 1048576 - 2147483647 - - - submenuAction: - - Open Recent - - YES - - - Clear Menu - - 1048576 - 2147483647 - - - - - _NSRecentDocumentsMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Close - w - 1048576 - 2147483647 - - - - - - Save - s - 1048576 - 2147483647 - - - - - - Save As… - S - 1179648 - 2147483647 - - - - - - Revert to Saved - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Page Setup... - P - 1179648 - 2147483647 - - - - - - - Print… - p - 1048576 - 2147483647 - - - - - - - - - Edit - - 1048576 - 2147483647 - - - submenuAction: - - Edit - - YES - - - Undo - z - 1048576 - 2147483647 - - - - - - Redo - Z - 1179648 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Cut - x - 1048576 - 2147483647 - - - - - - Copy - c - 1048576 - 2147483647 - - - - - - Paste - v - 1048576 - 2147483647 - - - - - - Delete - - 1048576 - 2147483647 - - - - - - Select All - a - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Find - - 1048576 - 2147483647 - - - submenuAction: - - Find - - YES - - - Find… - f - 1048576 - 2147483647 - - - 1 - - - - Find Next - g - 1048576 - 2147483647 - - - 2 - - - - Find Previous - G - 1179648 - 2147483647 - - - 3 - - - - Use Selection for Find - e - 1048576 - 2147483647 - - - 7 - - - - Jump to Selection - j - 1048576 - 2147483647 - - - - - - - - - Spelling and Grammar - - 1048576 - 2147483647 - - - submenuAction: - - Spelling and Grammar - - YES - - - Show Spelling… - : - 1048576 - 2147483647 - - - - - - Check Spelling - ; - 1048576 - 2147483647 - - - - - - Check Spelling While Typing - - 1048576 - 2147483647 - - - - - - Check Grammar With Spelling - - 1048576 - 2147483647 - - - - - - - - - Substitutions - - 1048576 - 2147483647 - - - submenuAction: - - Substitutions - - YES - - - Smart Copy/Paste - f - 1048576 - 2147483647 - - - 1 - - - - Smart Quotes - g - 1048576 - 2147483647 - - - 2 - - - - Smart Links - G - 1179648 - 2147483647 - - - 3 - - - - - - - Speech - - 1048576 - 2147483647 - - - submenuAction: - - Speech - - YES - - - Start Speaking - - 1048576 - 2147483647 - - - - - - Stop Speaking - - 1048576 - 2147483647 - - - - - - - - - - - - Format - - 1048576 - 2147483647 - - - submenuAction: - - Format - - YES - - - Show Fonts - t - 1048576 - 2147483647 - - - - - - Show Colors - C - 1179648 - 2147483647 - - - - - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Show Toolbar - t - 1572864 - 2147483647 - - - - - - Customize Toolbar… - - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 1048576 - 2147483647 - - - submenuAction: - - Help - - YES - - - NewApplication Help - ? - 1048576 - 2147483647 - - - - - - - - _NSMainMenu - - - 7 - 2 - {{335, 236}, {644, 514}} - 1946157056 - ASIHTTPRequest Examples - NSWindow - - - - - 256 - - YES - - - 1290 - - {{11, 16}, {151, 20}} - - - 16392 - 1 - - - - 12 - {{6, 35}, {625, 465}} - - - - - YES - - 1 - - - 256 - - YES - - - 268 - {{11, 301}, {62, 32}} - - - - YES - - 67239424 - 134217728 - Go! - - LucidaGrande - 13 - 1044 - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{14, 348}, {577, 64}} - - - - YES - - 67239424 - 272629760 - Demonstrates fetching a web page synchronously, the HTML source will appear in the box below when the download is complete. Because this synchronous download is running in the main thread, the interface will lock until the download is complete. - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - controlTextColor - - 3 - MAA - - - - - - - 282 - - YES - - - 2304 - - YES - - - 2322 - - YES - - YES - Apple HTML pasteboard type - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - Apple URL pasteboard type - CorePasteboardFlavorType 0x6D6F6F76 - NSColor pasteboard type - NSFilenamesPboardType - NSStringPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT RTFD pasteboard type - NeXT Rich Text Format v1.0 pasteboard type - NeXT TIFF v4.0 pasteboard type - NeXT font pasteboard type - NeXT ruler pasteboard type - WebURLsWithTitlesPboardType - public.url - - - {{0, 66}, {554, 14}} - - - - - - - - - - - - - YES - - - 6 - - - - 554 - 1 - - - 11239 - 0 - - - 3 - MQA - - - YES - - YES - NSBackgroundColor - NSColor - - - YES - - 6 - System - selectedTextBackgroundColor - - - - 6 - System - selectedTextColor - - - - - - - YES - - YES - NSColor - NSUnderline - - - YES - - 1 - MCAwIDEAA - - - - - - - 1 - - 6 - {807, 10000000} - {223, 0} - - - - {{1, 1}, {554, 281}} - - - - - - - {4, 5} - - 12582912 - - YES - - YES - - - - TU0AKgAAAHCAFUqgBVKsAAAAwdVQUqwaEQeIRGJRGFlYqwWLQ+JxuOQpVRmEx2RROKwOQyOUQSPyaUym -SxqWyKXyeYxyZzWbSuJTScRCbz2Nz+gRKhUOfTqeUai0OSxiWTiBQSHSGFquGwekxyAgAAAOAQAAAwAA -AAEAEAAAAQEAAwAAAAEAEAAAAQIAAwAAAAIACAAIAQMAAwAAAAEABQAAAQYAAwAAAAEAAQAAAREABAAA -AAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEAAgAAARYAAwAAAAEAEAAAARcABAAAAAEAAABnARwAAwAA -AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA - - - - - - 3 - MCAwAA - - - - 4 - - - - 256 - {{555, 1}, {15, 281}} - - - - - _doScroller: - 0.9512195 - - - - -2147483392 - {{-100, -100}, {87, 18}} - - - - 1 - - _doScroller: - 1 - 0.94565220000000005 - - - {{17, 17}, {571, 283}} - - - - 133138 - - - - - - {{10, 33}, {605, 419}} - - - - - Synchronous - - - - - 2 - - - 256 - - YES - - - 268 - {{11, 274}, {74, 32}} - - YES - - 67239424 - 134217728 - Start - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{85, 274}, {90, 32}} - - YES - - 604110336 - 134217728 - Resume - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{14, 320}, {577, 92}} - - YES - - 67239424 - 272629760 - RGVtb25zdHJhdGVzIGZldGNoaW5nIGEgbGFyZ2UgZmlsZSBkaXJlY3RseSB0byBkaXNrLCB1cGRhdGlu -ZyB0aGUgcHJvZ3Jlc3MgYmFyIGJlbG93IHRvIHNob3cgaG93IG11Y2ggaGFzIGJlZW4gZG93bmxvYWRl -ZC4KCklmIHRoZSByZXF1ZXN0IGlzIHN0b3BwZWQgcGFydCB3YXkgdGhyb3VnaCwgdXNlIHRoZSByZXN1 -bWUgYnV0dG9uIHRvIHBpY2sgdXAgd2hlcmUgd2UgbGVmdCBvZmYuA - - - - - - - - - 268 - {{14, 215}, {553, 40}} - - YES - - 67239424 - 272629760 - The path to the file will appear here once the download is complete - - - - - - - - {{10, 33}, {605, 419}} - - File - - - - - Item 2 - - - 256 - - YES - - - 268 - - YES - - YES - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - - {{14, 169}, {190, 130}} - - YES - - 130560 - 33554432 - 0 - 0 - 2 - NO - - YES - - - - 268 - - YES - - YES - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - - {{207, 169}, {190, 130}} - - YES - - 130560 - 33554432 - 0 - 0 - 2 - NO - - YES - - - - 268 - - YES - - YES - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - - {{401, 169}, {190, 130}} - - YES - - 130560 - 33554432 - 0 - 0 - 2 - NO - - YES - - - - 268 - {{10, 306}, {62, 32}} - - YES - - 67239424 - 134217728 - Go! - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{14, 327}, {577, 85}} - - YES - - 67239424 - 272629760 - RGVtb25zdHJhdGVzIGEgZmV0Y2hpbmcgMyBpdGVtcyBhdCBvbmNlLCB1c2luZyBhbiBBU0lOZXR3b3Jr -UXVldWUgdG8gdHJhY2sgcHJvZ3Jlc3MuIEVhY2ggcmVxdWVzdCBoYXMgaXRzIGRvd25sb2FkUHJvZ3Jl -c3NEZWxlZ2F0ZSBzZXQgdG8gdGhlIHByb2dyZXNzIGluZGljYXRvciB1bmRlciB0aGUgaW1hZ2Ugdmll -dy4gVGhlIHF1ZXVlIG1hbmFnZXMgdGhlIG92ZXJhbGwgcHJvZ3Jlc3MgZGlzcGxheWVkIGF0IHRoZSBi -b3R0b20gb2YgdGhlIHdpbmRvdy4gCg - - - - - - - - - 268 - {{13, 17}, {577, 102}} - - YES - - 67239424 - 272629760 - V2hlbiBhY2N1cmF0ZSBwcm9ncmVzcyBpcyB0dXJuZWQgb2ZmLCBlYWNoIHJlcXVlc3Qgb25seSB1cGRh -dGVzIHByb2dyZXNzIHdoZW4gaXQgY29tcGxldGVzLiBUaGlzIG1lYW5zIHRoYXQgZWFjaCByZXF1ZXN0 -IGlzIHJlcHJlc2VudGVkIGJ5IHRoZSBzYW1lIGFtb3VudCBvZiBwcm9ncmVzcyBpbiB0aGUgcHJvZ3Jl -c3MgaW5kaWNhdG9yLgoKV2l0aCBhY2N1cmF0ZSBwcm9ncmVzcyB0dXJuZWQgb24sIHRoZSBxdWV1ZSB3 -aWxsIGZpcnN0IHBlcmZvcm0gYSBIRUFEIHJlcXVlc3QgZm9yIGVhY2ggaW1hZ2UgdG8gb2J0YWluIGl0 -cyBzaXplLiBSZXF1ZXN0cyB0aGVuIHVwZGF0ZSB0aGUgcHJvZ3Jlc3MgYXMgZGF0YSBpcyByZWNlaXZl -ZC4 - - - - - - - - - 268 - {{80, 315}, {172, 18}} - - YES - - 67239424 - 0 - Show accurate progress - - - 1211912703 - 2 - - NSImage - NSSwitch - - - NSSwitch - - - - 200 - 25 - - - - - 1292 - - {{16, 152}, {186, 12}} - - 16648 - 1 - - - - 1292 - - {{208, 152}, {187, 12}} - - 16648 - 1 - - - - 1292 - - {{403, 152}, {186, 12}} - - 16648 - 1 - - - - 268 - {{14, 129}, {190, 17}} - - YES - - 68288064 - 138413056 - This image is 15KB - - - - - - - - - 268 - {{206, 129}, {191, 17}} - - YES - - 68288064 - 138413056 - This image is 176KB - - - - - - - - - 268 - {{401, 129}, {185, 17}} - - YES - - 68288064 - 138413056 - This image is 1.4MB - - - - - - - - {{10, 33}, {605, 419}} - - Queue - - - - - Item 3 - - - 256 - - YES - - - 268 - {{14, 365}, {577, 47}} - - YES - - 67239424 - 272629760 - Demonstrates fetching content from an area that requires HTTP authentication. You will be prompted for a username and password, enter 'topsecret' for both. - - - - - - - - - 268 - {{11, 208}, {62, 32}} - - YES - - 67239424 - 134217728 - Go! - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{15, 341}, {160, 18}} - - YES - - 67239424 - 0 - Use the Keychain - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{14, 253}, {577, 68}} - - YES - - 67239424 - 272629760 - If you turn on keychain support, successful authentication will result in the username and password you provided being stored in your keychain. The application will use these details rather than prompt you the next time. - - - - - - - - - 268 - {{14, 181}, {413, 17}} - - YES - - 67239488 - 272630784 - Top secret information will not appear here. - - - - - - - - {{10, 33}, {605, 419}} - - Authentication - - - - - Item 4 - - - 256 - - YES - - - 268 - {{14, 381}, {577, 31}} - - YES - - 67239424 - 272629760 - Demonstrates POSTing content to a URL, showing upload progress. - - - - - - - - - 268 - {{11, 345}, {62, 32}} - - YES - - 67239424 - 134217728 - Go! - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{14, 83}, {577, 256}} - - YES - - 67239424 - 272629760 - - - LucidaGrande - 13 - 16 - - - - - - - - {{10, 33}, {605, 419}} - - Upload - - - - - Item 5 - - - 256 - - YES - - - 268 - - YES - - - 2304 - - YES - - - 256 - {569, 269} - - YES - - - -2147483392 - {{224, 0}, {16, 17}} - - - YES - - image - 133 - 40 - 1000 - - 75628096 - 2048 - - - LucidaGrande - 11 - 3100 - - - 3 - MC4zMzMzMzI5ODU2AA - - - 6 - System - headerTextColor - - - - - 67239424 - 33554432 - - 0 - 0 - 0 - NO - - 3 - YES - YES - - - - 400 - 40 - 1000 - - 75628096 - 2048 - - - - - - - 67239424 - 4096 - Text Cell - - LucidaGrande - 11 - 16 - - - - 6 - System - controlBackgroundColor - - - - - 3 - YES - YES - - - - 3 - 2 - - 1 - MSAxIDEAA - - - 100 - 44040192 - - - 0 - 15 - 0 - NO - 0 - 1 - - - {{1, 1}, {569, 269}} - - - - - 4 - - - - -2147483392 - {{224, 17}, {15, 102}} - - - _doScroller: - 0.99591836734693873 - - - - -2147483392 - {{-100, -100}, {223, 15}} - - 1 - - _doScroller: - 0.57142859697341919 - - - {{17, 47}, {571, 271}} - - - 133650 - - - - QSAAAEEgAABCzAAAQswAAA - - - - 268 - {{14, 140}, {276, 17}} - - YES - - 68288064 - 272630784 - - - - - - - - - - 268 - {{434, 15}, {89, 25}} - - YES - - -2080244224 - 134217728 - Clear Cache - - - -2038152961 - 163 - - - 400 - 75 - - - - - 268 - {{531, 15}, {57, 25}} - - YES - - -2080244224 - 134217728 - Reload - - - -2038152961 - 163 - - - 400 - 75 - - - - - 268 - {{14, 326}, {577, 85}} - - YES - - 67239424 - 4194304 - The table view below is populated by downloading an XML file, then downloading the images from the URLs in the XML. The requests are configured to store their responses in the global ASIDownloadCache, and will re-use previously downloaded data if it exists rather than fetching it again. - - - - - - - - {{10, 33}, {605, 419}} - - Cache - - - - - Item 6 - - - 256 - - YES - - - 256 - - YES - - YES - Apple HTML pasteboard type - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple URL pasteboard type - Apple Web Archive pasteboard type - NSColor pasteboard type - NSFilenamesPboardType - NSStringPboardType - NeXT RTFD pasteboard type - NeXT Rich Text Format v1.0 pasteboard type - NeXT TIFF v4.0 pasteboard type - WebURLsWithTitlesPboardType - public.png - public.url - public.url-name - - - {{17, 85}, {571, 160}} - - - - - - - - YES - - YES - WebKitDefaultFixedFontSize - WebKitDefaultFontSize - WebKitMinimumFontSize - - - YES - - - - - - - YES - YES - - - - 268 - {{14, 344}, {577, 68}} - - - YES - - 67239424 - 4194304 - Demonstrates fetching a webpage with a single ASIWebPageRequest that downloads most external resources (images, stylesheets etc). These can be stored in a cache, or embeded directly in the HTML source. Once downloaded, a complete page may be cached indefinitely. - - - - - - - - - 268 - {{14, 315}, {480, 25}} - - - YES - - 67239424 - 4194304 - ASIWebPageRequest is an EXPERIMENTAL class, use at your own risk! - - LucidaGrande-Bold - 13 - 16 - - - - - - - - - 268 - {{536, 280}, {58, 32}} - - - YES - - 67239424 - 134217728 - Go - - - -2038284033 - 129 - - - 200 - 25 - - - - - 256 - - YES - - - 2304 - - YES - - - 2322 - {{0, -3}, {554, 14}} - - - - - - - HTML source will appear here - - - YES - - YES - NSFont - NSParagraphStyle - - - YES - - Monaco - 10 - 16 - - - 4 - - - - - - - - YES - - - 134 - - - - 554 - 1 - - - 12263 - 0 - - - - YES - - YES - NSBackgroundColor - NSColor - - - YES - - - - - - - YES - - YES - NSColor - NSCursor - NSUnderline - - - YES - - - {8, -8} - 13 - - - - - - - 1 - - 6 - {554, 10000000} - {223, 11} - - - - {{1, 1}, {554, 58}} - - - - - - 4 - - - - 256 - {{555, 1}, {15, 58}} - - - - _doScroller: - 1 - 0.85256409645080566 - - - - -2147483392 - {{-100, -100}, {87, 18}} - - - 1 - - _doScroller: - 1 - 0.94565218687057495 - - - {{17, 17}, {571, 60}} - - - 133138 - - - - - - - 268 - {{17, 286}, {517, 22}} - - - YES - - -1804468671 - 272630784 - http://allseeing-i.com/ASIHTTPRequest/tests/ASIWebPageRequest/index.html - - - YES - - 6 - System - textBackgroundColor - - - - 6 - System - textColor - - - - - - - 268 - {{15, 251}, {360, 18}} - - - YES - - -2080244224 - 0 - Embed external resources directly into HTML and CSS - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{499, 251}, {89, 25}} - - - YES - - -2080244224 - 134217728 - Clear Cache - - - -2038152961 - 163 - - - 400 - 75 - - - - {{10, 33}, {605, 419}} - - - Web Page Fetch - - - - - - - 0 - YES - YES - - YES - - - - - - 268 - {{334, 20}, {293, 17}} - - - YES - - 68288064 - 71304192 - - - - - - - - - - 268 - {{171, 18}, {143, 18}} - - - YES - - 67239424 - 0 - Throttle bandwidth - - - 1211912703 - 2 - - - - - 200 - 25 - - - - {644, 514} - - - - {{0, 0}, {1440, 878}} - {10000000000000, 10000000000000} - YES - - - AppDelegate - - - 15 - 2 - {{196, 328}, {279, 182}} - 1677721600 - Window - NSWindow - - - - - 256 - - YES - - - 268 - {{17, 152}, {38, 17}} - - YES - - 67239488 - 272630784 - Host: - - - - - - - - - 268 - {{17, 120}, {47, 17}} - - YES - - 67239488 - 272630784 - Realm: - - - - - - - - - 268 - {{97, 152}, {165, 17}} - - YES - - 67239488 - 272630784 - host here - - - - - - - - - 268 - {{97, 120}, {165, 17}} - - YES - - 67239488 - 272630784 - realm here - - - - - - - - - 268 - {{17, 86}, {71, 17}} - - YES - - 67239488 - 272630784 - Username: - - - - - - - - - 268 - {{17, 53}, {71, 17}} - - YES - - 67239488 - 272630784 - Password: - - - - - - - - - 268 - {{100, 84}, {159, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 268 - {{100, 50}, {159, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 268 - {{14, 5}, {96, 32}} - - YES - - 67239424 - 134217728 - Cancel - - - -2038284033 - 129 - - Gw - 200 - 25 - - - - - 268 - {{169, 5}, {96, 32}} - - 1 - YES - - 67239424 - 134217728 - OK - - - -2038284033 - 129 - - DQ - 200 - 25 - - - - {279, 182} - - {{0, 0}, {1440, 878}} - {10000000000000, 10000000000000} - YES - - - - - YES - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - print: - - - - 86 - - - - runPageLayout: - - - - 87 - - - - clearRecentDocuments: - - - - 127 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - performClose: - - - - 193 - - - - toggleContinuousSpellChecking: - - - - 222 - - - - undo: - - - - 223 - - - - copy: - - - - 224 - - - - checkSpelling: - - - - 225 - - - - paste: - - - - 226 - - - - stopSpeaking: - - - - 227 - - - - cut: - - - - 228 - - - - showGuessPanel: - - - - 230 - - - - redo: - - - - 231 - - - - selectAll: - - - - 232 - - - - startSpeaking: - - - - 233 - - - - delete: - - - - 235 - - - - performZoom: - - - - 240 - - - - performFindPanelAction: - - - - 241 - - - - centerSelectionInVisibleArea: - - - - 245 - - - - toggleGrammarChecking: - - - - 347 - - - - toggleSmartInsertDelete: - - - - 355 - - - - toggleAutomaticQuoteSubstitution: - - - - 356 - - - - toggleAutomaticLinkDetection: - - - - 357 - - - - showHelp: - - - - 360 - - - - orderFrontColorPanel: - - - - 361 - - - - saveDocument: - - - - 362 - - - - saveDocumentAs: - - - - 363 - - - - revertDocumentToSaved: - - - - 364 - - - - runToolbarCustomizationPalette: - - - - 365 - - - - toggleToolbarShown: - - - - 366 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - terminate: - - - - 369 - - - - unhideAllApplications: - - - - 370 - - - - newDocument: - - - - 373 - - - - openDocument: - - - - 374 - - - - progressIndicator - - - - 385 - - - - loginWindow - - - - 414 - - - - window - - - - 415 - - - - host - - - - 416 - - - - realm - - - - 417 - - - - username - - - - 418 - - - - password - - - - 419 - - - - simpleURLFetch: - - - - 473 - - - - URLFetchWithProgress: - - - - 474 - - - - fetchThreeImages: - - - - 475 - - - - imageView1 - - - - 476 - - - - imageView2 - - - - 477 - - - - imageView3 - - - - 478 - - - - fileLocation - - - - 481 - - - - htmlSource - - - - 486 - - - - topSecretInfo - - - - 497 - - - - keychainCheckbox - - - - 498 - - - - fetchTopSecretInformation: - - - - 499 - - - - dismissAuthSheet: - - - - 500 - - - - dismissAuthSheet: - - - - 501 - - - - postWithProgress: - - - - 506 - - - - showAccurateProgress - - - - 515 - - - - resumeButton - - - - 522 - - - - startButton - - - - 523 - - - - resumeURLFetchWithProgress: - - - - 524 - - - - imageProgress1 - - - - 528 - - - - imageProgress2 - - - - 529 - - - - imageProgress3 - - - - 530 - - - - bandwidthUsed - - - - 537 - - - - throttleBandwidth: - - - - 542 - - - - postStatus - - - - 545 - - - - tableView - - - - 557 - - - - dataSource - - - - 558 - - - - delegate - - - - 559 - - - - delegate - - - - 560 - - - - tableLoadStatus - - - - 564 - - - - clearCache: - - - - 570 - - - - reloadTableData: - - - - 571 - - - - fetchWebPage: - - - - 589 - - - - webView - - - - 590 - - - - webPageSource - - - - 595 - - - - urlField - - - - 598 - - - - policyDelegate - - - - 600 - - - - dataURICheckbox - - - - 605 - - - - clearCache: - - - - 609 - - - - clearCache: - - - - 612 - - - - - YES - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - - MainMenu - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 103 - - - YES - - - - 1 - - - 217 - - - YES - - - - - - 83 - - - YES - - - - - - 81 - - - YES - - - - - - - - - - - - - - - - 75 - - - 3 - - - 80 - - - 8 - - - 78 - - - 6 - - - 72 - - - - - 82 - - - 9 - - - 124 - - - YES - - - - - - 77 - - - 5 - - - 73 - - - 1 - - - 79 - - - 7 - - - 112 - - - 10 - - - 74 - - - 2 - - - 125 - - - YES - - - - - - 126 - - - - - 205 - - - YES - - - - - - - - - - - - - - - - - - 202 - - - - - 198 - - - - - 207 - - - - - 214 - - - - - 199 - - - - - 203 - - - - - 197 - - - - - 206 - - - - - 215 - - - - - 218 - - - YES - - - - - - 216 - - - YES - - - - - - 200 - - - YES - - - - - - - - - 219 - - - - - 201 - - - - - 204 - - - - - 220 - - - YES - - - - - - - - - - 213 - - - - - 210 - - - - - 221 - - - - - 208 - - - - - 209 - - - - - 106 - - - YES - - - - 2 - - - 111 - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - 1111 - - - 144 - - - - - 129 - - - 121 - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - - 297 - - - - - 298 - - - - - 299 - - - YES - - - - - - 300 - - - YES - - - - - - - 344 - - - - - 345 - - - - - 211 - - - YES - - - - - - 212 - - - YES - - - - - - - 195 - - - - - 196 - - - - - 346 - - - - - 348 - - - YES - - - - - - 349 - - - YES - - - - - - - - 350 - - - - - 351 - - - - - 354 - - - - - 371 - - - YES - - - - - - 372 - - - YES - - - - - - - - - 381 - - - - - 384 - - - - - 390 - - - YES - - - - - - 391 - - - YES - - - - - - - - - - - - - - - 392 - - - YES - - - - - - 393 - - - - - 394 - - - YES - - - - - - 395 - - - - - 398 - - - YES - - - - - - 399 - - - - - 400 - - - YES - - - - - - 401 - - - - - 402 - - - YES - - - - - - 403 - - - - - 404 - - - YES - - - - - - 405 - - - - - 406 - - - YES - - - - - - 407 - - - - - 408 - - - YES - - - - - - 409 - - - - - 410 - - - YES - - - - - - 411 - - - - - 412 - - - YES - - - - - - 413 - - - - - 434 - - - YES - - - - - - - - - - - - 436 - - - YES - - - - - - 437 - - - YES - - - - - - - - - 439 - - - YES - - - - - - 440 - - - YES - - - - - - - - - - - - - - - - - - 441 - - - YES - - - - - - 442 - - - YES - - - - - - - - - - 443 - - - YES - - - - - - 444 - - - YES - - - - - - - - 451 - - - YES - - - - - - 452 - - - YES - - - - - - 453 - - - YES - - - - - - 454 - - - - - 455 - - - - - 456 - - - - - 459 - - - YES - - - - - - 460 - - - - - 461 - - - YES - - - - - - 462 - - - - - 467 - - - YES - - - - - - 468 - - - - - 469 - - - YES - - - - - - 470 - - - - - 479 - - - YES - - - - - - 480 - - - - - 435 - - - YES - - - - - - 438 - - - YES - - - - - - - - 471 - - - YES - - - - - - 472 - - - - - 457 - - - YES - - - - - - 458 - - - - - 482 - - - YES - - - - - - - - 483 - - - - - 484 - - - - - 485 - - - - - 487 - - - YES - - - - - - 488 - - - YES - - - - - - 489 - - - - - 490 - - - - - 491 - - - YES - - - - - - 492 - - - - - 493 - - - YES - - - - - - 494 - - - - - 495 - - - YES - - - - - - 496 - - - - - 502 - - - YES - - - - - - 503 - - - - - 504 - - - YES - - - - - - 505 - - - - - 513 - - - YES - - - - - - 514 - - - - - 520 - - - YES - - - - - - 521 - - - - - 525 - - - - - 526 - - - - - 527 - - - - - 535 - - - YES - - - - - - 536 - - - - - 540 - - - YES - - - - - - 541 - - - - - 543 - - - YES - - - - - - 544 - - - - - 546 - - - YES - - - - - - 547 - - - YES - - - - - - - - - - 548 - - - YES - - - - - - - - 549 - - - - - 550 - - - - - 551 - - - YES - - - - - - - 553 - - - YES - - - - - - 554 - - - YES - - - - - - 555 - - - - - 561 - - - - - 562 - - - YES - - - - - - 563 - - - - - 566 - - - YES - - - - - - 567 - - - - - 568 - - - YES - - - - - - 569 - - - - - 572 - - - YES - - - - - - 573 - - - - - 574 - - - YES - - - - - - 575 - - - YES - - - - - - - - - - - - - 576 - - - YES - - - - - - 577 - - - - - 578 - - - YES - - - - - - 579 - - - - - 580 - - - YES - - - - - - 581 - - - - - 582 - - - - - 583 - - - YES - - - - - - 584 - - - - - 585 - - - YES - - - - - - 586 - - - - - 587 - - - YES - - - - - - 588 - - - - - 591 - - - YES - - - - - - - - 592 - - - - - 593 - - - - - 594 - - - - - 596 - - - YES - - - - - - 597 - - - - - 603 - - - YES - - - - - - 604 - - - - - 606 - - - YES - - - - - - 607 - - - - - 610 - - - YES - - - - - - 611 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 103.IBPluginDependency - 106.IBPluginDependency - 111.IBPluginDependency - 112.IBPluginDependency - 124.IBPluginDependency - 125.IBPluginDependency - 126.IBPluginDependency - 129.IBPluginDependency - 130.IBPluginDependency - 131.IBPluginDependency - 134.IBPluginDependency - 136.IBPluginDependency - 143.IBPluginDependency - 144.IBPluginDependency - 145.IBPluginDependency - 149.IBPluginDependency - 150.IBPluginDependency - 19.IBPluginDependency - 195.IBPluginDependency - 196.IBPluginDependency - 197.IBPluginDependency - 198.IBPluginDependency - 199.IBPluginDependency - 200.IBPluginDependency - 201.IBPluginDependency - 202.IBPluginDependency - 203.IBPluginDependency - 204.IBPluginDependency - 205.IBPluginDependency - 206.IBPluginDependency - 207.IBPluginDependency - 208.IBPluginDependency - 209.IBPluginDependency - 210.IBPluginDependency - 211.IBPluginDependency - 212.IBPluginDependency - 213.IBPluginDependency - 214.IBPluginDependency - 215.IBPluginDependency - 216.IBPluginDependency - 217.IBPluginDependency - 218.IBPluginDependency - 219.IBPluginDependency - 220.IBPluginDependency - 221.IBPluginDependency - 23.IBPluginDependency - 236.IBPluginDependency - 239.IBPluginDependency - 24.IBPluginDependency - 29.IBPluginDependency - 295.IBPluginDependency - 296.IBPluginDependency - 297.IBPluginDependency - 298.IBPluginDependency - 299.IBPluginDependency - 300.IBPluginDependency - 344.IBPluginDependency - 345.IBPluginDependency - 346.IBPluginDependency - 348.IBPluginDependency - 349.IBPluginDependency - 350.IBPluginDependency - 351.IBPluginDependency - 354.IBPluginDependency - 371.IBPluginDependency - 371.IBWindowTemplateEditedContentRect - 371.NSWindowTemplate.visibleAtLaunch - 372.IBPluginDependency - 381.IBPluginDependency - 384.IBPluginDependency - 390.IBPluginDependency - 390.IBWindowTemplateEditedContentRect - 390.NSWindowTemplate.visibleAtLaunch - 391.IBPluginDependency - 392.IBPluginDependency - 393.IBPluginDependency - 394.IBPluginDependency - 395.IBPluginDependency - 398.IBPluginDependency - 399.IBPluginDependency - 400.IBPluginDependency - 401.IBPluginDependency - 402.IBPluginDependency - 403.IBPluginDependency - 404.IBPluginDependency - 405.IBPluginDependency - 406.IBPluginDependency - 407.IBPluginDependency - 408.IBPluginDependency - 409.IBPluginDependency - 410.IBPluginDependency - 411.IBPluginDependency - 412.IBPluginDependency - 413.IBPluginDependency - 434.IBPluginDependency - 435.IBPluginDependency - 436.IBPluginDependency - 437.IBPluginDependency - 438.IBPluginDependency - 439.IBPluginDependency - 440.IBPluginDependency - 441.IBPluginDependency - 442.IBPluginDependency - 443.IBPluginDependency - 444.IBPluginDependency - 451.IBPluginDependency - 452.IBPluginDependency - 453.IBPluginDependency - 454.IBPluginDependency - 455.IBPluginDependency - 456.IBPluginDependency - 457.IBPluginDependency - 458.IBPluginDependency - 459.IBPluginDependency - 460.IBPluginDependency - 461.IBPluginDependency - 462.IBPluginDependency - 467.IBPluginDependency - 468.IBPluginDependency - 469.IBPluginDependency - 470.IBPluginDependency - 471.IBPluginDependency - 472.IBPluginDependency - 479.IBPluginDependency - 480.IBPluginDependency - 482.IBPluginDependency - 483.IBPluginDependency - 484.IBPluginDependency - 485.IBPluginDependency - 487.IBPluginDependency - 488.IBPluginDependency - 489.IBPluginDependency - 490.IBPluginDependency - 491.IBPluginDependency - 492.IBPluginDependency - 493.IBPluginDependency - 494.IBPluginDependency - 495.IBPluginDependency - 496.IBPluginDependency - 5.IBPluginDependency - 502.IBPluginDependency - 503.IBPluginDependency - 504.IBPluginDependency - 505.IBPluginDependency - 513.IBPluginDependency - 514.IBPluginDependency - 520.IBPluginDependency - 521.IBPluginDependency - 525.IBPluginDependency - 526.IBPluginDependency - 527.IBPluginDependency - 535.IBPluginDependency - 536.IBPluginDependency - 540.IBPluginDependency - 541.IBPluginDependency - 543.IBPluginDependency - 544.IBPluginDependency - 546.IBPluginDependency - 547.IBPluginDependency - 548.IBPluginDependency - 549.IBPluginDependency - 550.IBPluginDependency - 551.IBPluginDependency - 553.IBPluginDependency - 554.IBPluginDependency - 555.IBPluginDependency - 56.IBPluginDependency - 561.IBPluginDependency - 562.IBPluginDependency - 563.IBPluginDependency - 566.IBPluginDependency - 567.IBPluginDependency - 568.IBPluginDependency - 569.IBPluginDependency - 57.IBPluginDependency - 572.IBPluginDependency - 573.IBPluginDependency - 574.IBPluginDependency - 575.IBPluginDependency - 576.IBPluginDependency - 577.IBPluginDependency - 578.IBPluginDependency - 579.IBPluginDependency - 58.IBPluginDependency - 580.IBPluginDependency - 581.IBPluginDependency - 582.IBPluginDependency - 583.IBPluginDependency - 584.IBPluginDependency - 585.IBPluginDependency - 586.IBPluginDependency - 587.IBPluginDependency - 588.IBPluginDependency - 591.IBPluginDependency - 592.IBPluginDependency - 593.IBPluginDependency - 594.IBPluginDependency - 596.IBPluginDependency - 597.IBPluginDependency - 603.IBPluginDependency - 604.IBPluginDependency - 606.IBPluginDependency - 607.IBPluginDependency - 610.IBPluginDependency - 611.IBPluginDependency - 72.IBPluginDependency - 73.IBPluginDependency - 74.IBPluginDependency - 75.IBPluginDependency - 77.IBPluginDependency - 78.IBPluginDependency - 79.IBPluginDependency - 80.IBPluginDependency - 81.IBPluginDependency - 82.IBPluginDependency - 83.IBPluginDependency - 92.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{468, 239}, {644, 514}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{329, 629}, {279, 182}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 612 - - - - YES - - AppDelegate - NSObject - - YES - - YES - URLFetchWithProgress: - clearCache: - dismissAuthSheet: - fetchThreeImages: - fetchTopSecretInformation: - fetchWebPage: - postWithProgress: - reloadTableData: - resumeURLFetchWithProgress: - simpleURLFetch: - stopURLFetchWithProgress: - throttleBandwidth: - - - YES - id - id - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - URLFetchWithProgress: - clearCache: - dismissAuthSheet: - fetchThreeImages: - fetchTopSecretInformation: - fetchWebPage: - postWithProgress: - reloadTableData: - resumeURLFetchWithProgress: - simpleURLFetch: - stopURLFetchWithProgress: - throttleBandwidth: - - - YES - - URLFetchWithProgress: - id - - - clearCache: - id - - - dismissAuthSheet: - id - - - fetchThreeImages: - id - - - fetchTopSecretInformation: - id - - - fetchWebPage: - id - - - postWithProgress: - id - - - reloadTableData: - id - - - resumeURLFetchWithProgress: - id - - - simpleURLFetch: - id - - - stopURLFetchWithProgress: - id - - - throttleBandwidth: - id - - - - - YES - - YES - bandwidthUsed - dataURICheckbox - fileLocation - host - htmlSource - imageProgress1 - imageProgress2 - imageProgress3 - imageView1 - imageView2 - imageView3 - keychainCheckbox - loginWindow - password - postStatus - progressIndicator - realm - resumeButton - showAccurateProgress - startButton - tableLoadStatus - tableView - topSecretInfo - urlField - username - webPageSource - webView - window - - - YES - NSTextField - NSButton - NSTextField - NSTextField - NSTextView - NSProgressIndicator - NSProgressIndicator - NSProgressIndicator - NSImageView - NSImageView - NSImageView - NSButton - NSWindow - NSTextField - NSTextField - NSProgressIndicator - NSTextField - NSButton - NSButton - NSButton - NSTextField - NSTableView - NSTextField - NSTextField - NSTextField - NSTextView - WebView - NSWindow - - - - YES - - YES - bandwidthUsed - dataURICheckbox - fileLocation - host - htmlSource - imageProgress1 - imageProgress2 - imageProgress3 - imageView1 - imageView2 - imageView3 - keychainCheckbox - loginWindow - password - postStatus - progressIndicator - realm - resumeButton - showAccurateProgress - startButton - tableLoadStatus - tableView - topSecretInfo - urlField - username - webPageSource - webView - window - - - YES - - bandwidthUsed - NSTextField - - - dataURICheckbox - NSButton - - - fileLocation - NSTextField - - - host - NSTextField - - - htmlSource - NSTextView - - - imageProgress1 - NSProgressIndicator - - - imageProgress2 - NSProgressIndicator - - - imageProgress3 - NSProgressIndicator - - - imageView1 - NSImageView - - - imageView2 - NSImageView - - - imageView3 - NSImageView - - - keychainCheckbox - NSButton - - - loginWindow - NSWindow - - - password - NSTextField - - - postStatus - NSTextField - - - progressIndicator - NSProgressIndicator - - - realm - NSTextField - - - resumeButton - NSButton - - - showAccurateProgress - NSButton - - - startButton - NSButton - - - tableLoadStatus - NSTextField - - - tableView - NSTableView - - - topSecretInfo - NSTextField - - - urlField - NSTextField - - - username - NSTextField - - - webPageSource - NSTextView - - - webView - WebView - - - window - NSWindow - - - - - IBProjectSource - ./Classes/AppDelegate.h - - - - BWSplitView - NSSplitView - - toggleCollapse: - id - - - toggleCollapse: - - toggleCollapse: - id - - - - IBProjectSource - ./Classes/BWSplitView.h - - - - GHTestViewController - NSViewController - - YES - - YES - copy: - openExceptionFilename: - rerunTest: - runTests: - toggleDetails: - updateMode: - updateSearchFilter: - updateTextSegment: - - - YES - id - id - id - id - id - id - id - id - - - - YES - - YES - copy: - openExceptionFilename: - rerunTest: - runTests: - toggleDetails: - updateMode: - updateSearchFilter: - updateTextSegment: - - - YES - - copy: - id - - - openExceptionFilename: - id - - - rerunTest: - id - - - runTests: - id - - - toggleDetails: - id - - - updateMode: - id - - - updateSearchFilter: - id - - - updateTextSegment: - id - - - - - YES - - YES - _detailsView - _outlineView - _searchField - _segmentedControl - _splitView - _statusView - _textSegmentedControl - _textView - - - YES - NSView - NSOutlineView - NSSearchField - NSSegmentedControl - BWSplitView - NSView - NSSegmentedControl - NSTextView - - - - YES - - YES - _detailsView - _outlineView - _searchField - _segmentedControl - _splitView - _statusView - _textSegmentedControl - _textView - - - YES - - _detailsView - NSView - - - _outlineView - NSOutlineView - - - _searchField - NSSearchField - - - _segmentedControl - NSSegmentedControl - - - _splitView - BWSplitView - - - _statusView - NSView - - - _textSegmentedControl - NSSegmentedControl - - - _textView - NSTextView - - - - - IBProjectSource - ./Classes/GHTestViewController.h - - - - GHTestWindowController - NSWindowController - - YES - - YES - copy: - runTests: - - - YES - id - id - - - - YES - - YES - copy: - runTests: - - - YES - - copy: - id - - - runTests: - id - - - - - viewController - GHTestViewController - - - viewController - - viewController - GHTestViewController - - - - IBProjectSource - ./Classes/GHTestWindowController.h - - - - NSDocument - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - id - id - id - id - id - id - - - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - - printDocument: - id - - - revertDocumentToSaved: - id - - - runPageLayout: - id - - - saveDocument: - id - - - saveDocumentAs: - id - - - saveDocumentTo: - id - - - - - IBProjectSource - ./Classes/NSDocument.h - - - - WebView - - reloadFromOrigin: - id - - - reloadFromOrigin: - - reloadFromOrigin: - id - - - - IBProjectSource - ./Classes/WebView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - NSSwitch - - - YES - {9, 8} - {7, 2} - {15, 15} - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Demonstrates fetching a web page synchronously, the HTML source will appear in the box below when the download is complete. Because this synchronous download is running in the main thread, the interface will lock until the download is complete. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Demonstrates fetching a large file directly to disk, updating the progress bar below to show how much has been downloaded. + +If the request is stopped part way through, use the resume button to pick up where we left off. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Demonstrates a fetching 3 items at once, using an ASINetworkQueue to track progress. Each request has its downloadProgressDelegate set to the progress indicator under the image view. The queue manages the overall progress displayed at the bottom of the window. + + + + + + + + + + + When accurate progress is turned off, each request only updates progress when it completes. This means that each request is represented by the same amount of progress in the progress indicator. + +With accurate progress turned on, the queue will first perform a HEAD request for each image to obtain its size. Requests then update the progress as data is received. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Demonstrates fetching content from an area that requires HTTP authentication. You will be prompted for a username and password, enter 'topsecret' for both. + + + + + + + + + + + + If you turn on keychain support, successful authentication will result in the username and password you provided being stored in your keychain. The application will use these details rather than prompt you the next time. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The table view below is populated by downloading an XML file, then downloading the images from the URLs in the XML. The requests are configured to store their responses in the global ASIDownloadCache, and will re-use previously downloaded data if it exists rather than fetching it again. + + + + + + + + + + + + + + + + + + + + + + + + + + Demonstrates fetching a webpage with a single ASIWebPageRequest that downloads most external resources (images, stylesheets etc). These can be stored in a cache, or embeded directly in the HTML source. Once downloaded, a complete page may be cached indefinitely. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Mac.xcodeproj/project.pbxproj b/Mac.xcodeproj/project.pbxproj index d6fa1b47..4f9759cf 100644 --- a/Mac.xcodeproj/project.pbxproj +++ b/Mac.xcodeproj/project.pbxproj @@ -7,15 +7,13 @@ objects = { /* Begin PBXBuildFile section */ + 3F4BF1D6191B86610047A6E7 /* ASIS3RequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5C664BB100A6220004F3C96 /* ASIS3RequestTests.m */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - B502441B1025D36B002B13E1 /* ProxyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B502441A1025D36B002B13E1 /* ProxyTests.m */; }; B50C17DB121C254D0055FCAB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50C17DA121C254D0055FCAB /* Security.framework */; }; - B51A1A9511DDF84700ED75CF /* ASIDownloadCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B51A1A9411DDF84700ED75CF /* ASIDownloadCacheTests.m */; }; B522D71F103074AC009A2D22 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522D71E103074AC009A2D22 /* ASIInputStream.m */; }; B522D720103074AC009A2D22 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522D71E103074AC009A2D22 /* ASIInputStream.m */; }; B522DE601031BB03009A2D22 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B53FADE70FF38B2A002E2DE6 /* SystemConfiguration.framework */; }; B522DE821031BD5E009A2D22 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B53FADE70FF38B2A002E2DE6 /* SystemConfiguration.framework */; }; - B52D4A3210DA4EE0008E8365 /* PerformanceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B52D4A3110DA4EE0008E8365 /* PerformanceTests.m */; }; B53E62561255EC4600C1E79A /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B53E62551255EC4600C1E79A /* libxml2.dylib */; }; B53E62711255ED8700C1E79A /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E626F1255ED8700C1E79A /* ASIDataCompressor.m */; }; B53E62721255ED8700C1E79A /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E626F1255ED8700C1E79A /* ASIDataCompressor.m */; }; @@ -23,7 +21,6 @@ B53E62901255EE4B00C1E79A /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E628D1255EE4B00C1E79A /* ASIDataDecompressor.m */; }; B53E62B11255EEB800C1E79A /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B53E62B01255EEB800C1E79A /* WebKit.framework */; }; B53E62DC1255F6FC00C1E79A /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B53E62551255EC4600C1E79A /* libxml2.dylib */; }; - B53E62EF1255F73300C1E79A /* ASIDataCompressorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E62EE1255F73300C1E79A /* ASIDataCompressorTests.m */; }; B5403FEE1151149E00D8BE63 /* ASIS3Bucket.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FE71151149E00D8BE63 /* ASIS3Bucket.m */; }; B5403FEF1151149E00D8BE63 /* ASIS3BucketRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FE91151149E00D8BE63 /* ASIS3BucketRequest.m */; }; B5403FF01151149E00D8BE63 /* ASIS3ObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FEB1151149E00D8BE63 /* ASIS3ObjectRequest.m */; }; @@ -39,16 +36,11 @@ B55B5E700F7656A40064029C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5E6E0F7656A40064029C /* main.m */; }; B55B5E7F0F76573B0064029C /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = B55B5E730F7656DA0064029C /* MainMenu.xib */; }; B55B5ED20F76588D0064029C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5ED10F76588D0064029C /* AppDelegate.m */; }; - B55B60080F7659790064029C /* ASIFormDataRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D1B0F76568E0064029C /* ASIFormDataRequestTests.m */; }; - B55B60090F76597C0064029C /* ASIHTTPRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D1D0F76568E0064029C /* ASIHTTPRequestTests.m */; }; - B55B600A0F7659800064029C /* ASINetworkQueueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D1F0F76568E0064029C /* ASINetworkQueueTests.m */; }; B55B600C0F7659880064029C /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D160F76568E0064029C /* ASINetworkQueue.m */; }; B55B600F0F7659900064029C /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D140F76568E0064029C /* ASIHTTPRequest.m */; }; B55B60100F7659960064029C /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D120F76568E0064029C /* ASIFormDataRequest.m */; }; B565297E101C8D01000499CF /* ASITestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = B565297C101C8D01000499CF /* ASITestCase.m */; }; B56DF2BA13ED5C4100549DCD /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B551D5C613ED432B00607B74 /* libz.dylib */; }; - B5728CA010AEC2F4004F4CE6 /* StressTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5728C9F10AEC2F4004F4CE6 /* StressTests.m */; }; - B57A610812D5FBEB00887E97 /* ASIWebPageRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B57A610712D5FBEB00887E97 /* ASIWebPageRequestTests.m */; }; B5873F8C10FF2884001E145F /* ASIS3BucketObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F8710FF2884001E145F /* ASIS3BucketObject.m */; }; B5873F8E10FF2884001E145F /* ASIS3Request.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F8B10FF2884001E145F /* ASIS3Request.m */; }; B5873F9E10FF2890001E145F /* ASICloudFilesCDNRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9110FF2890001E145F /* ASICloudFilesCDNRequest.m */; }; @@ -58,10 +50,8 @@ B5873FA210FF2890001E145F /* ASICloudFilesObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9910FF2890001E145F /* ASICloudFilesObject.m */; }; B5873FA310FF2890001E145F /* ASICloudFilesObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9B10FF2890001E145F /* ASICloudFilesObjectRequest.m */; }; B5873FA410FF2890001E145F /* ASICloudFilesRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9D10FF2890001E145F /* ASICloudFilesRequest.m */; }; - B587400810FF2913001E145F /* ASICloudFilesRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B587400610FF2913001E145F /* ASICloudFilesRequestTests.m */; }; B5B513860FBEE515002C74D0 /* GHUnitTestMain.m in Sources */ = {isa = PBXBuildFile; fileRef = B5B513850FBEE515002C74D0 /* GHUnitTestMain.m */; }; B5BF64E612FDE9CA00CBC324 /* GHUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5BF64E512FDE9C900CBC324 /* GHUnit.framework */; }; - B5C664BC100A6220004F3C96 /* ASIS3RequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5C664BB100A6220004F3C96 /* ASIS3RequestTests.m */; }; B5ED5A9412FEBAEC00A12511 /* GHUnit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = B5BF64E512FDE9C900CBC324 /* GHUnit.framework */; }; /* End PBXBuildFile section */ @@ -443,7 +433,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0420; + LastUpgradeCheck = 0510; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Mac" */; compatibilityVersion = "Xcode 3.2"; @@ -535,19 +525,13 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - B55B60080F7659790064029C /* ASIFormDataRequestTests.m in Sources */, - B55B60090F76597C0064029C /* ASIHTTPRequestTests.m in Sources */, - B55B600A0F7659800064029C /* ASINetworkQueueTests.m in Sources */, B55B600C0F7659880064029C /* ASINetworkQueue.m in Sources */, B55B600F0F7659900064029C /* ASIHTTPRequest.m in Sources */, B55B60100F7659960064029C /* ASIFormDataRequest.m in Sources */, B5B513860FBEE515002C74D0 /* GHUnitTestMain.m in Sources */, - B5C664BC100A6220004F3C96 /* ASIS3RequestTests.m in Sources */, B565297E101C8D01000499CF /* ASITestCase.m in Sources */, - B502441B1025D36B002B13E1 /* ProxyTests.m in Sources */, + 3F4BF1D6191B86610047A6E7 /* ASIS3RequestTests.m in Sources */, B522D71F103074AC009A2D22 /* ASIInputStream.m in Sources */, - B5728CA010AEC2F4004F4CE6 /* StressTests.m in Sources */, - B52D4A3210DA4EE0008E8365 /* PerformanceTests.m in Sources */, B5873F8C10FF2884001E145F /* ASIS3BucketObject.m in Sources */, B5873F8E10FF2884001E145F /* ASIS3Request.m in Sources */, B5873F9E10FF2890001E145F /* ASICloudFilesCDNRequest.m in Sources */, @@ -557,18 +541,14 @@ B5873FA210FF2890001E145F /* ASICloudFilesObject.m in Sources */, B5873FA310FF2890001E145F /* ASICloudFilesObjectRequest.m in Sources */, B5873FA410FF2890001E145F /* ASICloudFilesRequest.m in Sources */, - B587400810FF2913001E145F /* ASICloudFilesRequestTests.m in Sources */, B5403FEE1151149E00D8BE63 /* ASIS3Bucket.m in Sources */, B5403FEF1151149E00D8BE63 /* ASIS3BucketRequest.m in Sources */, B5403FF01151149E00D8BE63 /* ASIS3ObjectRequest.m in Sources */, B5403FF11151149E00D8BE63 /* ASIS3ServiceRequest.m in Sources */, B552535D11D23EBB00F9B170 /* ASIDownloadCache.m in Sources */, - B51A1A9511DDF84700ED75CF /* ASIDownloadCacheTests.m in Sources */, B53E62711255ED8700C1E79A /* ASIDataCompressor.m in Sources */, B53E628F1255EE4B00C1E79A /* ASIDataDecompressor.m in Sources */, - B53E62EF1255F73300C1E79A /* ASIDataCompressorTests.m in Sources */, B54B23FA12AA7D9100A7F940 /* ASIWebPageRequest.m in Sources */, - B57A610812D5FBEB00887E97 /* ASIWebPageRequestTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -599,7 +579,7 @@ baseConfigurationReference = B515507810BD56E800608267 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/External/GHUnit\""; GCC_C_LANGUAGE_STANDARD = "compiler-default"; @@ -631,7 +611,7 @@ baseConfigurationReference = B515507810BD56E800608267 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/External/GHUnit\""; @@ -661,9 +641,9 @@ baseConfigurationReference = B515507810BD56E800608267 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_DYNAMIC_NO_PIC = NO; @@ -687,9 +667,9 @@ baseConfigurationReference = B515507810BD56E800608267 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_OBJC_GC = unsupported; @@ -708,7 +688,6 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -722,7 +701,6 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; diff --git a/iPhone Sample/GHUnitIOSTestMain.m b/iPhone Sample/GHUnitIOSTestMain.m index 08bf2ed3..64d8b3b5 100644 --- a/iPhone Sample/GHUnitIOSTestMain.m +++ b/iPhone Sample/GHUnitIOSTestMain.m @@ -36,7 +36,8 @@ // Default exception handler void exceptionHandler(NSException *exception) { - NSLog(@"%@\n%@", [exception reason], GHUStackTraceFromException(exception)); + //NSLog(@"%@\n%@", [exception reason], GHUStackTraceFromException(exception)); + NSLog(@"%@\n%@", [exception reason], [GHTesting descriptionForException:exception]); } int main(int argc, char *argv[]) { @@ -75,7 +76,7 @@ int main(int argc, char *argv[]) { if (getenv("GHUNIT_CLI")) { retVal = [GHTestRunner run]; } else { - retVal = UIApplicationMain(argc, argv, nil, @"GHUnitIPhoneAppDelegate"); + retVal = UIApplicationMain(argc, argv, nil, @"GHUnitIOSAppDelegate"); } [pool release]; return retVal; diff --git a/iPhone Sample/InfoCell.m b/iPhone Sample/InfoCell.m index 31f95f9d..5bc5c0b6 100644 --- a/iPhone Sample/InfoCell.m +++ b/iPhone Sample/InfoCell.m @@ -33,8 +33,8 @@ + (id)cell - (void)layoutSubviews { [super layoutSubviews]; - int tablePadding = 40; - int tableWidth = [[self superview] frame].size.width; + CGFloat tablePadding = 40; + CGFloat tableWidth = [[self superview] frame].size.width; if (tableWidth > 480) { // iPad tablePadding = 110; [[self textLabel] setFrame:CGRectMake(70,10,tableWidth-tablePadding-70,[[self class] neededHeightForDescription:[[self textLabel] text] withTableWidth:tableWidth])]; @@ -46,9 +46,9 @@ - (void)layoutSubviews + (NSUInteger)neededHeightForDescription:(NSString *)description withTableWidth:(NSUInteger)tableWidth { - int tablePadding = 40; - int offset = 0; - int textSize = 13; + CGFloat tablePadding = 40; + CGFloat offset = 0; + CGFloat textSize = 13; if (tableWidth > 480) { // iPad tablePadding = 110; offset = 70; diff --git a/iPhone Sample/QueueViewController.m b/iPhone Sample/QueueViewController.m index 27d5f8a5..b9af02fe 100644 --- a/iPhone Sample/QueueViewController.m +++ b/iPhone Sample/QueueViewController.m @@ -226,8 +226,8 @@ - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath [cell addSubview:imageLabel3]; } - NSUInteger imageWidth = (tableWidth-tablePadding-20)/3; - NSUInteger imageHeight = imageWidth*0.66f; + CGFloat imageWidth = (tableWidth-tablePadding-20)/3; + CGFloat imageHeight = imageWidth*0.66f; [imageView1 setFrame:CGRectMake(tablePadding/2,10,imageWidth,imageHeight)]; @@ -269,8 +269,8 @@ - (CGFloat)tableView:(UITableView *)theTableView heightForRowAtIndexPath:(NSInde if (tableWidth > 480) { // iPad tablePadding = 110; } - NSUInteger imageWidth = (tableWidth-tablePadding-20)/3; - NSUInteger imageHeight = imageWidth*0.66f; + CGFloat imageWidth = (tableWidth-tablePadding-20)/3; + CGFloat imageHeight = imageWidth*0.66f; return imageHeight+50; } else { return 42; diff --git a/iPhone Sample/Resources/Default-568h@2x.png b/iPhone Sample/Resources/Default-568h@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0891b7aabfcf3422423b109c8beed2bab838c607 GIT binary patch literal 18594 zcmeI4X;f257Jx&9fS`ixvS;&$x8J@slQFSel)6zJN=?13FB7H(lQjRkSy8x_-S~tvu2gzn1oS+dLcF#eqtq$ z%tf9TTvX?`)R@}3uBI;jzS-=ZR-Td&MHaS&;!0?Ni*#$#`n*~CcQK)Q9vAQ~TUpnI!j)a2biYK^R)M~A5wUDZhx?ULMX z3x1P&qt=trOY6P2U67L=m=U?F|5#Uj(eCueNTZaHs_ceWiHeET+j+tp3Jt9g(ekqP z2WOvfR{qV+9r+o4J5?qK>7;;^+I7tGv-i)es$X_D=EoKF+S?zsyj^oRFElP}c}JT< zd8SUs-?O?}2YD#ngKbnHgzHBcboxK_2r9l(?eNCl-pEzkJm}fY?WC*jnS?VBE4EpY zO$fEejz6fU;W2Kl>JeQBZBl-%Irg`obSlg*@4QB;Dd1H7^Oi5wvt4d{RZ!8Og?^aE z)k0$1g+V3fd(gdQ3d&q2q-FL*uy#}|bc^=VhFsl0jBgUGJ+-s3U8MK9A!YJJMxpci z5hJ%|{DwV48fZn0{n5l$N_KcSb#NKE4plB`9I6Zt=Z!~-zw0{9tg$L&Ju1F0X)Cy8 zKF;(&lJ>x)Jw(=;p~sF(Sd9VWGwFE2rnyS9!f^DZ8+aCLq zQ};>lcJ1GDLqjm6Hd>|Eabno@P`~Bn(~6^aD_#yoEH(a?Nm1S<;S+hSxI5d16^<1lEM3NPFi zkqPrpL)+ zgnseFikg`gJVBha1&7C4;O6>h=dt~`ND+;Zd?W(4v2JIb7Pt>Td42%M-Ju-XAH#Pns762L}K3 zDhvsRqN0Ni(1UrishD2YvV?4*h2iFj$+&N||Fn$4n|^NSU+o?~jq`0jVQt8T9l{7b zXiwwODFh2V!Q6sqP9S>WH$oOf$N~=d0-bqTlD61!=`&0eAP-F>XN?*|gtOXX{ zQVTWyYo4ZK0GAw!GHf|pz9`D;-bbb*5LBX*{bnz|+)$@&P9|ORM2o?95{;ejvo&r- zq8cBhTN6nn)7~W>54U)%-F_-b?YKdfk5I8MHcuzBD5)!;yv#Z&R&^y=@=>VTIMy#r zX&U<=BsPkdqcMe<_}2+>H%XKyrr5ZR8_KVe>ZqYN z^=^~TFD};;rHJ$U;{~w^hYojl4hRI@SH$^K{YEo=sg)WY87r!*7blQK&qnpDo0`Vn zkl)9u9g=mCh&ZCJS(L4yN3k0kQ zuvg$h2KEEk51T+O0JQ+r0`R>g{jvqM0Mr6d3qUOZwE!?PI7HY@CE|dr sfw?Q;rAv?G4&^^8-z_>&sWXMxvD*gPOU4CBe-*@OtE+wfmVJNyHv)PfH~;_u literal 0 HcmV?d00001 diff --git a/iPhone Sample/SynchronousViewController.m b/iPhone Sample/SynchronousViewController.m index 2c5c72ee..b7d2d6a9 100644 --- a/iPhone Sample/SynchronousViewController.m +++ b/iPhone Sample/SynchronousViewController.m @@ -116,7 +116,7 @@ - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath if (!cell) { cell = [DetailCell cell]; } - NSString *key = [[[request responseHeaders] allKeys] objectAtIndex:[indexPath row]]; + NSString *key = [[[request responseHeaders] allKeys] objectAtIndex:(NSUInteger)[indexPath row]]; [[cell textLabel] setText:key]; [[cell detailTextLabel] setText:[[request responseHeaders] objectForKey:key]]; } @@ -127,7 +127,7 @@ - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath - (NSInteger)tableView:(UITableView *)theTableView numberOfRowsInSection:(NSInteger)section { if (section == 3) { - return [[request responseHeaders] count]; + return (NSInteger)[[request responseHeaders] count]; } else { return 1; } diff --git a/iPhone Sample/WebPageViewController.m b/iPhone Sample/WebPageViewController.m index db982dc7..4b916026 100644 --- a/iPhone Sample/WebPageViewController.m +++ b/iPhone Sample/WebPageViewController.m @@ -118,9 +118,9 @@ - (void)requestFinished:(ASIWebPageRequest *)theRequest - (void)request:(ASIHTTPRequest *)theRequest didReceiveBytes:(long long)newLength { - NSInteger requestNumber = [[self requestsInProgress] indexOfObject:theRequest]; + NSUInteger requestNumber = [[self requestsInProgress] indexOfObject:theRequest]; if (requestNumber != NSNotFound) { - RequestProgressCell *cell = (RequestProgressCell *)[[self tableView] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:requestNumber inSection:2]]; + RequestProgressCell *cell = (RequestProgressCell *)[[self tableView] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:(NSInteger)requestNumber inSection:2]]; if ([theRequest contentLength]+[theRequest partialDownloadSize] > 0) { float progressAmount = (float)(([theRequest totalBytesRead]*1.0)/(([theRequest contentLength]+[theRequest partialDownloadSize])*1.0)); [[cell progressView] setProgress:progressAmount]; @@ -214,7 +214,7 @@ - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath if (!cell) { cell = [RequestProgressCell cell]; } - ASIHTTPRequest *theRequest = [[self requestsInProgress] objectAtIndex:[indexPath row]]; + ASIHTTPRequest *theRequest = [[self requestsInProgress] objectAtIndex:(NSUInteger)[indexPath row]]; if ([theRequest didUseCachedResponse]) { [[cell textLabel] setText:[NSString stringWithFormat:@"Cached: %@",[[theRequest url] absoluteString]]]; [[cell accessoryView] setHidden:YES]; @@ -285,7 +285,7 @@ - (NSInteger)tableView:(UITableView *)theTableView numberOfRowsInSection:(NSInte if (section == 1) { return 2; } else if (section == 2) { - return [requestsInProgress count]; + return (NSInteger)[requestsInProgress count]; } return 1; } diff --git a/iPhone Sample/iPhoneInfo.plist b/iPhone Sample/iPhoneInfo.plist index e47caae1..1dbf6505 100644 --- a/iPhone Sample/iPhoneInfo.plist +++ b/iPhone Sample/iPhoneInfo.plist @@ -22,5 +22,18 @@ 1.0 NSMainNibFile iPhoneMainWindow + UILaunchImages + + + UILaunchImageMinimumOSVersion + 7.0 + UILaunchImageName + Default + UILaunchImageOrientation + Portrait + UILaunchImageSize + {320, 568} + + diff --git a/iPhone.xcodeproj/project.pbxproj b/iPhone.xcodeproj/project.pbxproj index 704320fe..1aa3d4b8 100644 --- a/iPhone.xcodeproj/project.pbxproj +++ b/iPhone.xcodeproj/project.pbxproj @@ -7,22 +7,16 @@ objects = { /* Begin PBXBuildFile section */ - B50C1823121C26DB0055FCAB /* ClientCertificateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B50C1822121C26DB0055FCAB /* ClientCertificateTests.m */; }; + 3FAFBA88191B2C2100609F5B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */; }; + 3FBBD316191B6DA8004729A0 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */; }; B50C182C121C26FA0055FCAB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50C182B121C26FA0055FCAB /* Security.framework */; }; B50C1848121C27510055FCAB /* client.p12 in Resources */ = {isa = PBXBuildFile; fileRef = B50C1847121C27510055FCAB /* client.p12 */; }; - B50D532C126C87ED0022EA6F /* BlocksTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B50D532B126C87ED0022EA6F /* BlocksTests.m */; }; - B50F66191297FA45003887B1 /* strict.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = B50F66181297FA45003887B1 /* strict.xcconfig */; }; - B50F661A1297FA45003887B1 /* strict.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = B50F66181297FA45003887B1 /* strict.xcconfig */; }; - B50F661B1297FA45003887B1 /* strict.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = B50F66181297FA45003887B1 /* strict.xcconfig */; }; B51791A31024C3E800583567 /* AuthenticationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B51791A21024C3E800583567 /* AuthenticationViewController.m */; }; - B51A1A9B11DDF85100ED75CF /* ASIDownloadCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B51A1A7A11DDF7BF00ED75CF /* ASIDownloadCacheTests.m */; }; B522DACE1030B2AB009A2D22 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522DACD1030B2AB009A2D22 /* ASIInputStream.m */; }; B522DACF1030B2AB009A2D22 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522DACD1030B2AB009A2D22 /* ASIInputStream.m */; }; B523254211CA01F1006C6E5A /* Sample.xib in Resources */ = {isa = PBXBuildFile; fileRef = B523254111CA01F1006C6E5A /* Sample.xib */; }; B523254311CA01F1006C6E5A /* Sample.xib in Resources */ = {isa = PBXBuildFile; fileRef = B523254111CA01F1006C6E5A /* Sample.xib */; }; B52325AD11CA05A8006C6E5A /* info.png in Resources */ = {isa = PBXBuildFile; fileRef = B52325AC11CA05A8006C6E5A /* info.png */; }; - B5254FF91025F9BF00CF7BC4 /* ProxyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5254FF71025F9BF00CF7BC4 /* ProxyTests.m */; }; - B52D4A2F10DA4ED5008E8365 /* PerformanceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B52D4A2E10DA4ED5008E8365 /* PerformanceTests.m */; }; B53E6D951257B45800C1E79A /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E6D911257B45800C1E79A /* ASIDataDecompressor.m */; }; B53E6D961257B45800C1E79A /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E6D931257B45800C1E79A /* ASIDataCompressor.m */; }; B53E6D971257B45800C1E79A /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E6D911257B45800C1E79A /* ASIDataDecompressor.m */; }; @@ -49,9 +43,6 @@ B55B60CF0F765BBA0064029C /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B60460F765A320064029C /* ASIFormDataRequest.m */; }; B55B60D00F765BBD0064029C /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B60480F765A320064029C /* ASIHTTPRequest.m */; }; B55B60D10F765BC00064029C /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B604A0F765A320064029C /* ASINetworkQueue.m */; }; - B55B60D30F765BC90064029C /* ASIFormDataRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B60530F765A3C0064029C /* ASIFormDataRequestTests.m */; }; - B55B60D40F765BCD0064029C /* ASIHTTPRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B60550F765A3C0064029C /* ASIHTTPRequestTests.m */; }; - B55B60D50F765BD00064029C /* ASINetworkQueueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B60570F765A3C0064029C /* ASINetworkQueueTests.m */; }; B5652920101C8BD7000499CF /* ASITestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = B565291F101C8BD7000499CF /* ASITestCase.m */; }; B56529A3101C8EDA000499CF /* iphone-tests-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B56529A2101C8EDA000499CF /* iphone-tests-icon.png */; }; B576D4C111C7CC970059B815 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B576D4C011C7CC970059B815 /* CFNetwork.framework */; }; @@ -91,7 +82,6 @@ B5873FDD10FF28CA001E145F /* ASICloudFilesObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FD110FF28CA001E145F /* ASICloudFilesObject.m */; }; B5873FDE10FF28CA001E145F /* ASICloudFilesObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FD310FF28CA001E145F /* ASICloudFilesObjectRequest.m */; }; B5873FDF10FF28CA001E145F /* ASICloudFilesRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FD510FF28CA001E145F /* ASICloudFilesRequest.m */; }; - B5873FF510FF2904001E145F /* ASICloudFilesRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FF310FF2904001E145F /* ASICloudFilesRequestTests.m */; }; B59A87C2103EC6F200300252 /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = B59A87C1103EC6F200300252 /* ASIAuthenticationDialog.m */; }; B59A87C3103EC6F200300252 /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = B59A87C1103EC6F200300252 /* ASIAuthenticationDialog.m */; }; B5BD2AFA11CA541100D7C426 /* iPadSampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B5BD2AF911CA541100D7C426 /* iPadSampleAppDelegate.m */; }; @@ -105,8 +95,6 @@ B5BD2B0C11CA542700D7C426 /* SampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5BD2B0A11CA542700D7C426 /* SampleViewController.m */; }; B5BD2B0E11CA542700D7C426 /* SampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5BD2B0A11CA542700D7C426 /* SampleViewController.m */; }; B5BF64EF12FDFC7100CBC324 /* GHUnitIOSTestMain.m in Sources */ = {isa = PBXBuildFile; fileRef = B5BF64EE12FDFC7100CBC324 /* GHUnitIOSTestMain.m */; }; - B5C6663E100A82D7004F3C96 /* ASIS3RequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5C6663D100A82D7004F3C96 /* ASIS3RequestTests.m */; }; - B5EA45AA109B56D800E920CB /* StressTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5EA45A9109B56D800E920CB /* StressTests.m */; }; B5FE752711DBBA6400F898C8 /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B5FE752511DBBA6400F898C8 /* ASIDownloadCache.m */; }; B5FE752811DBBA6400F898C8 /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B5FE752511DBBA6400F898C8 /* ASIDownloadCache.m */; }; B5FE752911DBBA6400F898C8 /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B5FE752511DBBA6400F898C8 /* ASIDownloadCache.m */; }; @@ -143,6 +131,7 @@ /* Begin PBXFileReference section */ 1D6058910D05DD3D006BFB54 /* ASIHTTPRequest iPhone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ASIHTTPRequest iPhone.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "iPhone Sample/Resources/Default-568h@2x.png"; sourceTree = ""; }; B50C1821121C26DB0055FCAB /* ClientCertificateTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClientCertificateTests.h; sourceTree = ""; }; B50C1822121C26DB0055FCAB /* ClientCertificateTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClientCertificateTests.m; sourceTree = ""; }; B50C182B121C26FA0055FCAB /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; @@ -405,6 +394,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */, B52325AC11CA05A8006C6E5A /* info.png */, B558B58911C7F637009B4627 /* iPhoneInfo.plist */, B558B58B11C7F63E009B4627 /* iPadInfo.plist */, @@ -616,7 +606,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0410; + LastUpgradeCheck = 0510; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iPhone" */; compatibilityVersion = "Xcode 3.2"; @@ -645,9 +635,9 @@ buildActionMask = 2147483647; files = ( B55B60740F765A990064029C /* iphone-icon.png in Resources */, + 3FAFBA88191B2C2100609F5B /* Default-568h@2x.png in Resources */, B576D76611C7F4D90059B815 /* iPhoneMainWindow.xib in Resources */, B523254311CA01F1006C6E5A /* Sample.xib in Resources */, - B50F661A1297FA45003887B1 /* strict.xcconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -657,7 +647,7 @@ files = ( B56529A3101C8EDA000499CF /* iphone-tests-icon.png in Resources */, B50C1848121C27510055FCAB /* client.p12 in Resources */, - B50F661B1297FA45003887B1 /* strict.xcconfig in Resources */, + 3FBBD316191B6DA8004729A0 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -669,7 +659,6 @@ B558B5EB11C7F9C8009B4627 /* iPadMainWindow.xib in Resources */, B523254211CA01F1006C6E5A /* Sample.xib in Resources */, B52325AD11CA05A8006C6E5A /* info.png in Resources */, - B50F66191297FA45003887B1 /* strict.xcconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -754,16 +743,9 @@ B55B60CF0F765BBA0064029C /* ASIFormDataRequest.m in Sources */, B55B60D00F765BBD0064029C /* ASIHTTPRequest.m in Sources */, B55B60D10F765BC00064029C /* ASINetworkQueue.m in Sources */, - B55B60D30F765BC90064029C /* ASIFormDataRequestTests.m in Sources */, - B55B60D40F765BCD0064029C /* ASIHTTPRequestTests.m in Sources */, - B55B60D50F765BD00064029C /* ASINetworkQueueTests.m in Sources */, - B5C6663E100A82D7004F3C96 /* ASIS3RequestTests.m in Sources */, B5652920101C8BD7000499CF /* ASITestCase.m in Sources */, - B5254FF91025F9BF00CF7BC4 /* ProxyTests.m in Sources */, B522DACE1030B2AB009A2D22 /* ASIInputStream.m in Sources */, B59A87C2103EC6F200300252 /* ASIAuthenticationDialog.m in Sources */, - B5EA45AA109B56D800E920CB /* StressTests.m in Sources */, - B52D4A2F10DA4ED5008E8365 /* PerformanceTests.m in Sources */, B5873FD610FF28CA001E145F /* ASIS3BucketObject.m in Sources */, B5873FD810FF28CA001E145F /* ASIS3Request.m in Sources */, B5873FD910FF28CA001E145F /* ASICloudFilesCDNRequest.m in Sources */, @@ -773,18 +755,14 @@ B5873FDD10FF28CA001E145F /* ASICloudFilesObject.m in Sources */, B5873FDE10FF28CA001E145F /* ASICloudFilesObjectRequest.m in Sources */, B5873FDF10FF28CA001E145F /* ASICloudFilesRequest.m in Sources */, - B5873FF510FF2904001E145F /* ASICloudFilesRequestTests.m in Sources */, B540400B115114BA00D8BE63 /* ASIS3Bucket.m in Sources */, B540400C115114BA00D8BE63 /* ASIS3BucketRequest.m in Sources */, B540400D115114BA00D8BE63 /* ASIS3ObjectRequest.m in Sources */, B540400E115114BA00D8BE63 /* ASIS3ServiceRequest.m in Sources */, B55252B411D22E2200F9B170 /* Reachability.m in Sources */, B5FE752711DBBA6400F898C8 /* ASIDownloadCache.m in Sources */, - B51A1A9B11DDF85100ED75CF /* ASIDownloadCacheTests.m in Sources */, - B50C1823121C26DB0055FCAB /* ClientCertificateTests.m in Sources */, B53E6D951257B45800C1E79A /* ASIDataDecompressor.m in Sources */, B53E6D961257B45800C1E79A /* ASIDataCompressor.m in Sources */, - B50D532C126C87ED0022EA6F /* BlocksTests.m in Sources */, B57D0F4A12AA7D3600E5F992 /* ASIWebPageRequest.m in Sources */, B5BF64EF12FDFC7100CBC324 /* GHUnitIOSTestMain.m in Sources */, ); @@ -936,14 +914,13 @@ baseConfigurationReference = B50F66181297FA45003887B1 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iPhone Sample/iPhone_Prefix.pch"; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = "${SDK_DIR}/usr/include/libxml2"; INFOPLIST_FILE = "iPhone Sample/iPadInfo.plist"; IPHONEOS_DEPLOYMENT_TARGET = 3.2; @@ -957,11 +934,10 @@ baseConfigurationReference = B50F66181297FA45003887B1 /* strict.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iPhone Sample/iPhone_Prefix.pch"; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = "${SDK_DIR}/usr/include/libxml2"; INFOPLIST_FILE = "iPhone Sample/iPadInfo.plist"; IPHONEOS_DEPLOYMENT_TARGET = 3.2; @@ -973,7 +949,6 @@ 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; @@ -986,7 +961,6 @@ 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; diff --git a/strict.xcconfig.bak b/strict.xcconfig.bak new file mode 100644 index 00000000..018f7776 --- /dev/null +++ b/strict.xcconfig.bak @@ -0,0 +1,26 @@ +// +// strict.xcconfig +// Mac +// +// Created by Ben Copsey on 25/11/2009. +// Copyright 2009 All-Seeing Interactive. All rights reserved. +// + +GCC_WARN_CHECK_SWITCH_STATEMENTS = YES +GCC_WARN_SHADOW = YES +GCC_WARN_64_TO_32_BIT_CONVERSION = YES +GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES +GCC_WARN_ABOUT_RETURN_TYPE = YES +//GCC_WARN_MISSING_PARENTHESES = YES +GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES +//GCC_WARN_ABOUT_MISSING_NEWLINE = YES +GCC_WARN_SIGN_COMPARE = YES +GCC_WARN_STRICT_SELECTOR_MATCH = missing value +GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES +GCC_WARN_UNDECLARED_SELECTOR = YES +GCC_WARN_UNUSED_FUNCTION = YES +GCC_WARN_UNUSED_LABEL = YES +GCC_WARN_UNUSED_VALUE = YES +GCC_WARN_UNUSED_VARIABLE = YES +GCC_TREAT_WARNINGS_AS_ERRORS = YES +//RUN_CLANG_STATIC_ANALYZER = YES \ No newline at end of file From 91caf439fcab94c917f92b46f313bcbbf9d9b281 Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Thu, 8 May 2014 18:21:20 +0800 Subject: [PATCH 05/37] Set s3HOST to "sinastorage.com" on ASIS3Request and sign --- Classes/ASIHTTPRequest.m | 2 +- Classes/S3/ASIS3Request.m | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m index 4d2455f5..30a98921 100644 --- a/Classes/ASIHTTPRequest.m +++ b/Classes/ASIHTTPRequest.m @@ -24,7 +24,7 @@ #import "ASIDataCompressor.h" // Automatically set on build -NSString *ASIHTTPRequestVersion = @"v1.8.2-9 2014-05-08"; +NSString *ASIHTTPRequestVersion = @"v1.8.2-10 2014-05-08"; static NSString *defaultUserAgent = nil; diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index d07000c9..11c3d067 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -125,8 +125,8 @@ - (void)buildRequestHeaders // Jump through hoops while eating hot food NSString *stringToSign = [self stringToSignForHeaders:canonicalizedAmzHeaders resource:canonicalizedResource]; - NSString *signature = [ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:[self secretAccessKey] forString:stringToSign]]; - NSString *authorizationString = [NSString stringWithFormat:@"AWS %@:%@",[self accessKey],signature]; + NSString *signature = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:[self secretAccessKey] forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; + NSString *authorizationString = [NSString stringWithFormat:@"SINA %@:%@",[self accessKey],signature]; [self addRequestHeader:@"Authorization" value:authorizationString]; @@ -295,7 +295,8 @@ + (NSData *)HMACSHA1withKey:(NSString *)key forString:(NSString *)string + (NSString *)S3Host { - return @"s3.amazonaws.com"; + return @"sinastorage.com"; + //return @"s3.amazonaws.com"; } - (void)buildURL From 1b593ca80714fed5693c2cbcb3531ece3d61d8ad Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Fri, 9 May 2014 18:16:22 +0800 Subject: [PATCH 06/37] update --- Classes/ASIHTTPRequest.m | 4 +- Classes/S3/ASIS3Request.h | 1 + Classes/S3/ASIS3Request.m | 34 +- Classes/S3/ASIS3ServiceRequest.m | 39 +- Classes/Tests/ASISCSRequestTests.h | 18 + Classes/Tests/ASISCSRequestTests.m | 807 +++++++++++++++++++++++++++++ Classes/Tests/ASITestCase.h | 2 +- Mac.xcodeproj/project.pbxproj | 42 +- 8 files changed, 933 insertions(+), 14 deletions(-) create mode 100644 Classes/Tests/ASISCSRequestTests.h create mode 100644 Classes/Tests/ASISCSRequestTests.m diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m index 30a98921..6d2fb47c 100644 --- a/Classes/ASIHTTPRequest.m +++ b/Classes/ASIHTTPRequest.m @@ -24,7 +24,7 @@ #import "ASIDataCompressor.h" // Automatically set on build -NSString *ASIHTTPRequestVersion = @"v1.8.2-10 2014-05-08"; +NSString *ASIHTTPRequestVersion = @"v1.8.2-11 2014-05-09"; static NSString *defaultUserAgent = nil; @@ -4560,7 +4560,7 @@ + (void)recordBandwidthUsage } } #if DEBUG_THROTTLING - ASI_DEBUG_LOG(@"[THROTTLING] ===Used: %u bytes of bandwidth in last measurement period===",bandwidthUsedInLastSecond); + ASI_DEBUG_LOG(@"[THROTTLING] ===Used: %lu bytes of bandwidth in last measurement period===",bandwidthUsedInLastSecond); #endif [bandwidthUsageTracker addObject:[NSNumber numberWithUnsignedLong:bandwidthUsedInLastSecond]]; [bandwidthMeasurementDate release]; diff --git a/Classes/S3/ASIS3Request.h b/Classes/S3/ASIS3Request.h index 913aef9d..7759ba83 100644 --- a/Classes/S3/ASIS3Request.h +++ b/Classes/S3/ASIS3Request.h @@ -71,6 +71,7 @@ typedef enum _ASIS3ErrorType { // Parses the response to work out if S3 returned an error - (void)parseResponseXML; +- (void)parseResponseJson; #pragma mark shared access keys diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index 11c3d067..5585373e 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -35,6 +35,7 @@ - (id)initWithURL:(NSURL *)newURL // After a bit of experimentation/guesswork, this number seems to reduce the chance of a 'RequestTimeout' error [self setPersistentConnectionTimeoutSeconds:20]; [self setRequestScheme:ASIS3RequestSchemeHTTP]; + [self setValidatesSecureCertificate:NO]; return self; } @@ -135,14 +136,43 @@ - (void)buildRequestHeaders - (void)requestFinished { if ([[[self responseHeaders] objectForKey:@"Content-Type"] isEqualToString:@"application/xml"]) { + [self parseResponseXML]; - } + + } else if ([[[self responseHeaders] objectForKey:@"Content-Type"] isEqualToString:@"application/json"]) { + + [self parseResponseJson]; + } if (![self error]) { [super requestFinished]; } } -#pragma mark Error XML parsing +#pragma mark Error XML/Json parsing + +- (void)parseResponseJson { + + /* + + {"Message": "The provided token has expired.()", "Code": "ExpiredToken", "Resource": "\/", "RequestId": "05b43801-1405-0916-1056-782bcb67e2e3"} + + */ + + NSError *jsonParseError = nil; + NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:[self responseData] options:kNilOptions error:&jsonParseError]; + + if (jsonParseError == nil && jsonObject && [jsonObject isKindOfClass:[NSDictionary class]]) { + + if ([jsonObject objectForKey:@"Message"]) { + + [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIS3ResponseErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[jsonObject objectForKey:@"Message"], NSLocalizedDescriptionKey, nil]]]; + } + + } else { + + [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIS3ResponseParsingFailedType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Parsing the resposnse failed", NSLocalizedDescriptionKey, jsonParseError, NSUnderlyingErrorKey, nil]]]; + } +} - (void)parseResponseXML { diff --git a/Classes/S3/ASIS3ServiceRequest.m b/Classes/S3/ASIS3ServiceRequest.m index 40e897aa..b261b771 100644 --- a/Classes/S3/ASIS3ServiceRequest.m +++ b/Classes/S3/ASIS3ServiceRequest.m @@ -43,7 +43,42 @@ - (void)dealloc - (void)buildURL { - [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@",[self requestScheme],[[self class] S3Host]]]]; + [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@/?formatter=json",[self requestScheme],[[self class] S3Host]]]]; +} + +- (void)parseResponseJson { + + NSError *jsonParseError = nil; + NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:[self responseData] options:kNilOptions error:&jsonParseError]; + + if (jsonParseError == nil && jsonObject && [jsonObject isKindOfClass:[NSDictionary class]] && [jsonObject objectForKey:@"Owner"] && [jsonObject objectForKey:@"Buckets"]) { + + if ([[jsonObject objectForKey:@"Owner"] isKindOfClass:[NSDictionary class]]) { + + NSDictionary *owner = [jsonObject objectForKey:@"Owner"]; + + [self setOwnerID:[owner objectForKey:@"ID"]]; + [self setOwnerName:[owner objectForKey:@"DisplayName"]]; + } + + if ([[jsonObject objectForKey:@"Buckets"] isKindOfClass:[NSArray class]]) { + + for (id item in [jsonObject objectForKey:@"Buckets"]) { + + if ([item isKindOfClass:[NSDictionary class]]) { + + ASIS3Bucket *bucket = [ASIS3Bucket bucketWithOwnerID:[self ownerID] ownerName:[self ownerName]]; + [bucket setName:[item objectForKey:@"Name"]]; + [bucket setCreationDate:[[ASIS3Request S3RequestDateFormatter] dateFromString:[item objectForKey:@"CreationDate"]]]; + [[self buckets] addObject:bucket]; + } + } + } + + } else { + + [super parseResponseJson]; + } } - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict @@ -62,7 +97,7 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName names } else if ([elementName isEqualToString:@"Name"]) { [[self currentBucket] setName:[self currentXMLElementContent]]; } else if ([elementName isEqualToString:@"CreationDate"]) { - [[self currentBucket] setCreationDate:[[ASIS3Request S3ResponseDateFormatter] dateFromString:[self currentXMLElementContent]]]; + [[self currentBucket] setCreationDate:[[ASIS3Request S3RequestDateFormatter] dateFromString:[self currentXMLElementContent]]]; } else if ([elementName isEqualToString:@"ID"]) { [self setOwnerID:[self currentXMLElementContent]]; } else if ([elementName isEqualToString:@"DisplayName"]) { diff --git a/Classes/Tests/ASISCSRequestTests.h b/Classes/Tests/ASISCSRequestTests.h new file mode 100644 index 00000000..3117443b --- /dev/null +++ b/Classes/Tests/ASISCSRequestTests.h @@ -0,0 +1,18 @@ +// +// ASIS3RequestTests.h +// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest +// +// Created by Ben Copsey on 12/07/2009. +// Copyright 2009 All-Seeing Interactive. All rights reserved. +// + +#import "ASITestCase.h" + +@class ASINetworkQueue; + +@interface ASISCSRequestTests : ASITestCase { + + +} + +@end diff --git a/Classes/Tests/ASISCSRequestTests.m b/Classes/Tests/ASISCSRequestTests.m new file mode 100644 index 00000000..a005ebdc --- /dev/null +++ b/Classes/Tests/ASISCSRequestTests.m @@ -0,0 +1,807 @@ +// +// ASIS3RequestTests.m +// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest +// +// Created by Ben Copsey on 12/07/2009. +// Copyright 2009 All-Seeing Interactive. All rights reserved. +// + +#import "ASISCSRequestTests.h" +#import "ASINetworkQueue.h" +#import "ASIS3BucketObject.h" +#import "ASIS3ObjectRequest.h" +#import "ASIS3BucketRequest.h" +#import "ASIS3ServiceRequest.h" + +// Fill in these to run the tests that actually connect and manipulate objects on S3 +static NSString *accessKey = @""; +static NSString *secretAccessKey = @""; + +// You should run these tests on a bucket that does not yet exist +static NSString *bucket = @""; + + + +// Stop clang complaining about undeclared selectors +@interface ASISCSRequestTests () { + + ASINetworkQueue *networkQueue; + float progress; +} + +- (void)GETRequestDone:(ASIHTTPRequest *)request; +- (void)GETRequestFailed:(ASIHTTPRequest *)request; +- (void)PUTRequestDone:(ASIHTTPRequest *)request; +- (void)PUTRequestFailed:(ASIHTTPRequest *)request; +- (void)DELETERequestDone:(ASIHTTPRequest *)request; +- (void)DELETERequestFailed:(ASIHTTPRequest *)request; + +@property (retain, nonatomic) ASINetworkQueue *networkQueue; + +@end + +@implementation ASISCSRequestTests + +- (void)logRequest:(ASIHTTPRequest *)request { + + GHTestLog(@"Request =============================\n"); + GHTestLog(@"%@: %@", [request requestMethod], [request url]); + GHTestLog(@"%@", [request requestHeaders]); + + GHTestLog(@"\n\nResponse =============================\n"); + GHTestLog(@"%d: %@", [request responseStatusCode], [request responseStatusMessage]); + GHTestLog(@"%@", [request responseHeaders]); + GHTestLog(@"%@", [request responseString]); +} + + +- (NSString *)randomStringWithLength:(int)len { + + NSString *letters = @"abcdefghijklmnopqrstuvwxyz0123456789"; + + NSMutableString *randomString = [NSMutableString stringWithCapacity:len]; + + for (int i=0; i 0); + GHAssertTrue(success,@"Failed to create a retained copy"); + success = ([request2 isKindOfClass:[ASIS3Request class]]); + GHAssertTrue(success,@"Copy is of wrong class"); + + [request2 release]; + + pool = [[NSAutoreleasePool alloc] init]; + + + ASIS3BucketRequest *request3 = [ASIS3BucketRequest requestWithBucket:@"foo"]; + ASIS3BucketRequest *request4 = [request3 copy]; + GHAssertNotNil(request4,@"Failed to create a copy"); + + [pool release]; + + success = ([request4 retainCount] > 0); + GHAssertTrue(success,@"Failed to create a retained copy"); + success = ([request4 isKindOfClass:[ASIS3BucketRequest class]]); + GHAssertTrue(success,@"Copy is of wrong class"); + + [request4 release]; + + pool = [[NSAutoreleasePool alloc] init]; + + + ASIS3BucketObject *bucketObject = [ASIS3BucketObject objectWithBucket:@"foo"]; + ASIS3BucketObject *bucketObject2 = [bucketObject copy]; + GHAssertNotNil(bucketObject2,@"Failed to create a copy"); + + [pool release]; + + success = ([bucketObject2 retainCount] > 0); + GHAssertTrue(success,@"Failed to create a retained copy"); + + [bucketObject2 release]; +} + + +- (void)testHTTPS +{ + [ASIS3Request setSharedAccessKey:accessKey]; + [ASIS3Request setSharedSecretAccessKey:secretAccessKey]; + + // Create a bucket + ASIS3Request *request = [ASIS3BucketRequest PUTRequestWithBucket:bucket]; + [request setValidatesSecureCertificate:NO]; + [request setRequestScheme:ASIS3RequestSchemeHTTPS]; + [request startSynchronous]; + GHAssertNil([request error],@"Failed to create a bucket"); + + // PUT something in it + NSString *key = @"king"; + request = [ASIS3ObjectRequest PUTRequestForData:[@"fink" dataUsingEncoding:NSUTF8StringEncoding] withBucket:bucket key:key]; + [request setRequestScheme:ASIS3RequestSchemeHTTPS]; + [request startSynchronous]; + BOOL success = [[request responseString] isEqualToString:@""]; + GHAssertTrue(success,@"Failed to PUT some data into S3"); + + // GET it + request = [ASIS3ObjectRequest requestWithBucket:bucket key:key]; + [request setRequestScheme:ASIS3RequestSchemeHTTPS]; + [request startSynchronous]; + success = [[request responseString] isEqualToString:@"fink"]; + GHAssertTrue(success,@"Failed to GET the correct data from S3"); + + // DELETE it + request = [ASIS3ObjectRequest DELETERequestWithBucket:bucket key:@"king"]; + [request setRequestScheme:ASIS3RequestSchemeHTTPS]; + [request startSynchronous]; + success = [[request responseString] isEqualToString:@""]; + GHAssertTrue(success,@"Failed to DELETE the object from S3"); + + // Delete the bucket + request = [ASIS3BucketRequest DELETERequestWithBucket:bucket]; + [request setRequestScheme:ASIS3RequestSchemeHTTPS]; + [request startSynchronous]; + GHAssertNil([request error],@"Failed to delete a bucket"); + + [ASIS3Request setSharedAccessKey:nil]; + [ASIS3Request setSharedSecretAccessKey:nil]; +} + +// Ideally this test would actually parse the ACL XML and check it, but for now it just makes sure S3 doesn't return an error +- (void)testCannedACLs +{ + [ASIS3Request setSharedAccessKey:accessKey]; + [ASIS3Request setSharedSecretAccessKey:secretAccessKey]; + + // Create a bucket + ASIS3Request *request = [ASIS3BucketRequest PUTRequestWithBucket:bucket]; + [request setRequestScheme:ASIS3RequestSchemeHTTPS]; + [request startSynchronous]; + GHAssertNil([request error],@"Failed to create a bucket"); + + NSArray *ACLs = [NSArray arrayWithObjects:ASIS3AccessPolicyPrivate, ASIS3AccessPolicyPublicRead, ASIS3AccessPolicyPublicReadWrite, ASIS3AccessPolicyAuthenticatedRead, nil]; + + for (NSString *cannedACL in ACLs) { + // PUT object + NSString *key = @"king"; + request = [ASIS3ObjectRequest PUTRequestForData:[@"fink" dataUsingEncoding:NSUTF8StringEncoding] withBucket:bucket key:key]; + [request setAccessPolicy:cannedACL]; + [request startSynchronous]; + [self logRequest:request]; + GHAssertNil([request error],@"Failed to PUT some data into S3"); + + sleep(1); + + // GET object ACL + request = [ASIS3ObjectRequest requestWithBucket:bucket key:key subResource:@"acl"]; + [request startSynchronous]; + [self logRequest:request]; + GHAssertNil([request error],@"Failed to fetch the object"); + } + + // DELETE it + request = [ASIS3ObjectRequest DELETERequestWithBucket:bucket key:@"king"]; + [request setRequestScheme:ASIS3RequestSchemeHTTPS]; + [request startSynchronous]; + BOOL success = [[request responseString] isEqualToString:@""]; + GHAssertTrue(success,@"Failed to DELETE the object from S3"); + + // Delete the bucket + request = [ASIS3BucketRequest DELETERequestWithBucket:bucket]; + [request setRequestScheme:ASIS3RequestSchemeHTTPS]; + [request startSynchronous]; + GHAssertNil([request error],@"Failed to delete a bucket"); + + [ASIS3Request setSharedAccessKey:nil]; + [ASIS3Request setSharedSecretAccessKey:nil]; +} + + +@synthesize networkQueue; + +@end diff --git a/Classes/Tests/ASITestCase.h b/Classes/Tests/ASITestCase.h index 2d33540e..2dae15a0 100644 --- a/Classes/Tests/ASITestCase.h +++ b/Classes/Tests/ASITestCase.h @@ -14,7 +14,7 @@ #import #endif -@interface ASITestCase : GHTestCase { +@interface ASITestCase : GHAsyncTestCase { } - (NSString *)filePathForTemporaryTestFiles; @end diff --git a/Mac.xcodeproj/project.pbxproj b/Mac.xcodeproj/project.pbxproj index 4f9759cf..f74cabb2 100644 --- a/Mac.xcodeproj/project.pbxproj +++ b/Mac.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 3F4BF1D6191B86610047A6E7 /* ASIS3RequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5C664BB100A6220004F3C96 /* ASIS3RequestTests.m */; }; + 3F4BF1DC191CB5A60047A6E7 /* ASISCSRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4BF1DB191CB5A60047A6E7 /* ASISCSRequestTests.m */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; B50C17DB121C254D0055FCAB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50C17DA121C254D0055FCAB /* Security.framework */; }; B522D71F103074AC009A2D22 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522D71E103074AC009A2D22 /* ASIInputStream.m */; }; @@ -73,6 +73,8 @@ 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 3F4BF1DA191CB5A60047A6E7 /* ASISCSRequestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASISCSRequestTests.h; sourceTree = ""; }; + 3F4BF1DB191CB5A60047A6E7 /* ASISCSRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASISCSRequestTests.m; sourceTree = ""; }; 8D1107320486CEB800E47090 /* Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mac.app; sourceTree = BUILT_PRODUCTS_DIR; }; B50244191025D36B002B13E1 /* ProxyTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyTests.h; sourceTree = ""; }; B502441A1025D36B002B13E1 /* ProxyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProxyTests.m; sourceTree = ""; }; @@ -275,22 +277,47 @@ name = Frameworks; sourceTree = ""; }; - B51E61A2100BA84C004A300D /* S3 */ = { + 3F4BF1D7191C76B80047A6E7 /* Requests */ = { isa = PBXGroup; children = ( - B5403FE61151149E00D8BE63 /* ASIS3Bucket.h */, - B5403FE71151149E00D8BE63 /* ASIS3Bucket.m */, B5403FE81151149E00D8BE63 /* ASIS3BucketRequest.h */, B5403FE91151149E00D8BE63 /* ASIS3BucketRequest.m */, B5403FEA1151149E00D8BE63 /* ASIS3ObjectRequest.h */, B5403FEB1151149E00D8BE63 /* ASIS3ObjectRequest.m */, B5403FEC1151149E00D8BE63 /* ASIS3ServiceRequest.h */, B5403FED1151149E00D8BE63 /* ASIS3ServiceRequest.m */, - B5873F8610FF2884001E145F /* ASIS3BucketObject.h */, - B5873F8710FF2884001E145F /* ASIS3BucketObject.m */, B5873F8A10FF2884001E145F /* ASIS3Request.h */, B5873F8B10FF2884001E145F /* ASIS3Request.m */, ); + name = Requests; + sourceTree = ""; + }; + 3F4BF1D8191C76C00047A6E7 /* Objects */ = { + isa = PBXGroup; + children = ( + B5403FE61151149E00D8BE63 /* ASIS3Bucket.h */, + B5403FE71151149E00D8BE63 /* ASIS3Bucket.m */, + B5873F8610FF2884001E145F /* ASIS3BucketObject.h */, + B5873F8710FF2884001E145F /* ASIS3BucketObject.m */, + ); + name = Objects; + sourceTree = ""; + }; + 3F4BF1D9191CB58B0047A6E7 /* SCS */ = { + isa = PBXGroup; + children = ( + 3F4BF1DA191CB5A60047A6E7 /* ASISCSRequestTests.h */, + 3F4BF1DB191CB5A60047A6E7 /* ASISCSRequestTests.m */, + ); + name = SCS; + sourceTree = ""; + }; + B51E61A2100BA84C004A300D /* S3 */ = { + isa = PBXGroup; + children = ( + 3F4BF1D8191C76C00047A6E7 /* Objects */, + 3F4BF1D7191C76B80047A6E7 /* Requests */, + ); name = S3; sourceTree = ""; }; @@ -335,6 +362,7 @@ B55B5D190F76568E0064029C /* Tests */ = { isa = PBXGroup; children = ( + 3F4BF1D9191CB58B0047A6E7 /* SCS */, B5B513850FBEE515002C74D0 /* GHUnitTestMain.m */, B565297D101C8D01000499CF /* ASITestCase.h */, B565297C101C8D01000499CF /* ASITestCase.m */, @@ -530,7 +558,6 @@ B55B60100F7659960064029C /* ASIFormDataRequest.m in Sources */, B5B513860FBEE515002C74D0 /* GHUnitTestMain.m in Sources */, B565297E101C8D01000499CF /* ASITestCase.m in Sources */, - 3F4BF1D6191B86610047A6E7 /* ASIS3RequestTests.m in Sources */, B522D71F103074AC009A2D22 /* ASIInputStream.m in Sources */, B5873F8C10FF2884001E145F /* ASIS3BucketObject.m in Sources */, B5873F8E10FF2884001E145F /* ASIS3Request.m in Sources */, @@ -543,6 +570,7 @@ B5873FA410FF2890001E145F /* ASICloudFilesRequest.m in Sources */, B5403FEE1151149E00D8BE63 /* ASIS3Bucket.m in Sources */, B5403FEF1151149E00D8BE63 /* ASIS3BucketRequest.m in Sources */, + 3F4BF1DC191CB5A60047A6E7 /* ASISCSRequestTests.m in Sources */, B5403FF01151149E00D8BE63 /* ASIS3ObjectRequest.m in Sources */, B5403FF11151149E00D8BE63 /* ASIS3ServiceRequest.m in Sources */, B552535D11D23EBB00F9B170 /* ASIDownloadCache.m in Sources */, From 9601a2743cdb193182f94fe7f957deaed1dcd006 Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Sun, 11 May 2014 14:16:10 +0800 Subject: [PATCH 07/37] update --- Classes/S3/ASIS3BucketRequest.m | 2 +- Classes/S3/ASIS3ObjectRequest.m | 4 +++- Classes/Tests/ASISCSRequestTests.m | 27 ++++++++++++++++++++++----- Mac.xcodeproj/project.pbxproj | 16 ++++++++-------- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Classes/S3/ASIS3BucketRequest.m b/Classes/S3/ASIS3BucketRequest.m index f4e6a8a7..cdbfa6c0 100644 --- a/Classes/S3/ASIS3BucketRequest.m +++ b/Classes/S3/ASIS3BucketRequest.m @@ -140,7 +140,7 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName names } else if ([elementName isEqualToString:@"Prefix"] && [[self currentXMLElementStack] count] > 2 && [[[self currentXMLElementStack] objectAtIndex:[[self currentXMLElementStack] count]-2] isEqualToString:@"CommonPrefixes"]) { [[self commonPrefixes] addObject:[self currentXMLElementContent]]; } else if ([elementName isEqualToString:@"IsTruncated"]) { - [self setIsTruncated:[[self currentXMLElementContent] isEqualToString:@"true"]]; + [self setIsTruncated:[[self currentXMLElementContent] isEqualToString:@"True"]]; } else { // Let ASIS3Request look for error messages [super parser:parser didEndElement:elementName namespaceURI:namespaceURI qualifiedName:qName]; diff --git a/Classes/S3/ASIS3ObjectRequest.m b/Classes/S3/ASIS3ObjectRequest.m index 99442bba..d032aa91 100644 --- a/Classes/S3/ASIS3ObjectRequest.m +++ b/Classes/S3/ASIS3ObjectRequest.m @@ -137,7 +137,9 @@ - (NSMutableDictionary *)S3Headers NSMutableDictionary *headers = [super S3Headers]; if ([self sourceKey]) { NSString *path = [ASIS3Request stringByURLEncodingForS3Path:[self sourceKey]]; - [headers setObject:[[self sourceBucket] stringByAppendingString:path] forKey:@"x-amz-copy-source"]; + NSString *copySource = [NSString stringWithFormat:@"/%@%@", [self sourceBucket], path]; + [headers setObject:copySource forKey:@"x-amz-copy-source"]; + //[headers setObject:[[self sourceBucket] stringByAppendingString:path] forKey:@"x-amz-copy-source"]; } if ([self storageClass]) { [headers setObject:[self storageClass] forKey:@"x-amz-storage-class"]; diff --git a/Classes/Tests/ASISCSRequestTests.m b/Classes/Tests/ASISCSRequestTests.m index a005ebdc..3ec6f1a3 100644 --- a/Classes/Tests/ASISCSRequestTests.m +++ b/Classes/Tests/ASISCSRequestTests.m @@ -76,17 +76,16 @@ - (void)testListBucket { [serviceRequest setSecretAccessKey:secretAccessKey]; [serviceRequest setAccessKey:accessKey]; - [self prepare]; + //[self prepare]; [serviceRequest startSynchronous]; - /* + [self logRequest:serviceRequest]; GHTestLog(@"%@", [serviceRequest buckets]); GHAssertNil([serviceRequest error], [NSString stringWithFormat:@"%@, %@", [[serviceRequest error] description], [serviceRequest url]]); - */ } - (void)testFailure @@ -144,6 +143,7 @@ - (void)testFailure - (void)createTestBucket { + return; /* if (!bucket) { @@ -169,12 +169,14 @@ - (void)testREST GHAssertTrue(success, @"You need to supply your S3 access details to run the REST test (see the top of ASIS3RequestTests.m)"); // Test creating a bucket + /* ASIS3BucketRequest *bucketRequest = [ASIS3BucketRequest PUTRequestWithBucket:bucket]; [bucketRequest setSecretAccessKey:secretAccessKey]; [bucketRequest setAccessKey:accessKey]; [bucketRequest startSynchronous]; GHAssertNil([bucketRequest error],@"Failed to create a bucket"); - + */ + // List buckets to make sure the bucket is there ASIS3ServiceRequest *serviceRequest = [ASIS3ServiceRequest serviceRequest]; [serviceRequest setSecretAccessKey:secretAccessKey]; @@ -228,6 +230,7 @@ - (void)testREST [request setSecretAccessKey:secretAccessKey]; [request setAccessKey:accessKey]; [request startSynchronous]; + [self logRequest:request]; GHAssertNil([request error],@"Failed to COPY a file"); // GET the copy @@ -321,11 +324,13 @@ - (void)testREST GHAssertTrue(success,@"Failed to DELETE the file from S3"); // Delete the bucket + /* bucketRequest = [ASIS3BucketRequest DELETERequestWithBucket:bucket]; [bucketRequest setSecretAccessKey:secretAccessKey]; [bucketRequest setAccessKey:accessKey]; [bucketRequest startSynchronous]; GHAssertNil([bucketRequest error],@"Failed to delete a bucket"); + */ } @@ -436,7 +441,7 @@ - (void)testListRequest [listRequest setMarker:@"bar"]; [listRequest setMaxResultCount:5]; [listRequest buildURL]; - NSString *expectedURL = [NSString stringWithFormat:@"http://%@.s3.amazonaws.com/?acl&prefix=foo&marker=bar&delimiter=/&max-keys=5",bucket]; + NSString *expectedURL = [NSString stringWithFormat:@"http://%@.sinastorage.com/?acl&prefix=foo&marker=bar&delimiter=/&max-keys=5",bucket]; success = ([[[listRequest url] absoluteString] isEqualToString:expectedURL]); GHAssertTrue(success,@"Generated the wrong url when requesting a subresource"); @@ -714,11 +719,15 @@ - (void)testHTTPS [ASIS3Request setSharedSecretAccessKey:secretAccessKey]; // Create a bucket + /* ASIS3Request *request = [ASIS3BucketRequest PUTRequestWithBucket:bucket]; [request setValidatesSecureCertificate:NO]; [request setRequestScheme:ASIS3RequestSchemeHTTPS]; [request startSynchronous]; GHAssertNil([request error],@"Failed to create a bucket"); + */ + + ASIS3Request *request; // PUT something in it NSString *key = @"king"; @@ -743,10 +752,12 @@ - (void)testHTTPS GHAssertTrue(success,@"Failed to DELETE the object from S3"); // Delete the bucket + /* request = [ASIS3BucketRequest DELETERequestWithBucket:bucket]; [request setRequestScheme:ASIS3RequestSchemeHTTPS]; [request startSynchronous]; GHAssertNil([request error],@"Failed to delete a bucket"); + */ [ASIS3Request setSharedAccessKey:nil]; [ASIS3Request setSharedSecretAccessKey:nil]; @@ -759,10 +770,14 @@ - (void)testCannedACLs [ASIS3Request setSharedSecretAccessKey:secretAccessKey]; // Create a bucket + /* ASIS3Request *request = [ASIS3BucketRequest PUTRequestWithBucket:bucket]; [request setRequestScheme:ASIS3RequestSchemeHTTPS]; [request startSynchronous]; GHAssertNil([request error],@"Failed to create a bucket"); + */ + + ASIS3Request *request; NSArray *ACLs = [NSArray arrayWithObjects:ASIS3AccessPolicyPrivate, ASIS3AccessPolicyPublicRead, ASIS3AccessPolicyPublicReadWrite, ASIS3AccessPolicyAuthenticatedRead, nil]; @@ -792,10 +807,12 @@ - (void)testCannedACLs GHAssertTrue(success,@"Failed to DELETE the object from S3"); // Delete the bucket + /* request = [ASIS3BucketRequest DELETERequestWithBucket:bucket]; [request setRequestScheme:ASIS3RequestSchemeHTTPS]; [request startSynchronous]; GHAssertNil([request error],@"Failed to delete a bucket"); + */ [ASIS3Request setSharedAccessKey:nil]; [ASIS3Request setSharedSecretAccessKey:nil]; diff --git a/Mac.xcodeproj/project.pbxproj b/Mac.xcodeproj/project.pbxproj index f74cabb2..c1087b1e 100644 --- a/Mac.xcodeproj/project.pbxproj +++ b/Mac.xcodeproj/project.pbxproj @@ -200,6 +200,14 @@ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( + B53FADE70FF38B2A002E2DE6 /* SystemConfiguration.framework */, + B51791281024BF0F00583567 /* Security.framework */, + B50C17DA121C254D0055FCAB /* Security.framework */, + B50C18D1121C2F240055FCAB /* Foundation.framework */, + B53E62551255EC4600C1E79A /* libxml2.dylib */, + B53E62571255EC4E00C1E79A /* libtidy.dylib */, + B551D5C613ED432B00607B74 /* libz.dylib */, + B53E62B01255EEB800C1E79A /* WebKit.framework */, 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, B5BF64E512FDE9C900CBC324 /* GHUnit.framework */, ); @@ -233,14 +241,6 @@ 29B97317FDCFA39411CA2CEA /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, - B53FADE70FF38B2A002E2DE6 /* SystemConfiguration.framework */, - B51791281024BF0F00583567 /* Security.framework */, - B50C17DA121C254D0055FCAB /* Security.framework */, - B50C18D1121C2F240055FCAB /* Foundation.framework */, - B53E62551255EC4600C1E79A /* libxml2.dylib */, - B53E62571255EC4E00C1E79A /* libtidy.dylib */, - B551D5C613ED432B00607B74 /* libz.dylib */, - B53E62B01255EEB800C1E79A /* WebKit.framework */, ); name = Mac; sourceTree = ""; From a04882c3c81e6136afedcf3078162ec8f4e0f690 Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Mon, 12 May 2014 11:49:12 +0800 Subject: [PATCH 08/37] update --- Classes/ASIHTTPRequest.m | 2 +- Classes/S3/ASIS3BucketRequest.m | 3 +- Classes/Tests/ASISCSRequestTests.m | 13 ++++++- iPhone.xcodeproj/project.pbxproj | 54 +++++++++++++++++++++++------- 4 files changed, 57 insertions(+), 15 deletions(-) diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m index 6d2fb47c..c89031bd 100644 --- a/Classes/ASIHTTPRequest.m +++ b/Classes/ASIHTTPRequest.m @@ -24,7 +24,7 @@ #import "ASIDataCompressor.h" // Automatically set on build -NSString *ASIHTTPRequestVersion = @"v1.8.2-11 2014-05-09"; +NSString *ASIHTTPRequestVersion = @"v1.8.2-13 2014-05-12"; static NSString *defaultUserAgent = nil; diff --git a/Classes/S3/ASIS3BucketRequest.m b/Classes/S3/ASIS3BucketRequest.m index cdbfa6c0..9a6b1b5a 100644 --- a/Classes/S3/ASIS3BucketRequest.m +++ b/Classes/S3/ASIS3BucketRequest.m @@ -128,7 +128,8 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName names } else if ([elementName isEqualToString:@"Key"]) { [[self currentObject] setKey:[self currentXMLElementContent]]; } else if ([elementName isEqualToString:@"LastModified"]) { - [[self currentObject] setLastModified:[[ASIS3Request S3ResponseDateFormatter] dateFromString:[self currentXMLElementContent]]]; + //[[self currentObject] setLastModified:[[ASIS3Request S3ResponseDateFormatter] dateFromString:[self currentXMLElementContent]]]; + [[self currentObject] setLastModified:[[ASIS3Request S3RequestDateFormatter] dateFromString:[self currentXMLElementContent]]]; } else if ([elementName isEqualToString:@"ETag"]) { [[self currentObject] setETag:[self currentXMLElementContent]]; } else if ([elementName isEqualToString:@"Size"]) { diff --git a/Classes/Tests/ASISCSRequestTests.m b/Classes/Tests/ASISCSRequestTests.m index 3ec6f1a3..efd1e621 100644 --- a/Classes/Tests/ASISCSRequestTests.m +++ b/Classes/Tests/ASISCSRequestTests.m @@ -373,7 +373,7 @@ - (void)testGZippedContent GHAssertTrue(success,@"Failed to GET the correct data from S3"); // Now grab the data using something other than ASIHTTPRequest to ensure other HTTP clients can parse the gzipped content - NSData *data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@.s3.amazonaws.com/gzipped-data",bucket]]] returningResponse:NULL error:NULL]; + NSData *data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@.sinastorage.com.com/gzipped-data",bucket]]] returningResponse:NULL error:NULL]; NSString *string = [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding] autorelease]; success = [string isEqualToString:text]; GHAssertTrue(success,@"Failed to GET the correct data from S3"); @@ -414,6 +414,8 @@ - (void)testListRequest [listRequest setAccessKey:accessKey]; [listRequest setDelimiter:@"/"]; [listRequest startSynchronous]; + [self logRequest:listRequest]; + GHTestLog(@"%@", listRequest.objects); GHAssertNil([listRequest error],@"Failed to download a list from S3"); success = NO; for (NSString *prefix in [listRequest commonPrefixes]) { @@ -430,6 +432,7 @@ - (void)testListRequest [listRequest setAccessKey:accessKey]; [listRequest setMaxResultCount:1]; [listRequest startSynchronous]; + [self logRequest:listRequest]; GHAssertTrue([listRequest isTruncated],@"Failed to identify what should be a truncated list of results"); // Test urls are built correctly when requesting a subresource @@ -452,6 +455,7 @@ - (void)testListRequest [listRequest setSecretAccessKey:secretAccessKey]; [listRequest setAccessKey:accessKey]; [listRequest startSynchronous]; + [self logRequest:listRequest]; GHAssertNil([listRequest error],@"Failed to download a list from S3"); success = ([[listRequest objects] count] == 5); GHAssertTrue(success,@"List did not contain all files"); @@ -522,6 +526,7 @@ - (void)testListRequest - (void)GETRequestDone:(ASIS3Request *)request { + [self logRequest:request]; NSString *expectedContent = [NSString stringWithFormat:@"This is the content of file #%@",[[[request url] absoluteString] lastPathComponent]]; BOOL success = ([[request responseString] isEqualToString:expectedContent]); GHAssertTrue(success,@"Got the wrong content when downloading one of the files"); @@ -530,24 +535,29 @@ - (void)GETRequestDone:(ASIS3Request *)request - (void)GETRequestFailed:(ASIS3Request *)request { + [self logRequest:request]; GHAssertTrue(NO,@"GET request failed for one of the items in the list"); } - (void)PUTRequestDone:(ASIS3Request *)request { + [self logRequest:request]; } - (void)PUTRequestFailed:(ASIS3Request *)request { + [self logRequest:request]; GHAssertTrue(NO,@"PUT request failed for one of the items in the list"); } - (void)DELETERequestDone:(ASIS3Request *)request { + [self logRequest:request]; } - (void)DELETERequestFailed:(ASIS3Request *)request { + [self logRequest:request]; GHAssertTrue(NO,@"DELETE request failed for one of the items in the list"); } @@ -555,6 +565,7 @@ - (void)DELETERequestFailed:(ASIS3Request *)request - (void)s3RequestFailed:(ASIHTTPRequest *)request { + [self logRequest:request]; GHFail(@"Request failed - cannot continue with test"); [[self networkQueue] cancelAllOperations]; } diff --git a/iPhone.xcodeproj/project.pbxproj b/iPhone.xcodeproj/project.pbxproj index 1aa3d4b8..d0ec0faa 100644 --- a/iPhone.xcodeproj/project.pbxproj +++ b/iPhone.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 3F4C79AB19206F9400AAF021 /* ASISCSRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4C79AA19206F9400AAF021 /* ASISCSRequestTests.m */; }; 3FAFBA88191B2C2100609F5B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */; }; 3FBBD316191B6DA8004729A0 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */; }; B50C182C121C26FA0055FCAB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50C182B121C26FA0055FCAB /* Security.framework */; }; @@ -131,6 +132,8 @@ /* Begin PBXFileReference section */ 1D6058910D05DD3D006BFB54 /* ASIHTTPRequest iPhone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ASIHTTPRequest iPhone.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 3F4C79A919206F9400AAF021 /* ASISCSRequestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASISCSRequestTests.h; sourceTree = ""; }; + 3F4C79AA19206F9400AAF021 /* ASISCSRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASISCSRequestTests.m; sourceTree = ""; }; 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "iPhone Sample/Resources/Default-568h@2x.png"; sourceTree = ""; }; B50C1821121C26DB0055FCAB /* ClientCertificateTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClientCertificateTests.h; sourceTree = ""; }; B50C1822121C26DB0055FCAB /* ClientCertificateTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClientCertificateTests.m; sourceTree = ""; }; @@ -426,6 +429,41 @@ name = Frameworks; sourceTree = ""; }; + 3F4C79A619206F0100AAF021 /* SCS */ = { + isa = PBXGroup; + children = ( + 3F4C79A919206F9400AAF021 /* ASISCSRequestTests.h */, + 3F4C79AA19206F9400AAF021 /* ASISCSRequestTests.m */, + ); + name = SCS; + sourceTree = ""; + }; + 3F4C79A719206F0800AAF021 /* Objects */ = { + isa = PBXGroup; + children = ( + B5403FFF115114BA00D8BE63 /* ASIS3Bucket.h */, + B5404000115114BA00D8BE63 /* ASIS3Bucket.m */, + B5873FC110FF28CA001E145F /* ASIS3BucketObject.h */, + B5873FC210FF28CA001E145F /* ASIS3BucketObject.m */, + ); + name = Objects; + sourceTree = ""; + }; + 3F4C79A819206F0F00AAF021 /* Requests */ = { + isa = PBXGroup; + children = ( + B5404001115114BA00D8BE63 /* ASIS3BucketRequest.h */, + B5404002115114BA00D8BE63 /* ASIS3BucketRequest.m */, + B5404003115114BA00D8BE63 /* ASIS3ObjectRequest.h */, + B5404004115114BA00D8BE63 /* ASIS3ObjectRequest.m */, + B5404005115114BA00D8BE63 /* ASIS3ServiceRequest.h */, + B5404006115114BA00D8BE63 /* ASIS3ServiceRequest.m */, + B5873FC510FF28CA001E145F /* ASIS3Request.h */, + B5873FC610FF28CA001E145F /* ASIS3Request.m */, + ); + name = Requests; + sourceTree = ""; + }; B52329A911CA3380006C6E5A /* UI helpers */ = { isa = PBXGroup; children = ( @@ -457,6 +495,7 @@ B55B60510F765A3C0064029C /* Tests */ = { isa = PBXGroup; children = ( + 3F4C79A619206F0100AAF021 /* SCS */, B565291E101C8BD7000499CF /* ASITestCase.h */, B565291F101C8BD7000499CF /* ASITestCase.m */, B55B60520F765A3C0064029C /* ASIFormDataRequestTests.h */, @@ -497,18 +536,8 @@ B5873FC010FF28CA001E145F /* S3 */ = { isa = PBXGroup; children = ( - B5403FFF115114BA00D8BE63 /* ASIS3Bucket.h */, - B5404000115114BA00D8BE63 /* ASIS3Bucket.m */, - B5404001115114BA00D8BE63 /* ASIS3BucketRequest.h */, - B5404002115114BA00D8BE63 /* ASIS3BucketRequest.m */, - B5404003115114BA00D8BE63 /* ASIS3ObjectRequest.h */, - B5404004115114BA00D8BE63 /* ASIS3ObjectRequest.m */, - B5404005115114BA00D8BE63 /* ASIS3ServiceRequest.h */, - B5404006115114BA00D8BE63 /* ASIS3ServiceRequest.m */, - B5873FC110FF28CA001E145F /* ASIS3BucketObject.h */, - B5873FC210FF28CA001E145F /* ASIS3BucketObject.m */, - B5873FC510FF28CA001E145F /* ASIS3Request.h */, - B5873FC610FF28CA001E145F /* ASIS3Request.m */, + 3F4C79A719206F0800AAF021 /* Objects */, + 3F4C79A819206F0F00AAF021 /* Requests */, ); path = S3; sourceTree = ""; @@ -765,6 +794,7 @@ B53E6D961257B45800C1E79A /* ASIDataCompressor.m in Sources */, B57D0F4A12AA7D3600E5F992 /* ASIWebPageRequest.m in Sources */, B5BF64EF12FDFC7100CBC324 /* GHUnitIOSTestMain.m in Sources */, + 3F4C79AB19206F9400AAF021 /* ASISCSRequestTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; From ed1c9a638874946e4dc97757ac26b16a21209b50 Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Mon, 12 May 2014 16:35:16 +0800 Subject: [PATCH 09/37] add target: "ASIKit" --- ASIKit/ASIKit-Info.plist | 28 +++ ASIKit/ASIKit-Prefix.pch | 9 + ASIKit/ASIKit.h | 33 +++ ASIKit/en.lproj/InfoPlist.strings | 2 + Classes/ASIHTTPRequest.m | 2 +- Mac.xcodeproj/project.pbxproj | 343 ++++++++++++++++++++++++++---- 6 files changed, 374 insertions(+), 43 deletions(-) create mode 100644 ASIKit/ASIKit-Info.plist create mode 100644 ASIKit/ASIKit-Prefix.pch create mode 100644 ASIKit/ASIKit.h create mode 100644 ASIKit/en.lproj/InfoPlist.strings diff --git a/ASIKit/ASIKit-Info.plist b/ASIKit/ASIKit-Info.plist new file mode 100644 index 00000000..81872ec6 --- /dev/null +++ b/ASIKit/ASIKit-Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.sina.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSPrincipalClass + + + diff --git a/ASIKit/ASIKit-Prefix.pch b/ASIKit/ASIKit-Prefix.pch new file mode 100644 index 00000000..35d76409 --- /dev/null +++ b/ASIKit/ASIKit-Prefix.pch @@ -0,0 +1,9 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/ASIKit/ASIKit.h b/ASIKit/ASIKit.h new file mode 100644 index 00000000..aeb1c620 --- /dev/null +++ b/ASIKit/ASIKit.h @@ -0,0 +1,33 @@ +// +// ASIKit.h +// ASIKit +// +// Created by Bruce on 14-5-12. +// +// +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import \ No newline at end of file diff --git a/ASIKit/en.lproj/InfoPlist.strings b/ASIKit/en.lproj/InfoPlist.strings new file mode 100644 index 00000000..477b28ff --- /dev/null +++ b/ASIKit/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m index c89031bd..d99c54cb 100644 --- a/Classes/ASIHTTPRequest.m +++ b/Classes/ASIHTTPRequest.m @@ -24,7 +24,7 @@ #import "ASIDataCompressor.h" // Automatically set on build -NSString *ASIHTTPRequestVersion = @"v1.8.2-13 2014-05-12"; +NSString *ASIHTTPRequestVersion = @"v1.8.2-14 2014-05-12"; static NSString *defaultUserAgent = nil; diff --git a/Mac.xcodeproj/project.pbxproj b/Mac.xcodeproj/project.pbxproj index c1087b1e..612457b5 100644 --- a/Mac.xcodeproj/project.pbxproj +++ b/Mac.xcodeproj/project.pbxproj @@ -8,27 +8,74 @@ /* Begin PBXBuildFile section */ 3F4BF1DC191CB5A60047A6E7 /* ASISCSRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4BF1DB191CB5A60047A6E7 /* ASISCSRequestTests.m */; }; + 3FC0705119209C78004C6C27 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F4C79DD1920806C00AAF021 /* Cocoa.framework */; }; + 3FC0705719209C78004C6C27 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3FC0705519209C78004C6C27 /* InfoPlist.strings */; }; + 3FC0707519209D3F004C6C27 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522D71E103074AC009A2D22 /* ASIInputStream.m */; }; + 3FC0707619209D3F004C6C27 /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D120F76568E0064029C /* ASIFormDataRequest.m */; }; + 3FC0707719209D3F004C6C27 /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D140F76568E0064029C /* ASIHTTPRequest.m */; }; + 3FC0707819209D3F004C6C27 /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D160F76568E0064029C /* ASINetworkQueue.m */; }; + 3FC0707919209D3F004C6C27 /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B552535A11D23EBB00F9B170 /* ASIDownloadCache.m */; }; + 3FC0707A19209D3F004C6C27 /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E626F1255ED8700C1E79A /* ASIDataCompressor.m */; }; + 3FC0707B19209D3F004C6C27 /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E628D1255EE4B00C1E79A /* ASIDataDecompressor.m */; }; + 3FC0707C19209D3F004C6C27 /* ASIWebPageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B54B23F912AA7D9100A7F940 /* ASIWebPageRequest.m */; }; + 3FC0707D19209D3F004C6C27 /* ASICloudFilesCDNRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9110FF2890001E145F /* ASICloudFilesCDNRequest.m */; }; + 3FC0707E19209D3F004C6C27 /* ASICloudFilesContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9310FF2890001E145F /* ASICloudFilesContainer.m */; }; + 3FC0707F19209D3F004C6C27 /* ASICloudFilesContainerRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9510FF2890001E145F /* ASICloudFilesContainerRequest.m */; }; + 3FC0708019209D3F004C6C27 /* ASICloudFilesContainerXMLParserDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9710FF2890001E145F /* ASICloudFilesContainerXMLParserDelegate.m */; }; + 3FC0708119209D3F004C6C27 /* ASICloudFilesObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9910FF2890001E145F /* ASICloudFilesObject.m */; }; + 3FC0708219209D3F004C6C27 /* ASICloudFilesObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9B10FF2890001E145F /* ASICloudFilesObjectRequest.m */; }; + 3FC0708319209D3F004C6C27 /* ASICloudFilesRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9D10FF2890001E145F /* ASICloudFilesRequest.m */; }; + 3FC0708419209D3F004C6C27 /* ASIS3Bucket.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FE71151149E00D8BE63 /* ASIS3Bucket.m */; }; + 3FC0708519209D3F004C6C27 /* ASIS3BucketObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F8710FF2884001E145F /* ASIS3BucketObject.m */; }; + 3FC0708619209D3F004C6C27 /* ASIS3BucketRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FE91151149E00D8BE63 /* ASIS3BucketRequest.m */; }; + 3FC0708719209D3F004C6C27 /* ASIS3ObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FEB1151149E00D8BE63 /* ASIS3ObjectRequest.m */; }; + 3FC0708819209D3F004C6C27 /* ASIS3ServiceRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FED1151149E00D8BE63 /* ASIS3ServiceRequest.m */; }; + 3FC0708919209D3F004C6C27 /* ASIS3Request.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F8B10FF2884001E145F /* ASIS3Request.m */; }; + 3FC0708A19209D7F004C6C27 /* ASIHTTPRequestConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = B551DD3310D6AB6B00EC1CBF /* ASIHTTPRequestConfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0708B19209D7F004C6C27 /* ASIProgressDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B5747B3A11746CF500C9414E /* ASIProgressDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0708C19209D7F004C6C27 /* ASIHTTPRequestDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B5747EA91174B1C100C9414E /* ASIHTTPRequestDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0708D19209D7F004C6C27 /* ASIInputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = B522D71D103074AC009A2D22 /* ASIInputStream.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0708E19209D7F004C6C27 /* ASIFormDataRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B55B5D110F76568E0064029C /* ASIFormDataRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0708F19209D7F004C6C27 /* ASIHTTPRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B55B5D130F76568E0064029C /* ASIHTTPRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709019209D7F004C6C27 /* ASINetworkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = B55B5D150F76568E0064029C /* ASINetworkQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709119209D7F004C6C27 /* ASICacheDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B552535C11D23EBB00F9B170 /* ASICacheDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709219209D7F004C6C27 /* ASIDownloadCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B552535B11D23EBB00F9B170 /* ASIDownloadCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709319209D7F004C6C27 /* ASIDataCompressor.h in Headers */ = {isa = PBXBuildFile; fileRef = B53E62701255ED8700C1E79A /* ASIDataCompressor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709419209D7F004C6C27 /* ASIDataDecompressor.h in Headers */ = {isa = PBXBuildFile; fileRef = B53E628E1255EE4B00C1E79A /* ASIDataDecompressor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709519209D7F004C6C27 /* ASIWebPageRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B54B23F812AA7D9100A7F940 /* ASIWebPageRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709619209D7F004C6C27 /* ASINSXMLParserCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = B5BD2BE611CA5EBC00D7C426 /* ASINSXMLParserCompat.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709719209D7F004C6C27 /* ASICloudFilesCDNRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873F9010FF2890001E145F /* ASICloudFilesCDNRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709819209D7F004C6C27 /* ASICloudFilesContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873F9210FF2890001E145F /* ASICloudFilesContainer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709919209D7F004C6C27 /* ASICloudFilesContainerRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873F9410FF2890001E145F /* ASICloudFilesContainerRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709A19209D7F004C6C27 /* ASICloudFilesContainerXMLParserDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873F9610FF2890001E145F /* ASICloudFilesContainerXMLParserDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709B19209D7F004C6C27 /* ASICloudFilesObject.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873F9810FF2890001E145F /* ASICloudFilesObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709C19209D7F004C6C27 /* ASICloudFilesObjectRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873F9A10FF2890001E145F /* ASICloudFilesObjectRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709D19209D7F004C6C27 /* ASICloudFilesRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873F9C10FF2890001E145F /* ASICloudFilesRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709E19209D7F004C6C27 /* ASIS3Bucket.h in Headers */ = {isa = PBXBuildFile; fileRef = B5403FE61151149E00D8BE63 /* ASIS3Bucket.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC0709F19209D7F004C6C27 /* ASIS3BucketObject.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873F8610FF2884001E145F /* ASIS3BucketObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC070A019209D7F004C6C27 /* ASIS3BucketRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5403FE81151149E00D8BE63 /* ASIS3BucketRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC070A119209D7F004C6C27 /* ASIS3ObjectRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5403FEA1151149E00D8BE63 /* ASIS3ObjectRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC070A219209D7F004C6C27 /* ASIS3ServiceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5403FEC1151149E00D8BE63 /* ASIS3ServiceRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC070A319209D7F004C6C27 /* ASIS3Request.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873F8A10FF2884001E145F /* ASIS3Request.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC070A419209D7F004C6C27 /* ASIKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FC0705919209C78004C6C27 /* ASIKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3FC070A519209DD7004C6C27 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B53FADE70FF38B2A002E2DE6 /* SystemConfiguration.framework */; }; + 3FC070A619209DDC004C6C27 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50C17DA121C254D0055FCAB /* Security.framework */; }; + 3FC070A719209DF2004C6C27 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B53E62551255EC4600C1E79A /* libxml2.dylib */; }; + 3FC070A819209DFA004C6C27 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B551D5C613ED432B00607B74 /* libz.dylib */; }; + 3FC070A919209E88004C6C27 /* ASIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FC0705019209C78004C6C27 /* ASIKit.framework */; }; + 3FC070AA19209E8E004C6C27 /* ASIKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3FC0705019209C78004C6C27 /* ASIKit.framework */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; B50C17DB121C254D0055FCAB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50C17DA121C254D0055FCAB /* Security.framework */; }; - B522D71F103074AC009A2D22 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522D71E103074AC009A2D22 /* ASIInputStream.m */; }; B522D720103074AC009A2D22 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522D71E103074AC009A2D22 /* ASIInputStream.m */; }; B522DE601031BB03009A2D22 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B53FADE70FF38B2A002E2DE6 /* SystemConfiguration.framework */; }; B522DE821031BD5E009A2D22 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B53FADE70FF38B2A002E2DE6 /* SystemConfiguration.framework */; }; B53E62561255EC4600C1E79A /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B53E62551255EC4600C1E79A /* libxml2.dylib */; }; - B53E62711255ED8700C1E79A /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E626F1255ED8700C1E79A /* ASIDataCompressor.m */; }; B53E62721255ED8700C1E79A /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E626F1255ED8700C1E79A /* ASIDataCompressor.m */; }; - B53E628F1255EE4B00C1E79A /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E628D1255EE4B00C1E79A /* ASIDataDecompressor.m */; }; B53E62901255EE4B00C1E79A /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E628D1255EE4B00C1E79A /* ASIDataDecompressor.m */; }; B53E62B11255EEB800C1E79A /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B53E62B01255EEB800C1E79A /* WebKit.framework */; }; B53E62DC1255F6FC00C1E79A /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B53E62551255EC4600C1E79A /* libxml2.dylib */; }; - B5403FEE1151149E00D8BE63 /* ASIS3Bucket.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FE71151149E00D8BE63 /* ASIS3Bucket.m */; }; - B5403FEF1151149E00D8BE63 /* ASIS3BucketRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FE91151149E00D8BE63 /* ASIS3BucketRequest.m */; }; - B5403FF01151149E00D8BE63 /* ASIS3ObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FEB1151149E00D8BE63 /* ASIS3ObjectRequest.m */; }; - B5403FF11151149E00D8BE63 /* ASIS3ServiceRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5403FED1151149E00D8BE63 /* ASIS3ServiceRequest.m */; }; - B54B23FA12AA7D9100A7F940 /* ASIWebPageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B54B23F912AA7D9100A7F940 /* ASIWebPageRequest.m */; }; B54B23FB12AA7D9100A7F940 /* ASIWebPageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B54B23F912AA7D9100A7F940 /* ASIWebPageRequest.m */; }; B551D5C713ED432B00607B74 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B551D5C613ED432B00607B74 /* libz.dylib */; }; - B552535D11D23EBB00F9B170 /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B552535A11D23EBB00F9B170 /* ASIDownloadCache.m */; }; B552536111D23ECD00F9B170 /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B552535A11D23EBB00F9B170 /* ASIDownloadCache.m */; }; B55B5D200F76568E0064029C /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D120F76568E0064029C /* ASIFormDataRequest.m */; }; B55B5D210F76568E0064029C /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D140F76568E0064029C /* ASIHTTPRequest.m */; }; @@ -36,20 +83,8 @@ B55B5E700F7656A40064029C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5E6E0F7656A40064029C /* main.m */; }; B55B5E7F0F76573B0064029C /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = B55B5E730F7656DA0064029C /* MainMenu.xib */; }; B55B5ED20F76588D0064029C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5ED10F76588D0064029C /* AppDelegate.m */; }; - B55B600C0F7659880064029C /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D160F76568E0064029C /* ASINetworkQueue.m */; }; - B55B600F0F7659900064029C /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D140F76568E0064029C /* ASIHTTPRequest.m */; }; - B55B60100F7659960064029C /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B5D120F76568E0064029C /* ASIFormDataRequest.m */; }; B565297E101C8D01000499CF /* ASITestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = B565297C101C8D01000499CF /* ASITestCase.m */; }; B56DF2BA13ED5C4100549DCD /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B551D5C613ED432B00607B74 /* libz.dylib */; }; - B5873F8C10FF2884001E145F /* ASIS3BucketObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F8710FF2884001E145F /* ASIS3BucketObject.m */; }; - B5873F8E10FF2884001E145F /* ASIS3Request.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F8B10FF2884001E145F /* ASIS3Request.m */; }; - B5873F9E10FF2890001E145F /* ASICloudFilesCDNRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9110FF2890001E145F /* ASICloudFilesCDNRequest.m */; }; - B5873F9F10FF2890001E145F /* ASICloudFilesContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9310FF2890001E145F /* ASICloudFilesContainer.m */; }; - B5873FA010FF2890001E145F /* ASICloudFilesContainerRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9510FF2890001E145F /* ASICloudFilesContainerRequest.m */; }; - B5873FA110FF2890001E145F /* ASICloudFilesContainerXMLParserDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9710FF2890001E145F /* ASICloudFilesContainerXMLParserDelegate.m */; }; - B5873FA210FF2890001E145F /* ASICloudFilesObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9910FF2890001E145F /* ASICloudFilesObject.m */; }; - B5873FA310FF2890001E145F /* ASICloudFilesObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9B10FF2890001E145F /* ASICloudFilesObjectRequest.m */; }; - B5873FA410FF2890001E145F /* ASICloudFilesRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873F9D10FF2890001E145F /* ASICloudFilesRequest.m */; }; B5B513860FBEE515002C74D0 /* GHUnitTestMain.m in Sources */ = {isa = PBXBuildFile; fileRef = B5B513850FBEE515002C74D0 /* GHUnitTestMain.m */; }; B5BF64E612FDE9CA00CBC324 /* GHUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5BF64E512FDE9C900CBC324 /* GHUnit.framework */; }; B5ED5A9412FEBAEC00A12511 /* GHUnit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = B5BF64E512FDE9C900CBC324 /* GHUnit.framework */; }; @@ -62,6 +97,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( + 3FC070AA19209E8E004C6C27 /* ASIKit.framework in CopyFiles */, B5ED5A9412FEBAEC00A12511 /* GHUnit.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; @@ -75,6 +111,12 @@ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 3F4BF1DA191CB5A60047A6E7 /* ASISCSRequestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASISCSRequestTests.h; sourceTree = ""; }; 3F4BF1DB191CB5A60047A6E7 /* ASISCSRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASISCSRequestTests.m; sourceTree = ""; }; + 3F4C79DD1920806C00AAF021 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 3FC0705019209C78004C6C27 /* ASIKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ASIKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3FC0705419209C78004C6C27 /* ASIKit-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ASIKit-Info.plist"; sourceTree = ""; }; + 3FC0705619209C78004C6C27 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 3FC0705819209C78004C6C27 /* ASIKit-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ASIKit-Prefix.pch"; sourceTree = ""; }; + 3FC0705919209C78004C6C27 /* ASIKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ASIKit.h; sourceTree = ""; }; 8D1107320486CEB800E47090 /* Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mac.app; sourceTree = BUILT_PRODUCTS_DIR; }; B50244191025D36B002B13E1 /* ProxyTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyTests.h; sourceTree = ""; }; B502441A1025D36B002B13E1 /* ProxyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProxyTests.m; sourceTree = ""; }; @@ -170,6 +212,18 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 3FC0704C19209C78004C6C27 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3FC070A819209DFA004C6C27 /* libz.dylib in Frameworks */, + 3FC070A719209DF2004C6C27 /* libxml2.dylib in Frameworks */, + 3FC070A619209DDC004C6C27 /* Security.framework in Frameworks */, + 3FC070A519209DD7004C6C27 /* SystemConfiguration.framework in Frameworks */, + 3FC0705119209C78004C6C27 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 8D11072E0486CEB800E47090 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -186,6 +240,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3FC070A919209E88004C6C27 /* ASIKit.framework in Frameworks */, B551D5C713ED432B00607B74 /* libz.dylib in Frameworks */, B522DE601031BB03009A2D22 /* SystemConfiguration.framework in Frameworks */, B50C17DB121C254D0055FCAB /* Security.framework in Frameworks */, @@ -229,6 +284,7 @@ children = ( 8D1107320486CEB800E47090 /* Mac.app */, B55B5EDF0F7658C70064029C /* Unit Tests (GHUnit).app */, + 3FC0705019209C78004C6C27 /* ASIKit.framework */, ); name = Products; sourceTree = ""; @@ -239,6 +295,7 @@ B55B5D100F76568E0064029C /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, + 3FC0705219209C78004C6C27 /* ASIKit */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); @@ -272,6 +329,7 @@ isa = PBXGroup; children = ( 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 3F4C79DD1920806C00AAF021 /* Cocoa.framework */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, ); name = Frameworks; @@ -312,6 +370,25 @@ name = SCS; sourceTree = ""; }; + 3FC0705219209C78004C6C27 /* ASIKit */ = { + isa = PBXGroup; + children = ( + 3FC0705919209C78004C6C27 /* ASIKit.h */, + 3FC0705319209C78004C6C27 /* Supporting Files */, + ); + path = ASIKit; + sourceTree = ""; + }; + 3FC0705319209C78004C6C27 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 3FC0705419209C78004C6C27 /* ASIKit-Info.plist */, + 3FC0705519209C78004C6C27 /* InfoPlist.strings */, + 3FC0705819209C78004C6C27 /* ASIKit-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; B51E61A2100BA84C004A300D /* S3 */ = { isa = PBXGroup; children = ( @@ -416,7 +493,62 @@ }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + 3FC0704D19209C78004C6C27 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3FC0708A19209D7F004C6C27 /* ASIHTTPRequestConfig.h in Headers */, + 3FC0708B19209D7F004C6C27 /* ASIProgressDelegate.h in Headers */, + 3FC0708C19209D7F004C6C27 /* ASIHTTPRequestDelegate.h in Headers */, + 3FC0708D19209D7F004C6C27 /* ASIInputStream.h in Headers */, + 3FC0708E19209D7F004C6C27 /* ASIFormDataRequest.h in Headers */, + 3FC0708F19209D7F004C6C27 /* ASIHTTPRequest.h in Headers */, + 3FC0709019209D7F004C6C27 /* ASINetworkQueue.h in Headers */, + 3FC0709119209D7F004C6C27 /* ASICacheDelegate.h in Headers */, + 3FC0709219209D7F004C6C27 /* ASIDownloadCache.h in Headers */, + 3FC0709319209D7F004C6C27 /* ASIDataCompressor.h in Headers */, + 3FC0709419209D7F004C6C27 /* ASIDataDecompressor.h in Headers */, + 3FC0709519209D7F004C6C27 /* ASIWebPageRequest.h in Headers */, + 3FC0709619209D7F004C6C27 /* ASINSXMLParserCompat.h in Headers */, + 3FC0709719209D7F004C6C27 /* ASICloudFilesCDNRequest.h in Headers */, + 3FC0709819209D7F004C6C27 /* ASICloudFilesContainer.h in Headers */, + 3FC0709919209D7F004C6C27 /* ASICloudFilesContainerRequest.h in Headers */, + 3FC0709A19209D7F004C6C27 /* ASICloudFilesContainerXMLParserDelegate.h in Headers */, + 3FC0709B19209D7F004C6C27 /* ASICloudFilesObject.h in Headers */, + 3FC0709C19209D7F004C6C27 /* ASICloudFilesObjectRequest.h in Headers */, + 3FC0709D19209D7F004C6C27 /* ASICloudFilesRequest.h in Headers */, + 3FC0709E19209D7F004C6C27 /* ASIS3Bucket.h in Headers */, + 3FC0709F19209D7F004C6C27 /* ASIS3BucketObject.h in Headers */, + 3FC070A019209D7F004C6C27 /* ASIS3BucketRequest.h in Headers */, + 3FC070A119209D7F004C6C27 /* ASIS3ObjectRequest.h in Headers */, + 3FC070A219209D7F004C6C27 /* ASIS3ServiceRequest.h in Headers */, + 3FC070A319209D7F004C6C27 /* ASIS3Request.h in Headers */, + 3FC070A419209D7F004C6C27 /* ASIKit.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ + 3FC0704F19209C78004C6C27 /* ASIKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3FC0706F19209C78004C6C27 /* Build configuration list for PBXNativeTarget "ASIKit" */; + buildPhases = ( + 3FC0704B19209C78004C6C27 /* Sources */, + 3FC0704C19209C78004C6C27 /* Frameworks */, + 3FC0704D19209C78004C6C27 /* Headers */, + 3FC0704E19209C78004C6C27 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ASIKit; + productName = ASIKit; + productReference = 3FC0705019209C78004C6C27 /* ASIKit.framework */; + productType = "com.apple.product-type.framework"; + }; 8D1107260486CEB800E47090 /* Mac */ = { isa = PBXNativeTarget; buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Mac" */; @@ -472,6 +604,7 @@ Japanese, French, German, + en, ); mainGroup = 29B97314FDCFA39411CA2CEA /* Mac */; projectDirPath = ""; @@ -479,11 +612,20 @@ targets = ( 8D1107260486CEB800E47090 /* Mac */, B55B5EDE0F7658C70064029C /* Unit Tests (GHUnit) */, + 3FC0704F19209C78004C6C27 /* ASIKit */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 3FC0704E19209C78004C6C27 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3FC0705719209C78004C6C27 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 8D1107290486CEB800E47090 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -532,6 +674,34 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 3FC0704B19209C78004C6C27 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3FC0708219209D3F004C6C27 /* ASICloudFilesObjectRequest.m in Sources */, + 3FC0708319209D3F004C6C27 /* ASICloudFilesRequest.m in Sources */, + 3FC0708619209D3F004C6C27 /* ASIS3BucketRequest.m in Sources */, + 3FC0707519209D3F004C6C27 /* ASIInputStream.m in Sources */, + 3FC0707F19209D3F004C6C27 /* ASICloudFilesContainerRequest.m in Sources */, + 3FC0707719209D3F004C6C27 /* ASIHTTPRequest.m in Sources */, + 3FC0708719209D3F004C6C27 /* ASIS3ObjectRequest.m in Sources */, + 3FC0707A19209D3F004C6C27 /* ASIDataCompressor.m in Sources */, + 3FC0707D19209D3F004C6C27 /* ASICloudFilesCDNRequest.m in Sources */, + 3FC0707919209D3F004C6C27 /* ASIDownloadCache.m in Sources */, + 3FC0707C19209D3F004C6C27 /* ASIWebPageRequest.m in Sources */, + 3FC0708419209D3F004C6C27 /* ASIS3Bucket.m in Sources */, + 3FC0707619209D3F004C6C27 /* ASIFormDataRequest.m in Sources */, + 3FC0707B19209D3F004C6C27 /* ASIDataDecompressor.m in Sources */, + 3FC0707E19209D3F004C6C27 /* ASICloudFilesContainer.m in Sources */, + 3FC0707819209D3F004C6C27 /* ASINetworkQueue.m in Sources */, + 3FC0708119209D3F004C6C27 /* ASICloudFilesObject.m in Sources */, + 3FC0708819209D3F004C6C27 /* ASIS3ServiceRequest.m in Sources */, + 3FC0708919209D3F004C6C27 /* ASIS3Request.m in Sources */, + 3FC0708519209D3F004C6C27 /* ASIS3BucketObject.m in Sources */, + 3FC0708019209D3F004C6C27 /* ASICloudFilesContainerXMLParserDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 8D11072C0486CEB800E47090 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -553,36 +723,23 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - B55B600C0F7659880064029C /* ASINetworkQueue.m in Sources */, - B55B600F0F7659900064029C /* ASIHTTPRequest.m in Sources */, - B55B60100F7659960064029C /* ASIFormDataRequest.m in Sources */, B5B513860FBEE515002C74D0 /* GHUnitTestMain.m in Sources */, B565297E101C8D01000499CF /* ASITestCase.m in Sources */, - B522D71F103074AC009A2D22 /* ASIInputStream.m in Sources */, - B5873F8C10FF2884001E145F /* ASIS3BucketObject.m in Sources */, - B5873F8E10FF2884001E145F /* ASIS3Request.m in Sources */, - B5873F9E10FF2890001E145F /* ASICloudFilesCDNRequest.m in Sources */, - B5873F9F10FF2890001E145F /* ASICloudFilesContainer.m in Sources */, - B5873FA010FF2890001E145F /* ASICloudFilesContainerRequest.m in Sources */, - B5873FA110FF2890001E145F /* ASICloudFilesContainerXMLParserDelegate.m in Sources */, - B5873FA210FF2890001E145F /* ASICloudFilesObject.m in Sources */, - B5873FA310FF2890001E145F /* ASICloudFilesObjectRequest.m in Sources */, - B5873FA410FF2890001E145F /* ASICloudFilesRequest.m in Sources */, - B5403FEE1151149E00D8BE63 /* ASIS3Bucket.m in Sources */, - B5403FEF1151149E00D8BE63 /* ASIS3BucketRequest.m in Sources */, 3F4BF1DC191CB5A60047A6E7 /* ASISCSRequestTests.m in Sources */, - B5403FF01151149E00D8BE63 /* ASIS3ObjectRequest.m in Sources */, - B5403FF11151149E00D8BE63 /* ASIS3ServiceRequest.m in Sources */, - B552535D11D23EBB00F9B170 /* ASIDownloadCache.m in Sources */, - B53E62711255ED8700C1E79A /* ASIDataCompressor.m in Sources */, - B53E628F1255EE4B00C1E79A /* ASIDataDecompressor.m in Sources */, - B54B23FA12AA7D9100A7F940 /* ASIWebPageRequest.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ + 3FC0705519209C78004C6C27 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 3FC0705619209C78004C6C27 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; B55B5E730F7656DA0064029C /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( @@ -602,6 +759,100 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 3FC0707019209C78004C6C27 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ASIKit/ASIKit-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "${SDK_DIR}/usr/include/libxml2", + ); + INFOPLIST_FILE = "ASIKit/ASIKit-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + 3FC0707119209C78004C6C27 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + ENABLE_NS_ASSERTIONS = NO; + FRAMEWORK_VERSION = A; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ASIKit/ASIKit-Prefix.pch"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "${SDK_DIR}/usr/include/libxml2", + ); + INFOPLIST_FILE = "ASIKit/ASIKit-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; B55B5EE20F7658C80064029C /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = B515507810BD56E800608267 /* strict.xcconfig */; @@ -740,6 +991,14 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 3FC0706F19209C78004C6C27 /* Build configuration list for PBXNativeTarget "ASIKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3FC0707019209C78004C6C27 /* Debug */, + 3FC0707119209C78004C6C27 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; B55B5EE40F7658C80064029C /* Build configuration list for PBXNativeTarget "Unit Tests (GHUnit)" */ = { isa = XCConfigurationList; buildConfigurations = ( From 8a9a41542c8bd268f7dc24a8ad58a88617c7bc2b Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Fri, 23 May 2014 15:02:23 +0800 Subject: [PATCH 10/37] framework ASIKit-iOS --- .gitignore | 3 +- ASIKit-iOS/ASIKit-iOS-Info.plist | 44 +++ ASIKit-iOS/ASIKit-iOS-Prefix.pch | 9 + ASIKit-iOS/ASIKit-iOS.h | 38 +++ ASIKit-iOS/en.lproj/InfoPlist.strings | 2 + README.md | 258 ++++++++++++++++++ iPhone.xcodeproj/project.pbxproj | 371 ++++++++++++++++++++++++++ 7 files changed, 724 insertions(+), 1 deletion(-) create mode 100644 ASIKit-iOS/ASIKit-iOS-Info.plist create mode 100644 ASIKit-iOS/ASIKit-iOS-Prefix.pch create mode 100644 ASIKit-iOS/ASIKit-iOS.h create mode 100644 ASIKit-iOS/en.lproj/InfoPlist.strings diff --git a/.gitignore b/.gitignore index f36b7ae7..76f8393d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ profile *.pbxuser *.mode1v3 External/GHUnit/* -.svn \ No newline at end of file +.svn +Products \ No newline at end of file diff --git a/ASIKit-iOS/ASIKit-iOS-Info.plist b/ASIKit-iOS/ASIKit-iOS-Info.plist new file mode 100644 index 00000000..68dabaf2 --- /dev/null +++ b/ASIKit-iOS/ASIKit-iOS-Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.sina.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + CFPlugInDynamicRegisterFunction + + CFPlugInDynamicRegistration + NO + CFPlugInFactories + + 00000000-0000-0000-0000-000000000000 + MyFactoryFunction + + CFPlugInTypes + + 00000000-0000-0000-0000-000000000000 + + 00000000-0000-0000-0000-000000000000 + + + CFPlugInUnloadFunction + + + diff --git a/ASIKit-iOS/ASIKit-iOS-Prefix.pch b/ASIKit-iOS/ASIKit-iOS-Prefix.pch new file mode 100644 index 00000000..707192be --- /dev/null +++ b/ASIKit-iOS/ASIKit-iOS-Prefix.pch @@ -0,0 +1,9 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// +// +//#ifdef __OBJC__ +// #import +//#endif diff --git a/ASIKit-iOS/ASIKit-iOS.h b/ASIKit-iOS/ASIKit-iOS.h new file mode 100644 index 00000000..a7b51919 --- /dev/null +++ b/ASIKit-iOS/ASIKit-iOS.h @@ -0,0 +1,38 @@ +// +// ASIKit-iOS.h +// iPhone +// +// Created by Littlebox222 on 14-5-22. +// +// + + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import +#import +#import +#import +#import +#import + +#import +#import +#import +#import +#import +#import +#import \ No newline at end of file diff --git a/ASIKit-iOS/en.lproj/InfoPlist.strings b/ASIKit-iOS/en.lproj/InfoPlist.strings new file mode 100644 index 00000000..477b28ff --- /dev/null +++ b/ASIKit-iOS/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/README.md b/README.md index 7990c55a..adb92a68 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,261 @@ ASI-SCS ======= Branch of ASIHTTPRequest for Sina Cloud Storage Service +本SDK为ASIHTTPRequest的一个分支,熟悉ASI的同学可以轻松上手,不熟悉的也没关系,相信看完文档您一定能够运用自如,并且能够对ASI有一个初步的认识。 + +> * 文档的详细内容请查阅:http://open.sinastorage.com/?c=doc&a=sdk +> * SCS API 的详细内容请查阅:http://open.sinastorage.com/?c=doc&a=api +> * ASIHTTPRequest的详细内容请查阅:http://allseeing-i.com/ASIHTTPRequest/How-to-use + +### SDK环境要求 +####系统版本: +> * iOS: 6.0及以上。 +> * OSX: 10.8及以上。 + +####相关配置: +> * 1、将SDK文件夹拷贝到你的工程目录下; +> * 2、打开xcode,将SCSSDK.xcodeproj拖动到你的工程中; +> * 3、选择你的工程,在右侧选择Build Settings,并设置Other Linker Flags 为 -ObjC -all_load; +> * 4、选择Build Phases,在Link Binary With Libraries中添加如下: +> * _iOS_:libSCSSDK_IOS.a;Foundation.framework ;CoreData.framework ;CoreFoundation.framework ;Security.framework ;CoreGraphics.framework ;UIKit.framework; +> * _OSX_:libSCSSDK_OSX.a;Cocoa.framework ;CoreData.framework ;CoreFoundation.framework ;Security.framework ;AppKit.framework; +> * 5、 + +###快速上手 +> * 以下示例为简单明确的介绍SDK使用方法,均采用同步请求方式。 +关于请求队列以及异步请求的详细介绍,请参考:【使用队列及异步请求】 + +####Bucket操作 +#####列取bucket +```objective-c +ASIS3ServiceRequest *request = [ASIS3ServiceRequest serviceRequest]; +[request setSecretAccessKey:@"YourSecretAccessKey"]; +[request setAccessKey:@"YourAccessKey"]; +[request startSynchronous]; + +if (![request error]) { + NSArray *buckets = [request buckets]; // An array of ASIS3Bucket objects +} +``` + +#####创建bucket +> * 为每个请求设置相应的accessKey和secretAccessKey是很繁琐的,因此我们可以设置基类(ASIS3Request)的sharedAccessKey和sharedSecretAccessKey。这样下次再发送某一请求时,无需再次设置相应的key,SDK会调用我们设置好的这两个sharedKey。 +```objective-c +[ASIS3Request setSharedSecretAccessKey:@"YourSecretAccessKey"]; +[ASIS3Request setSharedAccessKey:@"YourAccessKey"]; + +ASIS3BucketRequest *request = [ASIS3BucketRequest PUTRequestWithBucket:@"my-bucket"]; +[request startSynchronous]; + +if ([request error]) { + NSLog(@"%@",[[request error] localizedDescription]); +} +``` + +#####删除bucket +> * 这里我们无需再次设置相应的accesskey,前面我们已经设置好了两个sharedKey。 + +```objective-c +ASIS3BucketRequest *request = [ASIS3BucketRequest DELETERequestWithBucket:@"my-bucket"]; +[request startSynchronous]; + +if ([request error]) { + NSLog(@"%@",[[request error] localizedDescription]); +} +``` + +####Object操作 +#####列取object +```objective-c +/*示例为列取http://my-bucket.sinastorage.com/images/jpegs中最多50个object*/ + +ASIS3BucketRequest *listRequest = [ASIS3BucketRequest requestWithBucket:@"my-bucket"]; +[listRequest setPrefix:@"images/jpegs"]; +[listRequest setMaxResultCount:50]; // Max number of results +[listRequest startSynchronous]; + +if (![listRequest error]) { + NSLog(@"%@",[listRequest objects]); +} +``` + +#####获取object信息 +```objective-c +/*示例为获取http://my-bucket.sinastorage.com/path/to/the/object的object信息*/ + +NSString *bucket = @"my-bucket"; +NSString *path = @"path/to/the/object"; + +ASIS3ObjectRequest *request = [ASIS3ObjectRequest requestWithBucket:bucket key:path]; +[request startSynchronous]; + +if (![request error]) { + NSData *data = [request responseData]; +} else { + NSLog(@"%@",[[request error] localizedDescription]); +} +``` + +#####上传object +```objective-c +NSString *filePath = @"/somewhere/on/disk.txt"; + +ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath withBucket:@"my-bucket" key:@"path/to/the/object"]; +[request startSynchronous]; + +if ([request error]) { + NSLog(@"%@",[[request error] localizedDescription]); +} +``` + +#####删除object +```objective-c +ASIS3ObjectRequest *request = [ASIS3ObjectRequest DELETERequestWithBucket:@"my-bucket" key:@"path/to/the/object"]; +[request startSynchronous]; + +if ([request error]) { + NSLog(@"%@",[[request error] localizedDescription]); +} +``` + +#####拷贝object +```objective-c +ASIS3ObjectRequest *request = [ASIS3ObjectRequest COPYRequestFromBucket:@"my-bucket" key:@"/path/to/the/object" toBucket:@"my-bucket" key:@"/new/path/to/the/object"]; +[request startSynchronous]; + +if ([request error]) { + NSLog(@"%@",[[request error] localizedDescription]); +} +``` + +#####下载object +```objective-c +ASIS3ObjectRequest *request = [object GETRequest]; +NSString *downloadPath = @"path/to/save/yourFile"; +[request setDownloadDestinationPath:downloadPath]; +[request startSynchronous]; + +if ([request error]) { + NSLog(@"%@",[[request error] localizedDescription]); +} +``` + +####使用HTTPS连接 +```objective-c +ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath withBucket:@"my-bucket" key:@"path/to/the/object"]; +[request requestScheme:ASIS3RequestSchemeHTTPS]; +``` + +####使用GZIP压缩 +```objective-c +ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath withBucket:@"my-bucket" key:@"path/to/the/object"]; +[request setShouldCompressRequestBody:YES]; +``` + +####使用队列及异步请求 +#####创建队列 +```objective-c +//ASINetworkQueue *queue; +[[self queue] cancelAllOperations]; +[self setQueue:[ASINetworkQueue queue]]; +``` + +#####设置队列回调 +> * 其中selector可自定义。 +```objective-c + //请求成功 + [[self queue] setRequestDidFinishSelector:@selector(requestDone:)]; + + //请求失败 + [[self queue] setRequestDidFailSelector:@selector(requestFailed:)]; + + //请求收到响应 + [[self queue] setRequestDidReceiveResponseHeadersSelector:@selector(requestDidReceiveResponseHeaders:)]; + + //请求开始 + [[self queue] setRequestDidStartSelector:@selector(requestDidStart:)]; + + //即将跳转 + [[self queue] setRequestWillRedirectSelector:@selector(requestWillRedirect:)]; + + //队列结束 + [[self queue] setQueueDidFinishSelector:@selector(queueDidFinish:)]; + + /*默认的,若队列中某一请求失败,整个队列会停止,并取消其他请求。若如下设置为NO,则其他请求仍会继续发送*/ + [queue setShouldCancelAllRequestsOnFailure:NO]; +``` + +#####启动队列 +```objective-c + /*队列只需启动一次,此后加入队列的请求会按顺序执行*/ + [[self queue] go]; +``` + +#####添加异步请求 +```objective-c + ASIS3BucketRequest *listRequest = [ASIS3BucketRequest requestWithBucket:@"my-bucket"]; + ... + [[self queue] addOperation:request]; +``` + +#####取消异步请求 +```objective-c + /*取消某一请求后,队列会执行请求失败的回调*/ + /*同时,若shouldCancelAllRequestsOnFailure == YES,队列中的其他请求也将被取消*/ + [request cancel]; + [request clearDelegatesAndCancel]; +``` + +#####example +> * 本示例较为完整的展示了如何使用队列及异步请求获取object列表并下载。 +```objective-c +- (void)download25ImagesToDisk { + + //创建队列 + [[self queue] cancelAllOperations]; + [self setQueue:[ASINetworkQueue queue]]; + + //获取图片列表 + ASIS3BucketRequest *listRequest = [ASIS3BucketRequest requestWithBucket:@"my-bucket"]; + [listRequest setPrefix:@"images/jpegs"]; + [listRequest setMaxResultCount:25]; + [listRequest setDelegate:self]; + [listRequest setDidFinishSelector:@selector(finishedDownloadingImageList:)]; + [listRequest setDidFailSelector:@selector(failedDownloadingImageList:)]; + [[self queue] addOperation:listRequest]; +} + +- (void)failedDownloadingImageList:(ASIHTTPRequest *)listRequest { + + NSLog(@"Failed downloading a list of images because '%@'", [[listRequest error] localizedDescription]); +} + +- (void)finishedDownloadingImageList:(ASIHTTPRequest *)listRequest { + + //获取列表成功后,开始下载 + [[self queue] reset]; + [[self queue] setRequestDidFinishSelector:@selector(requestDone:)]; + [[self queue] setRequestDidFailSelector:@selector(requestFailed:)]; + [[self queue] setDelegate:self]; + + int i=0; + for (ASIS3BucketObject *object in [listRequest objects]) { + ASIS3ObjectRequest *request = [object GETRequest]; + NSString *downloadPath = [NSString stringWithFormat:@"/Users/ben/Desktop/images/%hi.jpg",i]; + [request setDownloadDestinationPath:downloadPath]; + [[self queue] addOperation:request]; + i++; + } + + //启动队列 + [[self queue] go]; +} + +- (void)requestDone:(ASIS3Request *)request { + NSLog(@"Finished downloading an image"); +} + +- (void)requestFailed:(ASIS3Request *)request { + NSLog(@"Download error: %@",[[request error] localizedDescription]); +} +``` \ No newline at end of file diff --git a/iPhone.xcodeproj/project.pbxproj b/iPhone.xcodeproj/project.pbxproj index d0ec0faa..ba9c72bd 100644 --- a/iPhone.xcodeproj/project.pbxproj +++ b/iPhone.xcodeproj/project.pbxproj @@ -6,10 +6,82 @@ objectVersion = 46; objects = { +/* Begin PBXAggregateTarget section */ + AD9C70AB192DFFCA00B6416E /* ASIKit */ = { + isa = PBXAggregateTarget; + buildConfigurationList = AD9C70AC192DFFCA00B6416E /* Build configuration list for PBXAggregateTarget "ASIKit" */; + buildPhases = ( + AD9C70AF192DFFF300B6416E /* ShellScript */, + ); + dependencies = ( + ); + name = ASIKit; + productName = ASIKit; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ 3F4C79AB19206F9400AAF021 /* ASISCSRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4C79AA19206F9400AAF021 /* ASISCSRequestTests.m */; }; 3FAFBA88191B2C2100609F5B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */; }; 3FBBD316191B6DA8004729A0 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */; }; + AD9C7052192DDA5600B6416E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AD9C7050192DDA5600B6416E /* InfoPlist.strings */; }; + AD9C7058192DDB6D00B6416E /* Reachability.h in Headers */ = {isa = PBXBuildFile; fileRef = B55252B211D22E2200F9B170 /* Reachability.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7059192DDB6D00B6416E /* ASIHTTPRequestConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = B551DB4610D6938500EC1CBF /* ASIHTTPRequestConfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C705A192DDB6D00B6416E /* ASIHTTPRequestDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B5747F271174BB8300C9414E /* ASIHTTPRequestDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C705B192DDB6D00B6416E /* ASIAuthenticationDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = B59A87C0103EC6F200300252 /* ASIAuthenticationDialog.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C705C192DDB6D00B6416E /* ASIInputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = B522DACC1030B2AB009A2D22 /* ASIInputStream.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C705D192DDB6D00B6416E /* ASIFormDataRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B55B60450F765A320064029C /* ASIFormDataRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C705E192DDB6D00B6416E /* ASIHTTPRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B55B60470F765A320064029C /* ASIHTTPRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C705F192DDB6D00B6416E /* ASINetworkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = B55B60490F765A320064029C /* ASINetworkQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7060192DDB6D00B6416E /* ASIDownloadCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B5FE752611DBBA6400F898C8 /* ASIDownloadCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7061192DDB6D00B6416E /* ASIDataDecompressor.h in Headers */ = {isa = PBXBuildFile; fileRef = B53E6D921257B45800C1E79A /* ASIDataDecompressor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7062192DDB6D00B6416E /* ASIDataCompressor.h in Headers */ = {isa = PBXBuildFile; fileRef = B53E6D941257B45800C1E79A /* ASIDataCompressor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7063192DDB6D00B6416E /* ASIWebPageRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B57D0F4612AA7D3600E5F992 /* ASIWebPageRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7064192DDB6D00B6416E /* ASIS3Bucket.h in Headers */ = {isa = PBXBuildFile; fileRef = B5403FFF115114BA00D8BE63 /* ASIS3Bucket.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7065192DDB6D00B6416E /* ASIS3BucketObject.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FC110FF28CA001E145F /* ASIS3BucketObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7066192DDB6D00B6416E /* ASIS3BucketRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5404001115114BA00D8BE63 /* ASIS3BucketRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7067192DDB6D00B6416E /* ASIS3ObjectRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5404003115114BA00D8BE63 /* ASIS3ObjectRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7068192DDB6D00B6416E /* ASIS3ServiceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5404005115114BA00D8BE63 /* ASIS3ServiceRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7069192DDB6D00B6416E /* ASIS3Request.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FC510FF28CA001E145F /* ASIS3Request.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C706A192DDB6D00B6416E /* ASICloudFilesCDNRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FC810FF28CA001E145F /* ASICloudFilesCDNRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C706B192DDB6D00B6416E /* ASICloudFilesContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FCA10FF28CA001E145F /* ASICloudFilesContainer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C706C192DDB6D00B6416E /* ASICloudFilesContainerRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FCC10FF28CA001E145F /* ASICloudFilesContainerRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C706D192DDB6D00B6416E /* ASICloudFilesContainerXMLParserDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FCE10FF28CA001E145F /* ASICloudFilesContainerXMLParserDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C706E192DDB6D00B6416E /* ASICloudFilesObject.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FD010FF28CA001E145F /* ASICloudFilesObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C706F192DDB6D00B6416E /* ASICloudFilesObjectRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FD210FF28CA001E145F /* ASICloudFilesObjectRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7070192DDB6D00B6416E /* ASICloudFilesRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FD410FF28CA001E145F /* ASICloudFilesRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7072192DDC0700B6416E /* ASIKit-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = AD9C7071192DDC0700B6416E /* ASIKit-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7073192DDFE400B6416E /* ASICacheDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B5FE752A11DBBA6A00F898C8 /* ASICacheDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7074192DDFE400B6416E /* ASIProgressDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B5747F281174BB8300C9414E /* ASIProgressDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7077192DE0CB00B6416E /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = B55252B311D22E2200F9B170 /* Reachability.m */; }; + AD9C7078192DE0CB00B6416E /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = B59A87C1103EC6F200300252 /* ASIAuthenticationDialog.m */; }; + AD9C7079192DE0CB00B6416E /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B522DACD1030B2AB009A2D22 /* ASIInputStream.m */; }; + AD9C707A192DE0CB00B6416E /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B60460F765A320064029C /* ASIFormDataRequest.m */; }; + AD9C707B192DE0CB00B6416E /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B60480F765A320064029C /* ASIHTTPRequest.m */; }; + AD9C707C192DE0CB00B6416E /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = B55B604A0F765A320064029C /* ASINetworkQueue.m */; }; + AD9C707D192DE0CB00B6416E /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B5FE752511DBBA6400F898C8 /* ASIDownloadCache.m */; }; + AD9C707E192DE0CB00B6416E /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E6D911257B45800C1E79A /* ASIDataDecompressor.m */; }; + AD9C707F192DE0CB00B6416E /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E6D931257B45800C1E79A /* ASIDataCompressor.m */; }; + AD9C7080192DE0CB00B6416E /* ASIWebPageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B57D0F4712AA7D3600E5F992 /* ASIWebPageRequest.m */; }; + AD9C7081192DE0CB00B6416E /* ASIS3Bucket.m in Sources */ = {isa = PBXBuildFile; fileRef = B5404000115114BA00D8BE63 /* ASIS3Bucket.m */; }; + AD9C7082192DE0CB00B6416E /* ASIS3BucketObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FC210FF28CA001E145F /* ASIS3BucketObject.m */; }; + AD9C7083192DE0CB00B6416E /* ASIS3BucketRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5404002115114BA00D8BE63 /* ASIS3BucketRequest.m */; }; + AD9C7084192DE0CB00B6416E /* ASIS3ObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5404004115114BA00D8BE63 /* ASIS3ObjectRequest.m */; }; + AD9C7085192DE0CB00B6416E /* ASIS3ServiceRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5404006115114BA00D8BE63 /* ASIS3ServiceRequest.m */; }; + AD9C7086192DE0CB00B6416E /* ASIS3Request.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FC610FF28CA001E145F /* ASIS3Request.m */; }; + AD9C7087192DE0CB00B6416E /* ASICloudFilesCDNRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FC910FF28CA001E145F /* ASICloudFilesCDNRequest.m */; }; + AD9C7088192DE0CB00B6416E /* ASICloudFilesContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FCB10FF28CA001E145F /* ASICloudFilesContainer.m */; }; + AD9C7089192DE0CB00B6416E /* ASICloudFilesContainerRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FCD10FF28CA001E145F /* ASICloudFilesContainerRequest.m */; }; + AD9C708A192DE0CB00B6416E /* ASICloudFilesContainerXMLParserDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FCF10FF28CA001E145F /* ASICloudFilesContainerXMLParserDelegate.m */; }; + AD9C708B192DE0CB00B6416E /* ASICloudFilesObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FD110FF28CA001E145F /* ASICloudFilesObject.m */; }; + AD9C708C192DE0CB00B6416E /* ASICloudFilesObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FD310FF28CA001E145F /* ASICloudFilesObjectRequest.m */; }; + AD9C708D192DE0CB00B6416E /* ASICloudFilesRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FD510FF28CA001E145F /* ASICloudFilesRequest.m */; }; + AD9C7099192DE27A00B6416E /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B576D4C011C7CC970059B815 /* CFNetwork.framework */; }; + AD9C709A192DE28700B6416E /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B576D4C911C7CCA60059B815 /* SystemConfiguration.framework */; }; + AD9C709B192DE29200B6416E /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B576D4C611C7CC9F0059B815 /* MobileCoreServices.framework */; }; + AD9C709C192DE29E00B6416E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B576D4D011C7CCBC0059B815 /* CoreGraphics.framework */; }; + AD9C70A0192DE43400B6416E /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD9C709F192DE43400B6416E /* libxml2.dylib */; }; + AD9C70A1192DE4DE00B6416E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD9C709D192DE2B800B6416E /* libz.dylib */; }; B50C182C121C26FA0055FCAB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50C182B121C26FA0055FCAB /* Security.framework */; }; B50C1848121C27510055FCAB /* client.p12 in Resources */ = {isa = PBXBuildFile; fileRef = B50C1847121C27510055FCAB /* client.p12 */; }; B51791A31024C3E800583567 /* AuthenticationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B51791A21024C3E800583567 /* AuthenticationViewController.m */; }; @@ -135,6 +207,15 @@ 3F4C79A919206F9400AAF021 /* ASISCSRequestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASISCSRequestTests.h; sourceTree = ""; }; 3F4C79AA19206F9400AAF021 /* ASISCSRequestTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASISCSRequestTests.m; sourceTree = ""; }; 3FAFBA87191B2C2100609F5B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "iPhone Sample/Resources/Default-568h@2x.png"; sourceTree = ""; }; + AD9C704A192DDA5600B6416E /* ASIKit-iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ASIKit-iOS.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + AD9C704B192DDA5600B6416E /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + AD9C704F192DDA5600B6416E /* ASIKit-iOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ASIKit-iOS-Info.plist"; sourceTree = ""; }; + AD9C7051192DDA5600B6416E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + AD9C7053192DDA5600B6416E /* ASIKit-iOS-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ASIKit-iOS-Prefix.pch"; sourceTree = ""; }; + AD9C7071192DDC0700B6416E /* ASIKit-iOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASIKit-iOS.h"; sourceTree = ""; }; + AD9C7097192DE19500B6416E /* libxml2.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.2.dylib; path = usr/lib/libxml2.2.dylib; sourceTree = SDKROOT; }; + AD9C709D192DE2B800B6416E /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + AD9C709F192DE43400B6416E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; B50C1821121C26DB0055FCAB /* ClientCertificateTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClientCertificateTests.h; sourceTree = ""; }; B50C1822121C26DB0055FCAB /* ClientCertificateTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClientCertificateTests.m; sourceTree = ""; }; B50C182B121C26FA0055FCAB /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; @@ -279,6 +360,19 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + AD9C7047192DDA5600B6416E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + AD9C70A1192DE4DE00B6416E /* libz.dylib in Frameworks */, + AD9C70A0192DE43400B6416E /* libxml2.dylib in Frameworks */, + AD9C709C192DE29E00B6416E /* CoreGraphics.framework in Frameworks */, + AD9C709B192DE29200B6416E /* MobileCoreServices.framework in Frameworks */, + AD9C709A192DE28700B6416E /* SystemConfiguration.framework in Frameworks */, + AD9C7099192DE27A00B6416E /* CFNetwork.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B55B60C50F765BB00064029C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -351,6 +445,7 @@ 1D6058910D05DD3D006BFB54 /* ASIHTTPRequest iPhone.app */, B55B60C70F765BB00064029C /* Tests.app */, B576D72311C7F34D0059B815 /* ASIHTTPRequest iPad.app */, + AD9C704A192DDA5600B6416E /* ASIKit-iOS.framework */, ); name = Products; sourceTree = ""; @@ -362,6 +457,7 @@ 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, + AD9C704D192DDA5600B6416E /* ASIKit-iOS */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); @@ -415,6 +511,9 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + AD9C709F192DE43400B6416E /* libxml2.dylib */, + AD9C709D192DE2B800B6416E /* libz.dylib */, + AD9C7097192DE19500B6416E /* libxml2.2.dylib */, B581DDC912FDFEEE003BA9D0 /* GHUnitIOS.framework */, B576D4C011C7CC970059B815 /* CFNetwork.framework */, B576D4D011C7CCBC0059B815 /* CoreGraphics.framework */, @@ -425,6 +524,7 @@ B576D4C311C7CC9C0059B815 /* UIKit.framework */, DADCEB9812D5057700958557 /* libxml2.dylib */, DADCEB9E12D505AB00958557 /* libz.dylib */, + AD9C704B192DDA5600B6416E /* CoreFoundation.framework */, ); name = Frameworks; sourceTree = ""; @@ -464,6 +564,25 @@ name = Requests; sourceTree = ""; }; + AD9C704D192DDA5600B6416E /* ASIKit-iOS */ = { + isa = PBXGroup; + children = ( + AD9C7071192DDC0700B6416E /* ASIKit-iOS.h */, + AD9C704E192DDA5600B6416E /* Supporting Files */, + ); + path = "ASIKit-iOS"; + sourceTree = ""; + }; + AD9C704E192DDA5600B6416E /* Supporting Files */ = { + isa = PBXGroup; + children = ( + AD9C704F192DDA5600B6416E /* ASIKit-iOS-Info.plist */, + AD9C7050192DDA5600B6416E /* InfoPlist.strings */, + AD9C7053192DDA5600B6416E /* ASIKit-iOS-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; B52329A911CA3380006C6E5A /* UI helpers */ = { isa = PBXGroup; children = ( @@ -573,6 +692,44 @@ }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + AD9C7057192DDB3900B6416E /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + AD9C7058192DDB6D00B6416E /* Reachability.h in Headers */, + AD9C7059192DDB6D00B6416E /* ASIHTTPRequestConfig.h in Headers */, + AD9C705A192DDB6D00B6416E /* ASIHTTPRequestDelegate.h in Headers */, + AD9C705B192DDB6D00B6416E /* ASIAuthenticationDialog.h in Headers */, + AD9C705C192DDB6D00B6416E /* ASIInputStream.h in Headers */, + AD9C705D192DDB6D00B6416E /* ASIFormDataRequest.h in Headers */, + AD9C705E192DDB6D00B6416E /* ASIHTTPRequest.h in Headers */, + AD9C705F192DDB6D00B6416E /* ASINetworkQueue.h in Headers */, + AD9C7060192DDB6D00B6416E /* ASIDownloadCache.h in Headers */, + AD9C7061192DDB6D00B6416E /* ASIDataDecompressor.h in Headers */, + AD9C7062192DDB6D00B6416E /* ASIDataCompressor.h in Headers */, + AD9C7063192DDB6D00B6416E /* ASIWebPageRequest.h in Headers */, + AD9C7064192DDB6D00B6416E /* ASIS3Bucket.h in Headers */, + AD9C7065192DDB6D00B6416E /* ASIS3BucketObject.h in Headers */, + AD9C7066192DDB6D00B6416E /* ASIS3BucketRequest.h in Headers */, + AD9C7067192DDB6D00B6416E /* ASIS3ObjectRequest.h in Headers */, + AD9C7068192DDB6D00B6416E /* ASIS3ServiceRequest.h in Headers */, + AD9C7069192DDB6D00B6416E /* ASIS3Request.h in Headers */, + AD9C706A192DDB6D00B6416E /* ASICloudFilesCDNRequest.h in Headers */, + AD9C706B192DDB6D00B6416E /* ASICloudFilesContainer.h in Headers */, + AD9C706C192DDB6D00B6416E /* ASICloudFilesContainerRequest.h in Headers */, + AD9C706D192DDB6D00B6416E /* ASICloudFilesContainerXMLParserDelegate.h in Headers */, + AD9C706E192DDB6D00B6416E /* ASICloudFilesObject.h in Headers */, + AD9C706F192DDB6D00B6416E /* ASICloudFilesObjectRequest.h in Headers */, + AD9C7072192DDC0700B6416E /* ASIKit-iOS.h in Headers */, + AD9C7070192DDB6D00B6416E /* ASICloudFilesRequest.h in Headers */, + AD9C7073192DDFE400B6416E /* ASICacheDelegate.h in Headers */, + AD9C7074192DDFE400B6416E /* ASIProgressDelegate.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ 1D6058900D05DD3D006BFB54 /* iPhone */ = { isa = PBXNativeTarget; @@ -592,6 +749,24 @@ productReference = 1D6058910D05DD3D006BFB54 /* ASIHTTPRequest iPhone.app */; productType = "com.apple.product-type.application"; }; + AD9C7049192DDA5600B6416E /* ASIKit-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = AD9C7056192DDA5600B6416E /* Build configuration list for PBXNativeTarget "ASIKit-iOS" */; + buildPhases = ( + AD9C7046192DDA5600B6416E /* Sources */, + AD9C7047192DDA5600B6416E /* Frameworks */, + AD9C7048192DDA5600B6416E /* Resources */, + AD9C7057192DDB3900B6416E /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "ASIKit-iOS"; + productName = "ASIKit-iOS"; + productReference = AD9C704A192DDA5600B6416E /* ASIKit-iOS.framework */; + productType = "com.apple.product-type.bundle"; + }; B55B60C60F765BB00064029C /* Tests */ = { isa = PBXNativeTarget; buildConfigurationList = B55B60CE0F765BB10064029C /* Build configuration list for PBXNativeTarget "Tests" */; @@ -646,6 +821,7 @@ Japanese, French, German, + en, ); mainGroup = 29B97314FDCFA39411CA2CEA /* iPhone */; projectDirPath = ""; @@ -654,6 +830,8 @@ 1D6058900D05DD3D006BFB54 /* iPhone */, B55B60C60F765BB00064029C /* Tests */, B576D70211C7F34D0059B815 /* iPad */, + AD9C7049192DDA5600B6416E /* ASIKit-iOS */, + AD9C70AB192DFFCA00B6416E /* ASIKit */, ); }; /* End PBXProject section */ @@ -670,6 +848,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + AD9C7048192DDA5600B6416E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AD9C7052192DDA5600B6416E /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B55B60C30F765BB00064029C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -694,6 +880,19 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + AD9C70AF192DFFF300B6416E /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Sets the target folders and the final framework product.\nFMK_NAME=ASIKit\nFMK_VERSION=A\n\n# Install dir will be the final output to the framework.\n# The following line create it in the root folder of the current project.\nINSTALL_DIR=${SRCROOT}/Products/${FMK_NAME}.framework\n\n# Working dir will be deleted after the framework creation.\nWRK_DIR=build\nFMK_NAME_ORG=ASIKit-iOS\nDEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME_ORG}.framework\nSIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME_ORG}.framework\n\n# Building both architectures.\nxcodebuild ARCHS=\"armv7 armv7s\" ONLY_ACTIVE_ARCH=NO -project iPhone.xcodeproj -configuration \"Release\" -target \"${FMK_NAME_ORG}\" -sdk iphoneos\nxcodebuild -project iPhone.xcodeproj -configuration \"Release\" -target \"${FMK_NAME_ORG}\" -sdk iphonesimulator\n\n# Cleaning the oldest.\nif [ -d \"${INSTALL_DIR}\" ]\nthen\nrm -rf \"${INSTALL_DIR}\"\nfi\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${DEVICE_DIR}/Headers/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${DEVICE_DIR}/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Removes the binary and header from the resources folder.\nrm -r \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/Headers\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/${FMK_NAME_ORG}\"\n\n# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.\nlipo -create \"${DEVICE_DIR}/${FMK_NAME_ORG}\" \"${SIMULATOR_DIR}/${FMK_NAME_ORG}\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\nrm -r \"${WRK_DIR}\"\n\n\n"; + }; B52D492410DA403A008E8365 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -765,6 +964,36 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + AD9C7046192DDA5600B6416E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AD9C7077192DE0CB00B6416E /* Reachability.m in Sources */, + AD9C7078192DE0CB00B6416E /* ASIAuthenticationDialog.m in Sources */, + AD9C7079192DE0CB00B6416E /* ASIInputStream.m in Sources */, + AD9C707A192DE0CB00B6416E /* ASIFormDataRequest.m in Sources */, + AD9C707B192DE0CB00B6416E /* ASIHTTPRequest.m in Sources */, + AD9C707C192DE0CB00B6416E /* ASINetworkQueue.m in Sources */, + AD9C707D192DE0CB00B6416E /* ASIDownloadCache.m in Sources */, + AD9C707E192DE0CB00B6416E /* ASIDataDecompressor.m in Sources */, + AD9C707F192DE0CB00B6416E /* ASIDataCompressor.m in Sources */, + AD9C7080192DE0CB00B6416E /* ASIWebPageRequest.m in Sources */, + AD9C7081192DE0CB00B6416E /* ASIS3Bucket.m in Sources */, + AD9C7082192DE0CB00B6416E /* ASIS3BucketObject.m in Sources */, + AD9C7083192DE0CB00B6416E /* ASIS3BucketRequest.m in Sources */, + AD9C7084192DE0CB00B6416E /* ASIS3ObjectRequest.m in Sources */, + AD9C7085192DE0CB00B6416E /* ASIS3ServiceRequest.m in Sources */, + AD9C7086192DE0CB00B6416E /* ASIS3Request.m in Sources */, + AD9C7087192DE0CB00B6416E /* ASICloudFilesCDNRequest.m in Sources */, + AD9C7088192DE0CB00B6416E /* ASICloudFilesContainer.m in Sources */, + AD9C7089192DE0CB00B6416E /* ASICloudFilesContainerRequest.m in Sources */, + AD9C708A192DE0CB00B6416E /* ASICloudFilesContainerXMLParserDelegate.m in Sources */, + AD9C708B192DE0CB00B6416E /* ASICloudFilesObject.m in Sources */, + AD9C708C192DE0CB00B6416E /* ASICloudFilesObjectRequest.m in Sources */, + AD9C708D192DE0CB00B6416E /* ASICloudFilesRequest.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B55B60C40F765BB00064029C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -831,6 +1060,17 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + AD9C7050192DDA5600B6416E /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + AD9C7051192DDA5600B6416E /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; @@ -875,6 +1115,119 @@ }; name = Release; }; + AD9C7054192DDA5600B6416E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ASIKit-iOS/ASIKit-iOS-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "${SDK_DIR}/usr/include/libxml2", + ); + INFOPLIST_FILE = "ASIKit-iOS/ASIKit-iOS-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + LINK_WITH_STANDARD_LIBRARIES = NO; + MACH_O_TYPE = mh_object; + MACOSX_DEPLOYMENT_TARGET = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + AD9C7055192DDA5600B6416E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ASIKit-iOS/ASIKit-iOS-Prefix.pch"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "${SDK_DIR}/usr/include/libxml2", + ); + INFOPLIST_FILE = "ASIKit-iOS/ASIKit-iOS-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + LINK_WITH_STANDARD_LIBRARIES = NO; + MACH_O_TYPE = mh_object; + MACOSX_DEPLOYMENT_TARGET = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; + AD9C70AD192DFFCA00B6416E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + AD9C70AE192DFFCA00B6416E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; B55B60CC0F765BB10064029C /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = B50F66181297FA45003887B1 /* strict.xcconfig */; @@ -1011,6 +1364,24 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + AD9C7056192DDA5600B6416E /* Build configuration list for PBXNativeTarget "ASIKit-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AD9C7054192DDA5600B6416E /* Debug */, + AD9C7055192DDA5600B6416E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + AD9C70AC192DFFCA00B6416E /* Build configuration list for PBXAggregateTarget "ASIKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AD9C70AD192DFFCA00B6416E /* Debug */, + AD9C70AE192DFFCA00B6416E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; B55B60CE0F765BB10064029C /* Build configuration list for PBXNativeTarget "Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( From fb443c6b478354710dd25d167490d54bab3ed20b Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Fri, 23 May 2014 16:20:06 +0800 Subject: [PATCH 11/37] add readme --- ASIKit-iOS/{ASIKit-iOS.h => ASIKit.h} | 2 +- README.md | 164 +++++++++++++++++++++++--- iPhone.xcodeproj/project.pbxproj | 8 +- 3 files changed, 154 insertions(+), 20 deletions(-) rename ASIKit-iOS/{ASIKit-iOS.h => ASIKit.h} (98%) diff --git a/ASIKit-iOS/ASIKit-iOS.h b/ASIKit-iOS/ASIKit.h similarity index 98% rename from ASIKit-iOS/ASIKit-iOS.h rename to ASIKit-iOS/ASIKit.h index a7b51919..716b6e50 100644 --- a/ASIKit-iOS/ASIKit-iOS.h +++ b/ASIKit-iOS/ASIKit.h @@ -1,5 +1,5 @@ // -// ASIKit-iOS.h +// ASIKit.h // iPhone // // Created by Littlebox222 on 14-5-22. diff --git a/README.md b/README.md index adb92a68..dd10614d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ ASI-SCS ======= -Branch of ASIHTTPRequest for Sina Cloud Storage Service -本SDK为ASIHTTPRequest的一个分支,熟悉ASI的同学可以轻松上手,不熟悉的也没关系,相信看完文档您一定能够运用自如,并且能够对ASI有一个初步的认识。 -> * 文档的详细内容请查阅:http://open.sinastorage.com/?c=doc&a=sdk +本SDK为ASIHTTPRequest的一个分支,熟悉ASI的同学可以轻松上手,不熟悉的也没关系,相信看完文档您一定能够运用自如,并且能够对ASI有一个初步的了解。 + > * SCS API 的详细内容请查阅:http://open.sinastorage.com/?c=doc&a=api > * ASIHTTPRequest的详细内容请查阅:http://allseeing-i.com/ASIHTTPRequest/How-to-use @@ -13,17 +12,57 @@ Branch of ASIHTTPRequest for Sina Cloud Storage Service > * OSX: 10.8及以上。 ####相关配置: -> * 1、将SDK文件夹拷贝到你的工程目录下; -> * 2、打开xcode,将SCSSDK.xcodeproj拖动到你的工程中; -> * 3、选择你的工程,在右侧选择Build Settings,并设置Other Linker Flags 为 -ObjC -all_load; -> * 4、选择Build Phases,在Link Binary With Libraries中添加如下: -> * _iOS_:libSCSSDK_IOS.a;Foundation.framework ;CoreData.framework ;CoreFoundation.framework ;Security.framework ;CoreGraphics.framework ;UIKit.framework; -> * _OSX_:libSCSSDK_OSX.a;Cocoa.framework ;CoreData.framework ;CoreFoundation.framework ;Security.framework ;AppKit.framework; -> * 5、 +> * 1、下载ASIKit.Framework(你可以手动下载,链接如下;也可以执行步骤(1)—(4),写脚本由程序自动下载) +>>Mac OS X:http://sdk.sinastorage.com/ASIKit.framework.zip +>>iOS:http://sdk.sinastorage.com/ASIKit-iOS.framework.zip +>> * (1)、打开工程,单击XCode侧边栏中的project行,并选择右侧的Build Phase; +>> * (2)、选择项目的Target,在顶部菜单栏选择Editor > Add Build Phase > Add Run Script Build Phase; +>> * (3)、设置Run Script(Mac OS X 与 iOS不同)如下; +>> * (4)、Commond+B编译工程,会自动下载所需的ASIKit.Framework包到工程目录。 + +> * 2、选择Link Binary With Libraries,点击“+”,点击“Add Other...”,到工程目录下选择添加ASIKit.Framework +(或者将下载好的ASIKit.Framework直接拖到xcode工程里的Frameworks分组下,并在Add to targets里选中你所要关联的target) +> * 3、在所需文件中添加头:ASIKit/ASIKit.h + +```shell +# Run Script For Mac OS X + +# If not present, download ASIKit archive, extract it and cleanup. +if [ ! -e $SRCROOT/ASIKit.framework ]; then + rm -rf $SRCROOT/ASIKit + mkdir $SRCROOT/ASIKit + cd $SRCROOT/ASIKit + echo "Downloading ASIKit framework" + curl -s -O http://sdk.sinastorage.com/ASIKit.framework.zip + echo "Unzipping ASIKit" + unzip ASIKit.framework.zip + mv ASIKit.framework $SRCROOT + rm -rf $SRCROOT/ASIKit + echo "ASIKit installed for build" +fi +``` + +```shell +# Run Script For iOS + +# If not present, download ASIKit archive, extract it and cleanup. + if [ ! -e $SRCROOT/ASIKit.framework ]; then + rm -rf $SRCROOT/ASIKit + mkdir $SRCROOT/ASIKit + cd $SRCROOT/ASIKit + echo "Downloading ASIKit-iOS framework" + curl -s -O http://sdk.sinastorage.com/ASIKit-iOS.framework.zip + echo "Unzipping ASIKit-iOS" + unzip ASIKit-iOS.framework.zip + mv ASIKit.framework $SRCROOT + rm -rf $SRCROOT/ASIKit + echo "ASIKit installed for build" +fi +``` ###快速上手 > * 以下示例为简单明确的介绍SDK使用方法,均采用同步请求方式。 -关于请求队列以及异步请求的详细介绍,请参考:【使用队列及异步请求】 +关于请求队列以及异步请求的详细介绍,请参考:【使用异步请求及队列】 ####Bucket操作 #####列取bucket @@ -39,7 +78,9 @@ if (![request error]) { ``` #####创建bucket + > * 为每个请求设置相应的accessKey和secretAccessKey是很繁琐的,因此我们可以设置基类(ASIS3Request)的sharedAccessKey和sharedSecretAccessKey。这样下次再发送某一请求时,无需再次设置相应的key,SDK会调用我们设置好的这两个sharedKey。 + ```objective-c [ASIS3Request setSharedSecretAccessKey:@"YourSecretAccessKey"]; [ASIS3Request setSharedAccessKey:@"YourAccessKey"]; @@ -53,6 +94,7 @@ if ([request error]) { ``` #####删除bucket + > * 这里我们无需再次设置相应的accesskey,前面我们已经设置好了两个sharedKey。 ```objective-c @@ -146,13 +188,25 @@ ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath wit [request requestScheme:ASIS3RequestSchemeHTTPS]; ``` -####使用GZIP压缩 +####使用异步请求及队列 +#####异步请求的使用 ```objective-c -ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath withBucket:@"my-bucket" key:@"path/to/the/object"]; -[request setShouldCompressRequestBody:YES]; +- (void)listRequest { + ASIS3BucketRequest *listRequest = [ASIS3BucketRequest requestWithBucket:@"my-bucket"]; + [listRequest setDelegate:self];//delegate:ASIHTTPRequestDelegate + [listRequest startAsynchronous]; +} + +- (void)requestFinished:(ASIHTTPRequest *)request { + NSString *responseString = [request responseString]; + NSData *responseData = [request responseData]; +} + +- (void)requestFailed:(ASIHTTPRequest *)request { + NSError *error = [request error]; +} ``` -####使用队列及异步请求 #####创建队列 ```objective-c //ASINetworkQueue *queue; @@ -161,7 +215,9 @@ ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath wit ``` #####设置队列回调 + > * 其中selector可自定义。 + ```objective-c //请求成功 [[self queue] setRequestDidFinishSelector:@selector(requestDone:)]; @@ -207,7 +263,9 @@ ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath wit ``` #####example + > * 本示例较为完整的展示了如何使用队列及异步请求获取object列表并下载。 + ```objective-c - (void)download25ImagesToDisk { @@ -220,8 +278,12 @@ ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath wit [listRequest setPrefix:@"images/jpegs"]; [listRequest setMaxResultCount:25]; [listRequest setDelegate:self]; + + //设置回调 [listRequest setDidFinishSelector:@selector(finishedDownloadingImageList:)]; [listRequest setDidFailSelector:@selector(failedDownloadingImageList:)]; + + //加入队列 [[self queue] addOperation:listRequest]; } @@ -258,4 +320,76 @@ ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath wit - (void)requestFailed:(ASIS3Request *)request { NSLog(@"Download error: %@",[[request error] localizedDescription]); } +``` + +####进度跟踪 + +> * 对于单个请求,可通过设置delegate获取进度信息; +> * 对于请求队列,可通过设置队列的delegate获取全部请求的进度信息; +> * 两者可同时获得; +> * 可通过设置showAccurateProgress == YES来获取精确进度; +> * 详情请参考:http://allseeing-i.com/ASIHTTPRequest/How-to-use#tracking_progress + +#####上传进度(单个请求) +```objective-c +//myProgressIndicator is a UIProgressView for iOS +//myProgressIndicator is a NSProgressIndicator for OS X + +ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; +[request setUploadProgressDelegate:myProgressIndicator]; +[request startSynchronous]; +NSLog(@"Max: %f, Value: %f", [myProgressIndicator maxValue],[myProgressIndicator doubleValue]); +``` + +#####上传进度(队列) +```objective-c +- (void)uploadSomethingFiveTimes:(NSURL *)url +{ + [myQueue cancelAllOperations]; + [myQueue setUploadProgressDelegate:myProgressIndicator]; + [myQueue setDelegate:self]; + [myQueue setRequestDidFinishSelector:@selector(queueComplete:)]; + int i; + for (i=0; i<5; i++) { + ASIHTTPRequest *request = [ASIFormDataRequest requestWithURL:url]; + [request setPostBody:[@"Some data" dataUsingEncoding:NSUTF8StringEncoding]]; + [myQueue addOperation:request]; + } + [myQueue go]; +} + +- (void)queueComplete:(ASINetworkQueue *)queue +{ + NSLog(@"Max: %f, Value: %f", [myProgressIndicator maxValue],[myProgressIndicator doubleValue]); +} +``` + +#####下载进度(单个请求) +```objective-c + ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; +[request setDownloadProgressDelegate:myProgressIndicator]; +[request startSynchronous]; +NSLog(@"Max: %f, Value: %f", [myProgressIndicator maxValue],[myProgressIndicator doubleValue]); +``` + +#####下载进度(队列) +```objective-c +- (void)fetchThisURLFiveTimes:(NSURL *)url +{ + [myQueue cancelAllOperations]; + [myQueue setDownloadProgressDelegate:myProgressIndicator]; + [myQueue setDelegate:self]; + [myQueue setRequestDidFinishSelector:@selector(queueComplete:)]; + int i; + for (i=0; i<5; i++) { + ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; + [myQueue addOperation:request]; + } + [myQueue go]; +} + +- (void)queueComplete:(ASINetworkQueue *)queue +{ + NSLog(@"Value: %f", [myProgressIndicator progress]); +} ``` \ No newline at end of file diff --git a/iPhone.xcodeproj/project.pbxproj b/iPhone.xcodeproj/project.pbxproj index ba9c72bd..d83fc850 100644 --- a/iPhone.xcodeproj/project.pbxproj +++ b/iPhone.xcodeproj/project.pbxproj @@ -50,7 +50,7 @@ AD9C706E192DDB6D00B6416E /* ASICloudFilesObject.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FD010FF28CA001E145F /* ASICloudFilesObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; AD9C706F192DDB6D00B6416E /* ASICloudFilesObjectRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FD210FF28CA001E145F /* ASICloudFilesObjectRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; AD9C7070192DDB6D00B6416E /* ASICloudFilesRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B5873FD410FF28CA001E145F /* ASICloudFilesRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AD9C7072192DDC0700B6416E /* ASIKit-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = AD9C7071192DDC0700B6416E /* ASIKit-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD9C7072192DDC0700B6416E /* ASIKit.h in Headers */ = {isa = PBXBuildFile; fileRef = AD9C7071192DDC0700B6416E /* ASIKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; AD9C7073192DDFE400B6416E /* ASICacheDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B5FE752A11DBBA6A00F898C8 /* ASICacheDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; AD9C7074192DDFE400B6416E /* ASIProgressDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B5747F281174BB8300C9414E /* ASIProgressDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; AD9C7077192DE0CB00B6416E /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = B55252B311D22E2200F9B170 /* Reachability.m */; }; @@ -212,7 +212,7 @@ AD9C704F192DDA5600B6416E /* ASIKit-iOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ASIKit-iOS-Info.plist"; sourceTree = ""; }; AD9C7051192DDA5600B6416E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; AD9C7053192DDA5600B6416E /* ASIKit-iOS-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ASIKit-iOS-Prefix.pch"; sourceTree = ""; }; - AD9C7071192DDC0700B6416E /* ASIKit-iOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASIKit-iOS.h"; sourceTree = ""; }; + AD9C7071192DDC0700B6416E /* ASIKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIKit.h; sourceTree = ""; }; AD9C7097192DE19500B6416E /* libxml2.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.2.dylib; path = usr/lib/libxml2.2.dylib; sourceTree = SDKROOT; }; AD9C709D192DE2B800B6416E /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; AD9C709F192DE43400B6416E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; @@ -567,7 +567,7 @@ AD9C704D192DDA5600B6416E /* ASIKit-iOS */ = { isa = PBXGroup; children = ( - AD9C7071192DDC0700B6416E /* ASIKit-iOS.h */, + AD9C7071192DDC0700B6416E /* ASIKit.h */, AD9C704E192DDA5600B6416E /* Supporting Files */, ); path = "ASIKit-iOS"; @@ -721,7 +721,7 @@ AD9C706D192DDB6D00B6416E /* ASICloudFilesContainerXMLParserDelegate.h in Headers */, AD9C706E192DDB6D00B6416E /* ASICloudFilesObject.h in Headers */, AD9C706F192DDB6D00B6416E /* ASICloudFilesObjectRequest.h in Headers */, - AD9C7072192DDC0700B6416E /* ASIKit-iOS.h in Headers */, + AD9C7072192DDC0700B6416E /* ASIKit.h in Headers */, AD9C7070192DDB6D00B6416E /* ASICloudFilesRequest.h in Headers */, AD9C7073192DDFE400B6416E /* ASICacheDelegate.h in Headers */, AD9C7074192DDFE400B6416E /* ASIProgressDelegate.h in Headers */, From 81da4708269df01cfbcb7451b0ee325d3c36a628 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Mon, 26 May 2014 10:48:57 +0800 Subject: [PATCH 12/37] update readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dd10614d..c8dda1f0 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ ASI-SCS > * 2、选择Link Binary With Libraries,点击“+”,点击“Add Other...”,到工程目录下选择添加ASIKit.Framework (或者将下载好的ASIKit.Framework直接拖到xcode工程里的Frameworks分组下,并在Add to targets里选中你所要关联的target) -> * 3、在所需文件中添加头:ASIKit/ASIKit.h +> * 3、(对于iOS工程)选择Link Binary With Libraries,点击“+”,添加库:libxml2.dylib,libz.dylib,SystemConfiguration.framework,MobileCoreServices.framework,CFNetwork.framework +> * 4、在所需文件中添加头:ASIKit/ASIKit.h ```shell # Run Script For Mac OS X From 9e56f36f555ba7ea116f687b3d702cda5243f19f Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Mon, 26 May 2014 16:22:58 +0800 Subject: [PATCH 13/37] update --- Classes/ASIHTTPRequest.m | 2 +- Classes/Tests/ASISCSRequestTests.m | 38 ++++++++++++++++-------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m index d99c54cb..c4f4f5a7 100644 --- a/Classes/ASIHTTPRequest.m +++ b/Classes/ASIHTTPRequest.m @@ -24,7 +24,7 @@ #import "ASIDataCompressor.h" // Automatically set on build -NSString *ASIHTTPRequestVersion = @"v1.8.2-14 2014-05-12"; +NSString *ASIHTTPRequestVersion = @"v1.8.2-15 2014-05-20"; static NSString *defaultUserAgent = nil; diff --git a/Classes/Tests/ASISCSRequestTests.m b/Classes/Tests/ASISCSRequestTests.m index efd1e621..e72b56c3 100644 --- a/Classes/Tests/ASISCSRequestTests.m +++ b/Classes/Tests/ASISCSRequestTests.m @@ -18,7 +18,7 @@ static NSString *secretAccessKey = @""; // You should run these tests on a bucket that does not yet exist -static NSString *bucket = @""; +static NSString *bucket = @"test-009"; @@ -143,7 +143,7 @@ - (void)testFailure - (void)createTestBucket { - return; + //return; /* if (!bucket) { @@ -157,25 +157,26 @@ - (void)createTestBucket [bucketRequest setSecretAccessKey:secretAccessKey]; [bucketRequest setAccessKey:accessKey]; [bucketRequest startSynchronous]; + [self logRequest:bucketRequest]; GHAssertNil([bucketRequest error], @"Failed to create a bucket"); } // To run this test, uncomment and fill in your S3 access details - (void)testREST { - [self createTestBucket]; + //[self createTestBucket]; BOOL success = (![secretAccessKey isEqualToString:@""] && ![accessKey isEqualToString:@""] && ![bucket isEqualToString:@""]); GHAssertTrue(success, @"You need to supply your S3 access details to run the REST test (see the top of ASIS3RequestTests.m)"); // Test creating a bucket - /* + ASIS3BucketRequest *bucketRequest = [ASIS3BucketRequest PUTRequestWithBucket:bucket]; [bucketRequest setSecretAccessKey:secretAccessKey]; [bucketRequest setAccessKey:accessKey]; [bucketRequest startSynchronous]; GHAssertNil([bucketRequest error],@"Failed to create a bucket"); - */ + // List buckets to make sure the bucket is there ASIS3ServiceRequest *serviceRequest = [ASIS3ServiceRequest serviceRequest]; @@ -324,13 +325,12 @@ - (void)testREST GHAssertTrue(success,@"Failed to DELETE the file from S3"); // Delete the bucket - /* + bucketRequest = [ASIS3BucketRequest DELETERequestWithBucket:bucket]; [bucketRequest setSecretAccessKey:secretAccessKey]; [bucketRequest setAccessKey:accessKey]; [bucketRequest startSynchronous]; GHAssertNil([bucketRequest error],@"Failed to delete a bucket"); - */ } @@ -730,15 +730,15 @@ - (void)testHTTPS [ASIS3Request setSharedSecretAccessKey:secretAccessKey]; // Create a bucket - /* + ASIS3Request *request = [ASIS3BucketRequest PUTRequestWithBucket:bucket]; [request setValidatesSecureCertificate:NO]; [request setRequestScheme:ASIS3RequestSchemeHTTPS]; [request startSynchronous]; GHAssertNil([request error],@"Failed to create a bucket"); - */ - ASIS3Request *request; + + //ASIS3Request *request; // PUT something in it NSString *key = @"king"; @@ -763,13 +763,15 @@ - (void)testHTTPS GHAssertTrue(success,@"Failed to DELETE the object from S3"); // Delete the bucket - /* + request = [ASIS3BucketRequest DELETERequestWithBucket:bucket]; [request setRequestScheme:ASIS3RequestSchemeHTTPS]; [request startSynchronous]; GHAssertNil([request error],@"Failed to delete a bucket"); - */ + //sleep(1); + + [ASIS3Request setSharedAccessKey:nil]; [ASIS3Request setSharedSecretAccessKey:nil]; } @@ -781,14 +783,14 @@ - (void)testCannedACLs [ASIS3Request setSharedSecretAccessKey:secretAccessKey]; // Create a bucket - /* + ASIS3Request *request = [ASIS3BucketRequest PUTRequestWithBucket:bucket]; [request setRequestScheme:ASIS3RequestSchemeHTTPS]; [request startSynchronous]; GHAssertNil([request error],@"Failed to create a bucket"); - */ - ASIS3Request *request; + + //ASIS3Request *request; NSArray *ACLs = [NSArray arrayWithObjects:ASIS3AccessPolicyPrivate, ASIS3AccessPolicyPublicRead, ASIS3AccessPolicyPublicReadWrite, ASIS3AccessPolicyAuthenticatedRead, nil]; @@ -801,7 +803,7 @@ - (void)testCannedACLs [self logRequest:request]; GHAssertNil([request error],@"Failed to PUT some data into S3"); - sleep(1); + //sleep(1); // GET object ACL request = [ASIS3ObjectRequest requestWithBucket:bucket key:key subResource:@"acl"]; @@ -818,12 +820,12 @@ - (void)testCannedACLs GHAssertTrue(success,@"Failed to DELETE the object from S3"); // Delete the bucket - /* + request = [ASIS3BucketRequest DELETERequestWithBucket:bucket]; [request setRequestScheme:ASIS3RequestSchemeHTTPS]; [request startSynchronous]; GHAssertNil([request error],@"Failed to delete a bucket"); - */ + [ASIS3Request setSharedAccessKey:nil]; [ASIS3Request setSharedSecretAccessKey:nil]; From 1e0bf49be89665ff67b2d73b7a06de2a0902ac95 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 28 May 2014 15:18:40 +0800 Subject: [PATCH 14/37] update --- ASIKit-iOS/ASIKit-iOS-Info.plist | 44 -------------------------------- iPhone.xcodeproj/project.pbxproj | 28 +++++++------------- 2 files changed, 9 insertions(+), 63 deletions(-) delete mode 100644 ASIKit-iOS/ASIKit-iOS-Info.plist diff --git a/ASIKit-iOS/ASIKit-iOS-Info.plist b/ASIKit-iOS/ASIKit-iOS-Info.plist deleted file mode 100644 index 68dabaf2..00000000 --- a/ASIKit-iOS/ASIKit-iOS-Info.plist +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.sina.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - CFPlugInDynamicRegisterFunction - - CFPlugInDynamicRegistration - NO - CFPlugInFactories - - 00000000-0000-0000-0000-000000000000 - MyFactoryFunction - - CFPlugInTypes - - 00000000-0000-0000-0000-000000000000 - - 00000000-0000-0000-0000-000000000000 - - - CFPlugInUnloadFunction - - - diff --git a/iPhone.xcodeproj/project.pbxproj b/iPhone.xcodeproj/project.pbxproj index d83fc850..5c977b2f 100644 --- a/iPhone.xcodeproj/project.pbxproj +++ b/iPhone.xcodeproj/project.pbxproj @@ -76,12 +76,6 @@ AD9C708B192DE0CB00B6416E /* ASICloudFilesObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FD110FF28CA001E145F /* ASICloudFilesObject.m */; }; AD9C708C192DE0CB00B6416E /* ASICloudFilesObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FD310FF28CA001E145F /* ASICloudFilesObjectRequest.m */; }; AD9C708D192DE0CB00B6416E /* ASICloudFilesRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B5873FD510FF28CA001E145F /* ASICloudFilesRequest.m */; }; - AD9C7099192DE27A00B6416E /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B576D4C011C7CC970059B815 /* CFNetwork.framework */; }; - AD9C709A192DE28700B6416E /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B576D4C911C7CCA60059B815 /* SystemConfiguration.framework */; }; - AD9C709B192DE29200B6416E /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B576D4C611C7CC9F0059B815 /* MobileCoreServices.framework */; }; - AD9C709C192DE29E00B6416E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B576D4D011C7CCBC0059B815 /* CoreGraphics.framework */; }; - AD9C70A0192DE43400B6416E /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD9C709F192DE43400B6416E /* libxml2.dylib */; }; - AD9C70A1192DE4DE00B6416E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD9C709D192DE2B800B6416E /* libz.dylib */; }; B50C182C121C26FA0055FCAB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50C182B121C26FA0055FCAB /* Security.framework */; }; B50C1848121C27510055FCAB /* client.p12 in Resources */ = {isa = PBXBuildFile; fileRef = B50C1847121C27510055FCAB /* client.p12 */; }; B51791A31024C3E800583567 /* AuthenticationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B51791A21024C3E800583567 /* AuthenticationViewController.m */; }; @@ -213,9 +207,6 @@ AD9C7051192DDA5600B6416E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; AD9C7053192DDA5600B6416E /* ASIKit-iOS-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ASIKit-iOS-Prefix.pch"; sourceTree = ""; }; AD9C7071192DDC0700B6416E /* ASIKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIKit.h; sourceTree = ""; }; - AD9C7097192DE19500B6416E /* libxml2.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.2.dylib; path = usr/lib/libxml2.2.dylib; sourceTree = SDKROOT; }; - AD9C709D192DE2B800B6416E /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; - AD9C709F192DE43400B6416E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; B50C1821121C26DB0055FCAB /* ClientCertificateTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClientCertificateTests.h; sourceTree = ""; }; B50C1822121C26DB0055FCAB /* ClientCertificateTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClientCertificateTests.m; sourceTree = ""; }; B50C182B121C26FA0055FCAB /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; @@ -364,12 +355,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AD9C70A1192DE4DE00B6416E /* libz.dylib in Frameworks */, - AD9C70A0192DE43400B6416E /* libxml2.dylib in Frameworks */, - AD9C709C192DE29E00B6416E /* CoreGraphics.framework in Frameworks */, - AD9C709B192DE29200B6416E /* MobileCoreServices.framework in Frameworks */, - AD9C709A192DE28700B6416E /* SystemConfiguration.framework in Frameworks */, - AD9C7099192DE27A00B6416E /* CFNetwork.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -511,9 +496,6 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( - AD9C709F192DE43400B6416E /* libxml2.dylib */, - AD9C709D192DE2B800B6416E /* libz.dylib */, - AD9C7097192DE19500B6416E /* libxml2.2.dylib */, B581DDC912FDFEEE003BA9D0 /* GHUnitIOS.framework */, B576D4C011C7CC970059B815 /* CFNetwork.framework */, B576D4D011C7CCBC0059B815 /* CoreGraphics.framework */, @@ -891,7 +873,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Sets the target folders and the final framework product.\nFMK_NAME=ASIKit\nFMK_VERSION=A\n\n# Install dir will be the final output to the framework.\n# The following line create it in the root folder of the current project.\nINSTALL_DIR=${SRCROOT}/Products/${FMK_NAME}.framework\n\n# Working dir will be deleted after the framework creation.\nWRK_DIR=build\nFMK_NAME_ORG=ASIKit-iOS\nDEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME_ORG}.framework\nSIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME_ORG}.framework\n\n# Building both architectures.\nxcodebuild ARCHS=\"armv7 armv7s\" ONLY_ACTIVE_ARCH=NO -project iPhone.xcodeproj -configuration \"Release\" -target \"${FMK_NAME_ORG}\" -sdk iphoneos\nxcodebuild -project iPhone.xcodeproj -configuration \"Release\" -target \"${FMK_NAME_ORG}\" -sdk iphonesimulator\n\n# Cleaning the oldest.\nif [ -d \"${INSTALL_DIR}\" ]\nthen\nrm -rf \"${INSTALL_DIR}\"\nfi\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${DEVICE_DIR}/Headers/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${DEVICE_DIR}/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Removes the binary and header from the resources folder.\nrm -r \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/Headers\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/${FMK_NAME_ORG}\"\n\n# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.\nlipo -create \"${DEVICE_DIR}/${FMK_NAME_ORG}\" \"${SIMULATOR_DIR}/${FMK_NAME_ORG}\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\nrm -r \"${WRK_DIR}\"\n\n\n"; + shellScript = "# Sets the target folders and the final framework product.\nFMK_NAME=ASIKit\nFMK_VERSION=A\n\n# Install dir will be the final output to the framework.\n# The following line create it in the root folder of the current project.\nINSTALL_DIR=${SRCROOT}/Products/${FMK_NAME}.framework\n\n# Working dir will be deleted after the framework creation.\nWRK_DIR=build\nFMK_NAME_ORG=ASIKit-iOS\nDEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME_ORG}.framework\nSIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME_ORG}.framework\n\n# Building both architectures.\nxcodebuild ONLY_ACTIVE_ARCH=NO -project iPhone.xcodeproj -configuration \"Release\" -target \"${FMK_NAME_ORG}\" -sdk iphoneos\nxcodebuild ONLY_ACTIVE_ARCH=NO -project iPhone.xcodeproj -configuration \"Release\" -target \"${FMK_NAME_ORG}\" -sdk iphonesimulator\n\n# Cleaning the oldest.\nif [ -d \"${INSTALL_DIR}\" ]\nthen\nrm -rf \"${INSTALL_DIR}\"\nfi\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${DEVICE_DIR}/Headers/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${DEVICE_DIR}/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Removes the binary and header from the resources folder.\nrm -r \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/Headers\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/${FMK_NAME_ORG}\"\n\n# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.\nlipo -create \"${DEVICE_DIR}/${FMK_NAME_ORG}\" \"${SIMULATOR_DIR}/${FMK_NAME_ORG}\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\nrm -r \"${WRK_DIR}\"\n\n\n"; }; B52D492410DA403A008E8365 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -1136,6 +1118,7 @@ GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "ASIKit-iOS/ASIKit-iOS-Prefix.pch"; @@ -1189,6 +1172,7 @@ ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "ASIKit-iOS/ASIKit-iOS-Prefix.pch"; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -1217,14 +1201,18 @@ AD9C70AD192DFFCA00B6416E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; AD9C70AE192DFFCA00B6416E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; @@ -1334,6 +1322,7 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; @@ -1346,6 +1335,7 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = iphoneos; From 4059061c502311c4876d05f83005f5576aeb2f42 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 28 May 2014 15:25:37 +0800 Subject: [PATCH 15/37] update read me --- ASIKit-iOS/ASIKit-iOS-Info.plist | 46 ++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 ASIKit-iOS/ASIKit-iOS-Info.plist diff --git a/ASIKit-iOS/ASIKit-iOS-Info.plist b/ASIKit-iOS/ASIKit-iOS-Info.plist new file mode 100644 index 00000000..d728ff78 --- /dev/null +++ b/ASIKit-iOS/ASIKit-iOS-Info.plist @@ -0,0 +1,46 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.sina.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + CFPlugInDynamicRegisterFunction + + CFPlugInDynamicRegistration + NO + CFPlugInFactories + + 00000000-0000-0000-0000-000000000000 + MyFactoryFunction + + CFPlugInTypes + + 00000000-0000-0000-0000-000000000000 + + 00000000-0000-0000-0000-000000000000 + + + CFPlugInUnloadFunction + + + + + diff --git a/README.md b/README.md index c8dda1f0..9bac2669 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ ASI-SCS > * 2、选择Link Binary With Libraries,点击“+”,点击“Add Other...”,到工程目录下选择添加ASIKit.Framework (或者将下载好的ASIKit.Framework直接拖到xcode工程里的Frameworks分组下,并在Add to targets里选中你所要关联的target) -> * 3、(对于iOS工程)选择Link Binary With Libraries,点击“+”,添加库:libxml2.dylib,libz.dylib,SystemConfiguration.framework,MobileCoreServices.framework,CFNetwork.framework +> * 3、(对于iOS工程)选择Link Binary With Libraries,点击“+”,添加库:libxml2.dylib,libz.dylib,SystemConfiguration.framework,MobileCoreServices.framework,CFNetwork.framework,CoreGraphics.framework,Foundation.framework,UIKit.framework,CoreFoundation.framework > * 4、在所需文件中添加头:ASIKit/ASIKit.h ```shell From 9226a4482f7b5a45a78717fd570d0da83f81f653 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Tue, 10 Jun 2014 18:04:04 +0800 Subject: [PATCH 16/37] add requestForNextChunk --- Classes/S3/ASIS3BucketRequest.h | 3 +++ Classes/S3/ASIS3BucketRequest.m | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Classes/S3/ASIS3BucketRequest.h b/Classes/S3/ASIS3BucketRequest.h index 70d67bc0..8688f795 100644 --- a/Classes/S3/ASIS3BucketRequest.h +++ b/Classes/S3/ASIS3BucketRequest.h @@ -60,10 +60,13 @@ // Use for deleting buckets - they must be empty for this to succeed + (id)DELETERequestWithBucket:(NSString *)bucket; +- (id)requestForNextChunk; + @property (retain, nonatomic) NSString *bucket; @property (retain, nonatomic) NSString *subResource; @property (retain, nonatomic) NSString *prefix; @property (retain, nonatomic) NSString *marker; +@property (retain, nonatomic) NSString *nextMarker; @property (assign, nonatomic) int maxResultCount; @property (retain, nonatomic) NSString *delimiter; @property (retain, readonly) NSMutableArray *objects; diff --git a/Classes/S3/ASIS3BucketRequest.m b/Classes/S3/ASIS3BucketRequest.m index 9a6b1b5a..6018fec0 100644 --- a/Classes/S3/ASIS3BucketRequest.m +++ b/Classes/S3/ASIS3BucketRequest.m @@ -43,6 +43,28 @@ + (id)requestWithBucket:(NSString *)theBucket subResource:(NSString *)theSubReso return request; } +- (id)requestForNextChunk { + + if (![self isTruncated]) { + return nil; + } + + if (![self nextMarker]) { + return nil; + } + + ASIS3BucketRequest *listRequest = [[[ASIS3BucketRequest alloc] initWithURL:nil] autorelease]; + + [listRequest setBucket:[self bucket]]; + [listRequest setSubResource:[self subResource]]; + [listRequest setPrefix:[self prefix]]; + [listRequest setMaxResultCount:[self maxResultCount]]; + [listRequest setDelimiter:[self delimiter]]; + [listRequest setMarker:[self nextMarker]]; + + return listRequest; +} + + (id)PUTRequestWithBucket:(NSString *)theBucket { ASIS3BucketRequest *request = [self requestWithBucket:theBucket]; @@ -142,6 +164,10 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName names [[self commonPrefixes] addObject:[self currentXMLElementContent]]; } else if ([elementName isEqualToString:@"IsTruncated"]) { [self setIsTruncated:[[self currentXMLElementContent] isEqualToString:@"True"]]; + } else if ([elementName isEqualToString:@"Marker"]) { + [self setMarker:[self currentXMLElementContent]]; + } else if ([elementName isEqualToString:@"NextMarker"]) { + [self setNextMarker:[self currentXMLElementContent]]; } else { // Let ASIS3Request look for error messages [super parser:parser didEndElement:elementName namespaceURI:namespaceURI qualifiedName:qName]; @@ -157,6 +183,7 @@ - (id)copyWithZone:(NSZone *)zone [newRequest setSubResource:[self subResource]]; [newRequest setPrefix:[self prefix]]; [newRequest setMarker:[self marker]]; + [newRequest setNextMarker:[self nextMarker]]; [newRequest setMaxResultCount:[self maxResultCount]]; [newRequest setDelimiter:[self delimiter]]; return newRequest; @@ -169,6 +196,7 @@ - (id)copyWithZone:(NSZone *)zone @synthesize commonPrefixes; @synthesize prefix; @synthesize marker; +@synthesize nextMarker; @synthesize maxResultCount; @synthesize delimiter; @synthesize isTruncated; From a49d37dfd558a9ddaca270942139ce77978a59eb Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Fri, 27 Jun 2014 14:51:32 +0800 Subject: [PATCH 17/37] update for ASIS3Bucket property --- Classes/S3/ASIS3Bucket.h | 3 +++ Classes/S3/ASIS3Bucket.m | 3 ++- Classes/S3/ASIS3ServiceRequest.m | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Classes/S3/ASIS3Bucket.h b/Classes/S3/ASIS3Bucket.h index 70e97cdf..98309595 100644 --- a/Classes/S3/ASIS3Bucket.h +++ b/Classes/S3/ASIS3Bucket.h @@ -23,6 +23,8 @@ // Information about the owner of this bucket NSString *ownerID; NSString *ownerName; + + unsigned long long consumedBytes; } + (id)bucketWithOwnerID:(NSString *)ownerID ownerName:(NSString *)ownerName; @@ -31,4 +33,5 @@ @property (retain) NSDate *creationDate; @property (retain) NSString *ownerID; @property (retain) NSString *ownerName; +@property (assign) unsigned long long consumedBytes; @end diff --git a/Classes/S3/ASIS3Bucket.m b/Classes/S3/ASIS3Bucket.m index eab6194c..1c1ffdab 100644 --- a/Classes/S3/ASIS3Bucket.m +++ b/Classes/S3/ASIS3Bucket.m @@ -30,11 +30,12 @@ - (void)dealloc - (NSString *)description { - return [NSString stringWithFormat:@"Name: %@ creationDate: %@ ownerID: %@ ownerName: %@",[self name],[self creationDate],[self ownerID],[self ownerName]]; + return [NSString stringWithFormat:@"Name: %@ creationDate: %@ ownerID: %@ ownerName: %@ consumedBytes: %llu",[self name],[self creationDate],[self ownerID],[self ownerName],[self consumedBytes]]; } @synthesize name; @synthesize creationDate; @synthesize ownerID; @synthesize ownerName; +@synthesize consumedBytes; @end diff --git a/Classes/S3/ASIS3ServiceRequest.m b/Classes/S3/ASIS3ServiceRequest.m index b261b771..23eeb54b 100644 --- a/Classes/S3/ASIS3ServiceRequest.m +++ b/Classes/S3/ASIS3ServiceRequest.m @@ -70,6 +70,7 @@ - (void)parseResponseJson { ASIS3Bucket *bucket = [ASIS3Bucket bucketWithOwnerID:[self ownerID] ownerName:[self ownerName]]; [bucket setName:[item objectForKey:@"Name"]]; [bucket setCreationDate:[[ASIS3Request S3RequestDateFormatter] dateFromString:[item objectForKey:@"CreationDate"]]]; + [bucket setConsumedBytes:[[item objectForKey:@"ConsumedBytes"] unsignedLongLongValue]]; [[self buckets] addObject:bucket]; } } @@ -102,7 +103,9 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName names [self setOwnerID:[self currentXMLElementContent]]; } else if ([elementName isEqualToString:@"DisplayName"]) { [self setOwnerName:[self currentXMLElementContent]]; - } else { + } else if ([elementName isEqualToString:@"ConsumedBytes"]) { + [[self currentBucket] setConsumedBytes:[[self currentXMLElementContent] longLongValue]]; + }else { // Let ASIS3Request look for error messages [super parser:parser didEndElement:elementName namespaceURI:namespaceURI qualifiedName:qName]; } From 7c0bd294ac58ecfa80bed5c8ebe880e83de6fa78 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Mon, 21 Jul 2014 18:51:23 +0800 Subject: [PATCH 18/37] update --- README.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9bac2669..19fb2412 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,32 @@ ASI-SCS ####相关配置: > * 1、下载ASIKit.Framework(你可以手动下载,链接如下;也可以执行步骤(1)—(4),写脚本由程序自动下载) ->>Mac OS X:http://sdk.sinastorage.com/ASIKit.framework.zip ->>iOS:http://sdk.sinastorage.com/ASIKit-iOS.framework.zip +>> * Mac OS X:http://sdk.sinastorage.com/ASIKit.framework.zip +>> * iOS:http://sdk.sinastorage.com/ASIKit-iOS.framework.zip >> * (1)、打开工程,单击XCode侧边栏中的project行,并选择右侧的Build Phase; >> * (2)、选择项目的Target,在顶部菜单栏选择Editor > Add Build Phase > Add Run Script Build Phase; >> * (3)、设置Run Script(Mac OS X 与 iOS不同)如下; >> * (4)、Commond+B编译工程,会自动下载所需的ASIKit.Framework包到工程目录。 -> * 2、选择Link Binary With Libraries,点击“+”,点击“Add Other...”,到工程目录下选择添加ASIKit.Framework -(或者将下载好的ASIKit.Framework直接拖到xcode工程里的Frameworks分组下,并在Add to targets里选中你所要关联的target) -> * 3、(对于iOS工程)选择Link Binary With Libraries,点击“+”,添加库:libxml2.dylib,libz.dylib,SystemConfiguration.framework,MobileCoreServices.framework,CFNetwork.framework,CoreGraphics.framework,Foundation.framework,UIKit.framework,CoreFoundation.framework +> * 2、添加下载的framework到工程 +>> * 选择Link Binary With Libraries; +>> * 点击“+”; +>> * 点击“Add Other...”,到工程目录下选择添加ASIKit.Framework。 +>> * (或者将下载好的ASIKit.Framework直接拖到xcode工程里的Frameworks分组下;) +>> * (在Add to targets里选中你所要关联的target。) + +> * 3、(对于iOS工程)添加其他依赖库 +>> * 选择Link Binary With Libraries,点击“+”,添加库: +>> * libxml2.dylib +>> * libz.dylib +>> * SystemConfiguration.framework +>> * MobileCoreServices.framework +>> * CFNetwork.framework +>> * CoreGraphics.framework +>> * Foundation.framework +>> * UIKit.framework +>> * CoreFoundation.framework + > * 4、在所需文件中添加头:ASIKit/ASIKit.h ```shell From c68eda371f7b557abc7942a0ccab8c24dedeae85 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 23 Jul 2014 12:08:23 +0800 Subject: [PATCH 19/37] update change host --- Classes/S3/ASIS3Request.m | 2 +- Classes/Tests/ASISCSRequestTests.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index 5585373e..e94188bc 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -325,7 +325,7 @@ + (NSData *)HMACSHA1withKey:(NSString *)key forString:(NSString *)string + (NSString *)S3Host { - return @"sinastorage.com"; + return @"sinastorage.cn"; //return @"s3.amazonaws.com"; } diff --git a/Classes/Tests/ASISCSRequestTests.m b/Classes/Tests/ASISCSRequestTests.m index e72b56c3..558e99ed 100644 --- a/Classes/Tests/ASISCSRequestTests.m +++ b/Classes/Tests/ASISCSRequestTests.m @@ -373,7 +373,7 @@ - (void)testGZippedContent GHAssertTrue(success,@"Failed to GET the correct data from S3"); // Now grab the data using something other than ASIHTTPRequest to ensure other HTTP clients can parse the gzipped content - NSData *data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@.sinastorage.com.com/gzipped-data",bucket]]] returningResponse:NULL error:NULL]; + NSData *data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@.sinastorage.cn/gzipped-data",bucket]]] returningResponse:NULL error:NULL]; NSString *string = [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding] autorelease]; success = [string isEqualToString:text]; GHAssertTrue(success,@"Failed to GET the correct data from S3"); @@ -444,7 +444,7 @@ - (void)testListRequest [listRequest setMarker:@"bar"]; [listRequest setMaxResultCount:5]; [listRequest buildURL]; - NSString *expectedURL = [NSString stringWithFormat:@"http://%@.sinastorage.com/?acl&prefix=foo&marker=bar&delimiter=/&max-keys=5",bucket]; + NSString *expectedURL = [NSString stringWithFormat:@"http://%@.sinastorage.cn/?acl&prefix=foo&marker=bar&delimiter=/&max-keys=5",bucket]; success = ([[[listRequest url] absoluteString] isEqualToString:expectedURL]); GHAssertTrue(success,@"Generated the wrong url when requesting a subresource"); From 4e119a5bc6638a1d76a62a2336175dca53ee8ae0 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 23 Jul 2014 12:13:32 +0800 Subject: [PATCH 20/37] update readme for change host --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 19fb2412..67b6c015 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ ASI-SCS ####相关配置: > * 1、下载ASIKit.Framework(你可以手动下载,链接如下;也可以执行步骤(1)—(4),写脚本由程序自动下载) ->> * Mac OS X:http://sdk.sinastorage.com/ASIKit.framework.zip ->> * iOS:http://sdk.sinastorage.com/ASIKit-iOS.framework.zip +>> * Mac OS X:http://sdk.sinastorage.cn/ASIKit.framework.zip +>> * iOS:http://sdk.sinastorage.cn/ASIKit-iOS.framework.zip >> * (1)、打开工程,单击XCode侧边栏中的project行,并选择右侧的Build Phase; >> * (2)、选择项目的Target,在顶部菜单栏选择Editor > Add Build Phase > Add Run Script Build Phase; >> * (3)、设置Run Script(Mac OS X 与 iOS不同)如下; @@ -50,7 +50,7 @@ if [ ! -e $SRCROOT/ASIKit.framework ]; then mkdir $SRCROOT/ASIKit cd $SRCROOT/ASIKit echo "Downloading ASIKit framework" - curl -s -O http://sdk.sinastorage.com/ASIKit.framework.zip + curl -s -O http://sdk.sinastorage.cn/ASIKit.framework.zip echo "Unzipping ASIKit" unzip ASIKit.framework.zip mv ASIKit.framework $SRCROOT @@ -68,7 +68,7 @@ fi mkdir $SRCROOT/ASIKit cd $SRCROOT/ASIKit echo "Downloading ASIKit-iOS framework" - curl -s -O http://sdk.sinastorage.com/ASIKit-iOS.framework.zip + curl -s -O http://sdk.sinastorage.cn/ASIKit-iOS.framework.zip echo "Unzipping ASIKit-iOS" unzip ASIKit-iOS.framework.zip mv ASIKit.framework $SRCROOT @@ -126,7 +126,7 @@ if ([request error]) { ####Object操作 #####列取object ```objective-c -/*示例为列取http://my-bucket.sinastorage.com/images/jpegs中最多50个object*/ +/*示例为列取http://my-bucket.sinastorage.cn/images/jpegs中最多50个object*/ ASIS3BucketRequest *listRequest = [ASIS3BucketRequest requestWithBucket:@"my-bucket"]; [listRequest setPrefix:@"images/jpegs"]; @@ -140,7 +140,7 @@ if (![listRequest error]) { #####获取object信息 ```objective-c -/*示例为获取http://my-bucket.sinastorage.com/path/to/the/object的object信息*/ +/*示例为获取http://my-bucket.sinastorage.cn/path/to/the/object的object信息*/ NSString *bucket = @"my-bucket"; NSString *path = @"path/to/the/object"; From 4e507042d6ae13a8de085e56cb328589d92f10ba Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 23 Jul 2014 16:19:46 +0800 Subject: [PATCH 21/37] update --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 67b6c015..f7615a22 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,11 @@ ASI-SCS > * 2、添加下载的framework到工程 >> * 选择Link Binary With Libraries; >> * 点击“+”; ->> * 点击“Add Other...”,到工程目录下选择添加ASIKit.Framework。 +>> * 点击“Add Other...”,到工程目录下选择添加ASIKit.Framework; >> * (或者将下载好的ASIKit.Framework直接拖到xcode工程里的Frameworks分组下;) >> * (在Add to targets里选中你所要关联的target。) +>> * 选择Copy Files,设置Destination为Frameworks; +>> * 点击“+”,选择ASIKit.framework。 > * 3、(对于iOS工程)添加其他依赖库 >> * 选择Link Binary With Libraries,点击“+”,添加库: From eeb37d3256d0eb23b4e0e025f61dcad875594f46 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Mon, 18 Aug 2014 17:25:34 +0800 Subject: [PATCH 22/37] update add project SCS-iOS-Demo --- SCS-iOS-Demo.xcodeproj/project.pbxproj | 506 +++++++++ SCS-iOS-Demo/AppDelegate.h | 23 + SCS-iOS-Demo/AppDelegate.m | 62 ++ .../AppIcon.appiconset/Contents.json | 23 + .../LaunchImage.launchimage/Contents.json | 23 + SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.h | 467 +++++++++ SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.m | 987 ++++++++++++++++++ SCS-iOS-Demo/MBProgressHUD/error.png | Bin 0 -> 3499 bytes SCS-iOS-Demo/MBProgressHUD/error@2x.png | Bin 0 -> 3857 bytes SCS-iOS-Demo/MBProgressHUD/success.png | Bin 0 -> 1609 bytes SCS-iOS-Demo/MBProgressHUD/success@2x.png | Bin 0 -> 2156 bytes SCS-iOS-Demo/RootViewController.h | 16 + SCS-iOS-Demo/RootViewController.m | 317 ++++++ SCS-iOS-Demo/SCS-iOS-Demo-Info.plist | 38 + SCS-iOS-Demo/SCS-iOS-Demo-Prefix.pch | 16 + SCS-iOS-Demo/en.lproj/InfoPlist.strings | 2 + SCS-iOS-Demo/main.m | 18 + SCS-iOS-Demo/test.png | Bin 0 -> 8708 bytes 18 files changed, 2498 insertions(+) create mode 100644 SCS-iOS-Demo.xcodeproj/project.pbxproj create mode 100644 SCS-iOS-Demo/AppDelegate.h create mode 100644 SCS-iOS-Demo/AppDelegate.m create mode 100644 SCS-iOS-Demo/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 SCS-iOS-Demo/Images.xcassets/LaunchImage.launchimage/Contents.json create mode 100755 SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.h create mode 100755 SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.m create mode 100755 SCS-iOS-Demo/MBProgressHUD/error.png create mode 100755 SCS-iOS-Demo/MBProgressHUD/error@2x.png create mode 100755 SCS-iOS-Demo/MBProgressHUD/success.png create mode 100755 SCS-iOS-Demo/MBProgressHUD/success@2x.png create mode 100644 SCS-iOS-Demo/RootViewController.h create mode 100644 SCS-iOS-Demo/RootViewController.m create mode 100644 SCS-iOS-Demo/SCS-iOS-Demo-Info.plist create mode 100644 SCS-iOS-Demo/SCS-iOS-Demo-Prefix.pch create mode 100644 SCS-iOS-Demo/en.lproj/InfoPlist.strings create mode 100644 SCS-iOS-Demo/main.m create mode 100644 SCS-iOS-Demo/test.png diff --git a/SCS-iOS-Demo.xcodeproj/project.pbxproj b/SCS-iOS-Demo.xcodeproj/project.pbxproj new file mode 100644 index 00000000..f782d168 --- /dev/null +++ b/SCS-iOS-Demo.xcodeproj/project.pbxproj @@ -0,0 +1,506 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + AD01F5A319A1AED6002BF864 /* error.png in Resources */ = {isa = PBXBuildFile; fileRef = AD01F59D19A1AED6002BF864 /* error.png */; }; + AD01F5A419A1AED6002BF864 /* error@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AD01F59E19A1AED6002BF864 /* error@2x.png */; }; + AD01F5A519A1AED6002BF864 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = AD01F5A019A1AED6002BF864 /* MBProgressHUD.m */; }; + AD01F5A619A1AED6002BF864 /* success.png in Resources */ = {isa = PBXBuildFile; fileRef = AD01F5A119A1AED6002BF864 /* success.png */; }; + AD01F5A719A1AED6002BF864 /* success@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AD01F5A219A1AED6002BF864 /* success@2x.png */; }; + AD01F5A919A1B6DC002BF864 /* test.png in Resources */ = {isa = PBXBuildFile; fileRef = AD01F5A819A1B6DC002BF864 /* test.png */; }; + AD01F65619A1F8C0002BF864 /* ASIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD01F65519A1F8C0002BF864 /* ASIKit.framework */; }; + ADE180B0199C9997001FCD06 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE180AF199C9997001FCD06 /* Foundation.framework */; }; + ADE180B2199C9997001FCD06 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE180B1199C9997001FCD06 /* CoreGraphics.framework */; }; + ADE180B4199C9997001FCD06 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE180B3199C9997001FCD06 /* UIKit.framework */; }; + ADE180BA199C9997001FCD06 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = ADE180B8199C9997001FCD06 /* InfoPlist.strings */; }; + ADE180BC199C9997001FCD06 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ADE180BB199C9997001FCD06 /* main.m */; }; + ADE180C0199C9997001FCD06 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ADE180BF199C9997001FCD06 /* AppDelegate.m */; }; + ADE180C2199C9997001FCD06 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ADE180C1199C9997001FCD06 /* Images.xcassets */; }; + ADE180E2199C9A37001FCD06 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE180E1199C9A37001FCD06 /* libxml2.dylib */; }; + ADE180E4199C9A41001FCD06 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE180E3199C9A41001FCD06 /* libz.dylib */; }; + ADE180E6199C9A4C001FCD06 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE180E5199C9A4C001FCD06 /* SystemConfiguration.framework */; }; + ADE180E8199C9A57001FCD06 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE180E7199C9A57001FCD06 /* MobileCoreServices.framework */; }; + ADE180EA199C9A64001FCD06 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE180E9199C9A64001FCD06 /* CFNetwork.framework */; }; + ADE180EC199C9A71001FCD06 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE180EB199C9A71001FCD06 /* CoreFoundation.framework */; }; + ADE180F2199CA4C3001FCD06 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADE180F1199CA4C3001FCD06 /* RootViewController.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + AD01F64919A1F600002BF864 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AD01F64119A1F5FF002BF864 /* iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1D6058910D05DD3D006BFB54; + remoteInfo = iPhone; + }; + AD01F64B19A1F600002BF864 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AD01F64119A1F5FF002BF864 /* iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = B55B60C70F765BB00064029C; + remoteInfo = Tests; + }; + AD01F64D19A1F600002BF864 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AD01F64119A1F5FF002BF864 /* iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = B576D72311C7F34D0059B815; + remoteInfo = iPad; + }; + AD01F64F19A1F600002BF864 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AD01F64119A1F5FF002BF864 /* iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = AD9C704A192DDA5600B6416E; + remoteInfo = "ASIKit-iOS"; + }; + AD01F65119A1F625002BF864 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AD01F64119A1F5FF002BF864 /* iPhone.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = AD9C70AB192DFFCA00B6416E; + remoteInfo = ASIKit; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + AD01F59D19A1AED6002BF864 /* error.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = error.png; sourceTree = ""; }; + AD01F59E19A1AED6002BF864 /* error@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "error@2x.png"; sourceTree = ""; }; + AD01F59F19A1AED6002BF864 /* MBProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBProgressHUD.h; sourceTree = ""; }; + AD01F5A019A1AED6002BF864 /* MBProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBProgressHUD.m; sourceTree = ""; }; + AD01F5A119A1AED6002BF864 /* success.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = success.png; sourceTree = ""; }; + AD01F5A219A1AED6002BF864 /* success@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "success@2x.png"; sourceTree = ""; }; + AD01F5A819A1B6DC002BF864 /* test.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = test.png; sourceTree = ""; }; + AD01F64119A1F5FF002BF864 /* iPhone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = iPhone.xcodeproj; sourceTree = ""; }; + AD01F65519A1F8C0002BF864 /* ASIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ASIKit.framework; path = Products/ASIKit.framework; sourceTree = ""; }; + ADE180AC199C9997001FCD06 /* SCS-iOS-Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SCS-iOS-Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + ADE180AF199C9997001FCD06 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + ADE180B1199C9997001FCD06 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + ADE180B3199C9997001FCD06 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + ADE180B7199C9997001FCD06 /* SCS-iOS-Demo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SCS-iOS-Demo-Info.plist"; sourceTree = ""; }; + ADE180B9199C9997001FCD06 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + ADE180BB199C9997001FCD06 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + ADE180BD199C9997001FCD06 /* SCS-iOS-Demo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SCS-iOS-Demo-Prefix.pch"; sourceTree = ""; }; + ADE180BE199C9997001FCD06 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + ADE180BF199C9997001FCD06 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + ADE180C1199C9997001FCD06 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + ADE180C8199C9997001FCD06 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + ADE180E1199C9A37001FCD06 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; + ADE180E3199C9A41001FCD06 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + ADE180E5199C9A4C001FCD06 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + ADE180E7199C9A57001FCD06 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; + ADE180E9199C9A64001FCD06 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; + ADE180EB199C9A71001FCD06 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + ADE180F0199CA4C3001FCD06 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; + ADE180F1199CA4C3001FCD06 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + ADE180A9199C9997001FCD06 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + AD01F65619A1F8C0002BF864 /* ASIKit.framework in Frameworks */, + ADE180EC199C9A71001FCD06 /* CoreFoundation.framework in Frameworks */, + ADE180EA199C9A64001FCD06 /* CFNetwork.framework in Frameworks */, + ADE180E8199C9A57001FCD06 /* MobileCoreServices.framework in Frameworks */, + ADE180E6199C9A4C001FCD06 /* SystemConfiguration.framework in Frameworks */, + ADE180E4199C9A41001FCD06 /* libz.dylib in Frameworks */, + ADE180E2199C9A37001FCD06 /* libxml2.dylib in Frameworks */, + ADE180B2199C9997001FCD06 /* CoreGraphics.framework in Frameworks */, + ADE180B4199C9997001FCD06 /* UIKit.framework in Frameworks */, + ADE180B0199C9997001FCD06 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + AD01F59C19A1AED6002BF864 /* MBProgressHUD */ = { + isa = PBXGroup; + children = ( + AD01F59D19A1AED6002BF864 /* error.png */, + AD01F59E19A1AED6002BF864 /* error@2x.png */, + AD01F59F19A1AED6002BF864 /* MBProgressHUD.h */, + AD01F5A019A1AED6002BF864 /* MBProgressHUD.m */, + AD01F5A119A1AED6002BF864 /* success.png */, + AD01F5A219A1AED6002BF864 /* success@2x.png */, + ); + path = MBProgressHUD; + sourceTree = ""; + }; + AD01F64219A1F5FF002BF864 /* Products */ = { + isa = PBXGroup; + children = ( + AD01F64A19A1F600002BF864 /* ASIHTTPRequest iPhone.app */, + AD01F64C19A1F600002BF864 /* Tests.app */, + AD01F64E19A1F600002BF864 /* ASIHTTPRequest iPad.app */, + AD01F65019A1F600002BF864 /* ASIKit-iOS.framework */, + ); + name = Products; + sourceTree = ""; + }; + ADE180A3199C9997001FCD06 = { + isa = PBXGroup; + children = ( + AD01F64119A1F5FF002BF864 /* iPhone.xcodeproj */, + ADE180B5199C9997001FCD06 /* SCS-iOS-Demo */, + ADE180AE199C9997001FCD06 /* Frameworks */, + ADE180AD199C9997001FCD06 /* Products */, + ); + sourceTree = ""; + }; + ADE180AD199C9997001FCD06 /* Products */ = { + isa = PBXGroup; + children = ( + ADE180AC199C9997001FCD06 /* SCS-iOS-Demo.app */, + ); + name = Products; + sourceTree = ""; + }; + ADE180AE199C9997001FCD06 /* Frameworks */ = { + isa = PBXGroup; + children = ( + AD01F65519A1F8C0002BF864 /* ASIKit.framework */, + ADE180EB199C9A71001FCD06 /* CoreFoundation.framework */, + ADE180E9199C9A64001FCD06 /* CFNetwork.framework */, + ADE180E7199C9A57001FCD06 /* MobileCoreServices.framework */, + ADE180E5199C9A4C001FCD06 /* SystemConfiguration.framework */, + ADE180E3199C9A41001FCD06 /* libz.dylib */, + ADE180E1199C9A37001FCD06 /* libxml2.dylib */, + ADE180AF199C9997001FCD06 /* Foundation.framework */, + ADE180B1199C9997001FCD06 /* CoreGraphics.framework */, + ADE180B3199C9997001FCD06 /* UIKit.framework */, + ADE180C8199C9997001FCD06 /* XCTest.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + ADE180B5199C9997001FCD06 /* SCS-iOS-Demo */ = { + isa = PBXGroup; + children = ( + AD01F59C19A1AED6002BF864 /* MBProgressHUD */, + ADE180BE199C9997001FCD06 /* AppDelegate.h */, + ADE180BF199C9997001FCD06 /* AppDelegate.m */, + ADE180F0199CA4C3001FCD06 /* RootViewController.h */, + ADE180F1199CA4C3001FCD06 /* RootViewController.m */, + ADE180B6199C9997001FCD06 /* Supporting Files */, + ); + path = "SCS-iOS-Demo"; + sourceTree = ""; + }; + ADE180B6199C9997001FCD06 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + AD01F5A819A1B6DC002BF864 /* test.png */, + ADE180C1199C9997001FCD06 /* Images.xcassets */, + ADE180B7199C9997001FCD06 /* SCS-iOS-Demo-Info.plist */, + ADE180B8199C9997001FCD06 /* InfoPlist.strings */, + ADE180BB199C9997001FCD06 /* main.m */, + ADE180BD199C9997001FCD06 /* SCS-iOS-Demo-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + ADE180AB199C9997001FCD06 /* SCS-iOS-Demo */ = { + isa = PBXNativeTarget; + buildConfigurationList = ADE180D8199C9997001FCD06 /* Build configuration list for PBXNativeTarget "SCS-iOS-Demo" */; + buildPhases = ( + ADE180A8199C9997001FCD06 /* Sources */, + ADE180A9199C9997001FCD06 /* Frameworks */, + ADE180AA199C9997001FCD06 /* Resources */, + ADE180DE199C99C9001FCD06 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + AD01F65219A1F625002BF864 /* PBXTargetDependency */, + ); + name = "SCS-iOS-Demo"; + productName = "SCS-iOS-Demo"; + productReference = ADE180AC199C9997001FCD06 /* SCS-iOS-Demo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + ADE180A4199C9997001FCD06 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0510; + ORGANIZATIONNAME = Littlebox222; + }; + buildConfigurationList = ADE180A7199C9997001FCD06 /* Build configuration list for PBXProject "SCS-iOS-Demo" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = ADE180A3199C9997001FCD06; + productRefGroup = ADE180AD199C9997001FCD06 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = AD01F64219A1F5FF002BF864 /* Products */; + ProjectRef = AD01F64119A1F5FF002BF864 /* iPhone.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + ADE180AB199C9997001FCD06 /* SCS-iOS-Demo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + AD01F64A19A1F600002BF864 /* ASIHTTPRequest iPhone.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = "ASIHTTPRequest iPhone.app"; + remoteRef = AD01F64919A1F600002BF864 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AD01F64C19A1F600002BF864 /* Tests.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = Tests.app; + remoteRef = AD01F64B19A1F600002BF864 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AD01F64E19A1F600002BF864 /* ASIHTTPRequest iPad.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = "ASIHTTPRequest iPad.app"; + remoteRef = AD01F64D19A1F600002BF864 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AD01F65019A1F600002BF864 /* ASIKit-iOS.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "ASIKit-iOS.framework"; + remoteRef = AD01F64F19A1F600002BF864 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + ADE180AA199C9997001FCD06 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ADE180BA199C9997001FCD06 /* InfoPlist.strings in Resources */, + ADE180C2199C9997001FCD06 /* Images.xcassets in Resources */, + AD01F5A919A1B6DC002BF864 /* test.png in Resources */, + AD01F5A719A1AED6002BF864 /* success@2x.png in Resources */, + AD01F5A619A1AED6002BF864 /* success.png in Resources */, + AD01F5A319A1AED6002BF864 /* error.png in Resources */, + AD01F5A419A1AED6002BF864 /* error@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + ADE180DE199C99C9001FCD06 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = ""; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + ADE180A8199C9997001FCD06 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ADE180C0199C9997001FCD06 /* AppDelegate.m in Sources */, + ADE180BC199C9997001FCD06 /* main.m in Sources */, + ADE180F2199CA4C3001FCD06 /* RootViewController.m in Sources */, + AD01F5A519A1AED6002BF864 /* MBProgressHUD.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + AD01F65219A1F625002BF864 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ASIKit; + targetProxy = AD01F65119A1F625002BF864 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + ADE180B8199C9997001FCD06 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + ADE180B9199C9997001FCD06 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + ADE180D6199C9997001FCD06 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + 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_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + ADE180D7199C9997001FCD06 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + ADE180D9199C9997001FCD06 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ENABLE_OBJC_ARC = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + "$(PROJECT_DIR)/Products", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "SCS-iOS-Demo/SCS-iOS-Demo-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/asi-scs/**", + ); + INFOPLIST_FILE = "SCS-iOS-Demo/SCS-iOS-Demo-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + ADE180DA199C9997001FCD06 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ENABLE_OBJC_ARC = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + "$(PROJECT_DIR)/Products", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "SCS-iOS-Demo/SCS-iOS-Demo-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/asi-scs/**", + ); + INFOPLIST_FILE = "SCS-iOS-Demo/SCS-iOS-Demo-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + ADE180A7199C9997001FCD06 /* Build configuration list for PBXProject "SCS-iOS-Demo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ADE180D6199C9997001FCD06 /* Debug */, + ADE180D7199C9997001FCD06 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + ADE180D8199C9997001FCD06 /* Build configuration list for PBXNativeTarget "SCS-iOS-Demo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ADE180D9199C9997001FCD06 /* Debug */, + ADE180DA199C9997001FCD06 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = ADE180A4199C9997001FCD06 /* Project object */; +} diff --git a/SCS-iOS-Demo/AppDelegate.h b/SCS-iOS-Demo/AppDelegate.h new file mode 100644 index 00000000..8c2706b5 --- /dev/null +++ b/SCS-iOS-Demo/AppDelegate.h @@ -0,0 +1,23 @@ +// +// AppDelegate.h +// SCS-iOS-Demo +// +// Created by Littlebox222 on 14-8-14. +// Copyright (c) 2014年 Littlebox222. All rights reserved. +// + +#import +#import + +#define kAccessKey @"YOUR ACCESSKEY" +#define kSecretKey @"YOUR SECRETKEY" + + + +#define kUserTestBucketCreate @"test-create" + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/SCS-iOS-Demo/AppDelegate.m b/SCS-iOS-Demo/AppDelegate.m new file mode 100644 index 00000000..6118c962 --- /dev/null +++ b/SCS-iOS-Demo/AppDelegate.m @@ -0,0 +1,62 @@ +// +// AppDelegate.m +// SCS-iOS-Demo +// +// Created by Littlebox222 on 14-8-14. +// Copyright (c) 2014年 Littlebox222. All rights reserved. +// + +#import "AppDelegate.h" +#import "RootViewController.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + self.window.backgroundColor = [UIColor whiteColor]; + + if ([kAccessKey isEqualToString:@"YOUR ACCESSKEY"] || [kSecretKey isEqualToString:@"YOUR SECRETKEY"]) { + + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"错误" message:@"请在AppDelegate.h中填写您的accessKey与secretKey" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; + [alert show]; + [alert release]; + + }else { + RootViewController *rootViewController = [[[RootViewController alloc] initWithStyle:UITableViewStylePlain] autorelease]; + rootViewController.title = @"操作结果见控制台"; + UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:rootViewController] autorelease]; + [self.window setRootViewController:nav]; + } + + + [self.window makeKeyAndVisible]; + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + +} + +@end diff --git a/SCS-iOS-Demo/Images.xcassets/AppIcon.appiconset/Contents.json b/SCS-iOS-Demo/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..a396706d --- /dev/null +++ b/SCS-iOS-Demo/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SCS-iOS-Demo/Images.xcassets/LaunchImage.launchimage/Contents.json b/SCS-iOS-Demo/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 00000000..c79ebd3a --- /dev/null +++ b/SCS-iOS-Demo/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "subtype" : "retina4", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.h b/SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.h new file mode 100755 index 00000000..b701d7fc --- /dev/null +++ b/SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.h @@ -0,0 +1,467 @@ +// +// MBProgressHUD.h +// Version 0.5 +// Created by Matej Bukovinski on 2.4.09. +// + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2011 Matej Bukovinski +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import +#import + +@protocol MBProgressHUDDelegate; + + +typedef enum { + /** Progress is shown using an UIActivityIndicatorView. This is the default. */ + MBProgressHUDModeIndeterminate, + /** Progress is shown using a round, pie-chart like, progress view. */ + MBProgressHUDModeDeterminate, + /** Progress is shown using a ring-shaped progress view. */ + MBProgressHUDModeAnnularDeterminate, + /** Shows a custom view */ + MBProgressHUDModeCustomView, + /** Shows only labels */ + MBProgressHUDModeText, + /**show a error view**/ + MBProgressHUDModeError, + /**show a right view **/ + MBProgressHUDModeSuccess +} MBProgressHUDMode; + +typedef enum { + /** Opacity animation */ + MBProgressHUDAnimationFade, + /** Opacity + scale animation */ + MBProgressHUDAnimationZoom, + MBProgressHUDAnimationZoomOut = MBProgressHUDAnimationZoom, + MBProgressHUDAnimationZoomIn +} MBProgressHUDAnimation; + + +#ifndef MB_STRONG +#if __has_feature(objc_arc) + #define MB_STRONG strong +#else + #define MB_STRONG retain +#endif +#endif + +#ifndef MB_WEAK +#if __has_feature(objc_arc_weak) + #define MB_WEAK weak +#elif __has_feature(objc_arc) + #define MB_WEAK unsafe_unretained +#else + #define MB_WEAK assign +#endif +#endif + +#if NS_BLOCKS_AVAILABLE +typedef void (^MBProgressHUDCompletionBlock)(); +#endif + + + + +/** + * Displays a simple HUD window containing a progress indicator and two optional labels for short messages. + * + * This is a simple drop-in class for displaying a progress HUD view similar to Apple's private UIProgressHUD class. + * The MBProgressHUD window spans over the entire space given to it by the initWithFrame constructor and catches all + * user input on this region, thereby preventing the user operations on components below the view. The HUD itself is + * drawn centered as a rounded semi-transparent view which resizes depending on the user specified content. + * + * This view supports four modes of operation: + * - MBProgressHUDModeIndeterminate - shows a UIActivityIndicatorView + * - MBProgressHUDModeDeterminate - shows a custom round progress indicator + * - MBProgressHUDModeAnnularDeterminate - shows a custom annular progress indicator + * - MBProgressHUDModeCustomView - shows an arbitrary, user specified view (@see customView) + * + * All three modes can have optional labels assigned: + * - If the labelText property is set and non-empty then a label containing the provided content is placed below the + * indicator view. + * - If also the detailsLabelText property is set then another label is placed below the first label. + */ +@interface MBProgressHUD : UIView + +/** + * Creates a new custom HUD + + */ + ++(MBProgressHUD *)showHUDAddedTo:(UIView *)view text:(NSString *)text; + ++(MBProgressHUD *)showSuccessHUDAddedTo:(UIView *)view text:(NSString *)text duration:(NSTimeInterval)duration; + ++(MBProgressHUD *)showErrorHUDAddedTo:(UIView *)view text:(NSString *)text duration:(NSTimeInterval)duration; + ++(MBProgressHUD *)showHUDAddedTo:(UIView *)view text:(NSString *)text mode:(MBProgressHUDMode)mode afterDelay:(NSTimeInterval)seconds; + +/** + * Creates a new HUD, adds it to provided view and shows it. The counterpart to this method is hideHUDForView:animated:. + * + * @param view The view that the HUD will be added to + * @param animated If set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use + * animations while appearing. + * @return A reference to the created HUD. + * + * @see hideHUDForView:animated: + * @see animationType + */ ++ (MBProgressHUD *)showHUDAddedTo:(UIView *)view animated:(BOOL)animated; + +/** + add hidehud + **/ ++ (BOOL)hideHUDForView:(UIView *)view; + +/** + * Finds the top-most HUD subview and hides it. The counterpart to this method is showHUDAddedTo:animated:. + * + * @param view The view that is going to be searched for a HUD subview. + * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use + * animations while disappearing. + * @return YES if a HUD was found and removed, NO otherwise. + * + * @see showHUDAddedTo:animated: + * @see animationType + */ ++ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated; + +/** + * Finds all the HUD subviews and hides them. + * + * @param view The view that is going to be searched for HUD subviews. + * @param animated If set to YES the HUDs will disappear using the current animationType. If set to NO the HUDs will not use + * animations while disappearing. + * @return the number of HUDs found and removed. + * + * @see hideAllHUDForView:animated: + * @see animationType + */ ++ (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated; + +/** + * Finds the top-most HUD subview and returns it. + * + * @param view The view that is going to be searched. + * @return A reference to the last HUD subview discovered. + */ ++ (MBProgressHUD *)HUDForView:(UIView *)view; + +/** + * Finds all HUD subviews and returns them. + * + * @param view The view that is going to be searched. + * @return All found HUD views (array of MBProgressHUD objects). + */ ++ (NSArray *)allHUDsForView:(UIView *)view; + +/** + * A convenience constructor that initializes the HUD with the window's bounds. Calls the designated constructor with + * window.bounds as the parameter. + * + * @param window The window instance that will provide the bounds for the HUD. Should be the same instance as + * the HUD's superview (i.e., the window that the HUD will be added to). + */ +- (id)initWithWindow:(UIWindow *)window; + +/** + * A convenience constructor that initializes the HUD with the view's bounds. Calls the designated constructor with + * view.bounds as the parameter + * + * @param view The view instance that will provide the bounds for the HUD. Should be the same instance as + * the HUD's superview (i.e., the view that the HUD will be added to). + */ +- (id)initWithView:(UIView *)view; + +/** + * Display the HUD. You need to make sure that the main thread completes its run loop soon after this method call so + * the user interface can be updated. Call this method when your task is already set-up to be executed in a new thread + * (e.g., when using something like NSOperation or calling an asynchronous call like NSURLRequest). + * + * @param animated If set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use + * animations while appearing. + * + * @see animationType + */ +- (void)show:(BOOL)animated; + +/** + * Hide the HUD. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to + * hide the HUD when your task completes. + * + * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use + * animations while disappearing. + * + * @see animationType + */ +- (void)hide:(BOOL)animated; + +/** + * Hide the HUD after a delay. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to + * hide the HUD when your task completes. + * + * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use + * animations while disappearing. + * @param delay Delay in secons until the HUD is hidden. + * + * @see animationType + */ +- (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay; + +/** + * Shows the HUD while a background task is executing in a new thread, then hides the HUD. + * + * This method also takes care of autorelease pools so your method does not have to be concerned with setting up a + * pool. + * + * @param method The method to be executed while the HUD is shown. This method will be executed in a new thread. + * @param target The object that the target method belongs to. + * @param object An optional object to be passed to the method. + * @param animated If set to YES the HUD will (dis)appear using the current animationType. If set to NO the HUD will not use + * animations while (dis)appearing. + */ +- (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated; + +#if NS_BLOCKS_AVAILABLE + +/** + * Shows the HUD while a block is executing on a background queue, then hides the HUD. + * + * @see showAnimated:whileExecutingBlock:onQueue:completion: + */ +- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block; + +/** + * Shows the HUD while a block is executing on a background queue, then hides the HUD. + * + * @see showAnimated:whileExecutingBlock:onQueue:completion: + */ +- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(MBProgressHUDCompletionBlock)completion; + +/** + * Shows the HUD while a block is executing on the specified dispatch queue, then hides the HUD. + * + * @see showAnimated:whileExecutingBlock:onQueue:completion: + */ +- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue; + +/** + * Shows the HUD while a block is executing on the specified dispatch queue, executes completion block on the main queue, and then hides the HUD. + * + * @param animated If set to YES the HUD will (dis)appear using the current animationType. If set to NO the HUD will + * not use animations while (dis)appearing. + * @param block The block to be executed while the HUD is shown. + * @param queue The dispatch queue on which the block should be execouted. + * @param completion The block to be executed on completion. + * + * @see completionBlock + */ +- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue + completionBlock:(MBProgressHUDCompletionBlock)completion; + +/** + * A block that gets called after the HUD was completely hiden. + */ +@property (atomic, copy) MBProgressHUDCompletionBlock completionBlock; + +#endif + +/** + * MBProgressHUD operation mode. The default is MBProgressHUDModeIndeterminate. + * + * @see MBProgressHUDMode + */ +@property (atomic, assign) MBProgressHUDMode mode; + +/** + * The animation type that should be used when the HUD is shown and hidden. + * + * @see MBProgressHUDAnimation + */ +@property (atomic, assign) MBProgressHUDAnimation animationType; + +/** + * The UIView (e.g., a UIImageView) to be shown when the HUD is in MBProgressHUDModeCustomView. + * For best results use a 37 by 37 pixel view (so the bounds match the built in indicator bounds). + */ +@property (atomic, MB_STRONG) UIView *customView; + +/** + * The HUD delegate object. + * + * @see MBProgressHUDDelegate + */ +@property (atomic, MB_WEAK) id delegate; + +/** + * An optional short message to be displayed below the activity indicator. The HUD is automatically resized to fit + * the entire text. If the text is too long it will get clipped by displaying "..." at the end. If left unchanged or + * set to @"", then no message is displayed. + */ +@property (atomic, copy) NSString *labelText; + +/** + * An optional details message displayed below the labelText message. This message is displayed only if the labelText + * property is also set and is different from an empty string (@""). The details text can span multiple lines. + */ +@property (atomic, copy) NSString *detailsLabelText; + +/** + * The opacity of the HUD window. Defaults to 0.8 (80% opacity). + */ +@property (atomic, assign) float opacity; + +/** + * The color of the HUD window. Defaults to black. If this property is set, color is set using + * this UIColor and the opacity property is not used. using retain because performing copy on + * UIColor base colors (like [UIColor greenColor]) cause problems with the copyZone. + */ +@property (atomic, MB_STRONG) UIColor *color; + +/** + * The x-axis offset of the HUD relative to the centre of the superview. + */ +@property (atomic, assign) float xOffset; + +/** + * The y-ayis offset of the HUD relative to the centre of the superview. + */ +@property (atomic, assign) float yOffset; + +/** + * The amounth of space between the HUD edge and the HUD elements (labels, indicators or custom views). + * Defaults to 20.0 + */ +@property (atomic, assign) float margin; + +/** + * Cover the HUD background view with a radial gradient. + */ +@property (atomic, assign) BOOL dimBackground; + +/* + * Grace period is the time (in seconds) that the invoked method may be run without + * showing the HUD. If the task finishes before the grace time runs out, the HUD will + * not be shown at all. + * This may be used to prevent HUD display for very short tasks. + * Defaults to 0 (no grace time). + * Grace time functionality is only supported when the task status is known! + * @see taskInProgress + */ +@property (atomic, assign) float graceTime; + +/** + * The minimum time (in seconds) that the HUD is shown. + * This avoids the problem of the HUD being shown and than instantly hidden. + * Defaults to 0 (no minimum show time). + */ +@property (atomic, assign) float minShowTime; + +/** + * Indicates that the executed operation is in progress. Needed for correct graceTime operation. + * If you don't set a graceTime (different than 0.0) this does nothing. + * This property is automatically set when using showWhileExecuting:onTarget:withObject:animated:. + * When threading is done outside of the HUD (i.e., when the show: and hide: methods are used directly), + * you need to set this property when your task starts and completes in order to have normal graceTime + * functionality. + */ +@property (atomic, assign) BOOL taskInProgress; + +/** + * Removes the HUD from its parent view when hidden. + * Defaults to NO. + */ +@property (atomic, assign) BOOL removeFromSuperViewOnHide; + +/** + * Font to be used for the main label. Set this property if the default is not adequate. + */ +@property (atomic, MB_STRONG) UIFont* labelFont; + +/** + * Font to be used for the details label. Set this property if the default is not adequate. + */ +@property (atomic, MB_STRONG) UIFont* detailsLabelFont; + +/** + * The progress of the progress indicator, from 0.0 to 1.0. Defaults to 0.0. + */ +@property (atomic, assign) float progress; + +/** + * The minimum size of the HUD bezel. Defaults to CGSizeZero (no minimum size). + */ +@property (atomic, assign) CGSize minSize; + +/** + * Force the HUD dimensions to be equal if possible. + */ +@property (atomic, assign, getter = isSquare) BOOL square; + +@end + + +@protocol MBProgressHUDDelegate + +@optional + +/** + * Called after the HUD was fully hidden from the screen. + */ +- (void)hudWasHidden:(MBProgressHUD *)hud; + +@end + + +/** + * A progress view for showing definite progress by filling up a circle (pie chart). + */ +@interface MBRoundProgressView : UIView + +/** + * Progress (0.0 to 1.0) + */ +@property (nonatomic, assign) float progress; + +/* + * Display mode - NO = round or YES = annular. Defaults to round. + */ +@property (nonatomic, assign, getter = isAnnular) BOOL annular; + +@end + +@interface MBRoundProgressErrorView : UIView + +@property (nonatomic, retain) UIImageView *errorView; + +@end + +@interface MBRoundProgressSuccessView : UIView + +@property (nonatomic, retain) UIImageView *successView; + +@end \ No newline at end of file diff --git a/SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.m b/SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.m new file mode 100755 index 00000000..e50fab9e --- /dev/null +++ b/SCS-iOS-Demo/MBProgressHUD/MBProgressHUD.m @@ -0,0 +1,987 @@ +// +// MBProgressHUD.m +// Version 0.5 +// Created by Matej Bukovinski on 2.4.09. +// + +#import "MBProgressHUD.h" + + +#if __has_feature(objc_arc) + #define MB_AUTORELEASE(exp) exp + #define MB_RELEASE(exp) exp + #define MB_RETAIN(exp) exp +#else + #define MB_AUTORELEASE(exp) [exp autorelease] + #define MB_RELEASE(exp) [exp release] + #define MB_RETAIN(exp) [exp retain] +#endif + + +static const CGFloat kPadding = 4.f; +static const CGFloat kLabelFontSize = 16.f; +static const CGFloat kDetailsLabelFontSize = 12.f; + + +@interface MBProgressHUD () + +- (void)setupLabels; +- (void)registerForKVO; +- (void)unregisterFromKVO; +- (NSArray *)observableKeypaths; +- (void)registerForNotifications; +- (void)unregisterFromNotifications; +- (void)updateUIForKeypath:(NSString *)keyPath; +- (void)hideUsingAnimation:(BOOL)animated; +- (void)showUsingAnimation:(BOOL)animated; +- (void)done; +- (void)updateIndicators; +- (void)handleGraceTimer:(NSTimer *)theTimer; +- (void)handleMinShowTimer:(NSTimer *)theTimer; +- (void)setTransformForCurrentOrientation:(BOOL)animated; +- (void)cleanUp; +- (void)launchExecution; +- (void)deviceOrientationDidChange:(NSNotification *)notification; +- (void)hideDelayed:(NSNumber *)animated; + +@property (atomic, MB_STRONG) UIView *indicator; +@property (atomic, MB_STRONG) NSTimer *graceTimer; +@property (atomic, MB_STRONG) NSTimer *minShowTimer; +@property (atomic, MB_STRONG) NSDate *showStarted; +@property (atomic, assign) CGSize size; + +@end + + +@implementation MBProgressHUD { + BOOL useAnimation; + SEL methodForExecution; + id targetForExecution; + id objectForExecution; + UILabel *label; + UILabel *detailsLabel; + BOOL isFinished; + CGAffineTransform rotationTransform; +} + +#pragma mark - Properties + +@synthesize animationType; +@synthesize delegate; +@synthesize opacity; +@synthesize color; +@synthesize labelFont; +@synthesize detailsLabelFont; +@synthesize indicator; +@synthesize xOffset; +@synthesize yOffset; +@synthesize minSize; +@synthesize square; +@synthesize margin; +@synthesize dimBackground; +@synthesize graceTime; +@synthesize minShowTime; +@synthesize graceTimer; +@synthesize minShowTimer; +@synthesize taskInProgress; +@synthesize removeFromSuperViewOnHide; +@synthesize customView; +@synthesize showStarted; +@synthesize mode; +@synthesize labelText; +@synthesize detailsLabelText; +@synthesize progress; +@synthesize size; +#if NS_BLOCKS_AVAILABLE +@synthesize completionBlock; +#endif + +#pragma mark - Class methods + ++(MBProgressHUD *)showHUDAddedTo:(UIView *)view text:(NSString *)text +{ + return [MBProgressHUD showHUDAddedTo:view text:text mode:MBProgressHUDModeIndeterminate afterDelay:0]; +} + ++(MBProgressHUD *)showSuccessHUDAddedTo:(UIView *)view text:(NSString *)text duration:(NSTimeInterval)duration +{ + [MBProgressHUD hideHUDForView:view]; + return [MBProgressHUD showHUDAddedTo:view text:text mode:MBProgressHUDModeSuccess afterDelay:duration]; +} + ++(MBProgressHUD *)showErrorHUDAddedTo:(UIView *)view text:(NSString *)text duration:(NSTimeInterval)duration +{ + [MBProgressHUD hideHUDForView:view]; + return [MBProgressHUD showHUDAddedTo:view text:text mode:MBProgressHUDModeError afterDelay:duration]; +} + ++(MBProgressHUD *)showHUDAddedTo:(UIView *)view text:(NSString *)text mode:(MBProgressHUDMode)mode afterDelay:(NSTimeInterval)seconds +{ + return [MBProgressHUD showHUDAddedTo:view text:text mode:mode afterDelay:seconds animated:YES]; +} ++(MBProgressHUD *)showHUDAddedTo:(UIView *)view text:(NSString *)text mode:(MBProgressHUDMode)mode afterDelay:(NSTimeInterval)seconds animated:(BOOL)animated +{ + MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view]; + hud.labelText = text; + hud.labelFont = [UIFont boldSystemFontOfSize:16.0]; + hud.animationType = MBProgressHUDAnimationFade; + hud.mode = mode; + [view addSubview:hud]; + [hud show:animated]; + if (seconds>0) { + [NSTimer scheduledTimerWithTimeInterval:seconds target:self selector:@selector(hideView:) userInfo:view repeats:NO]; + } + + return MB_AUTORELEASE(hud); +} + ++ (MBProgressHUD *)showHUDAddedTo:(UIView *)view animated:(BOOL)animated { + MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view]; + [view addSubview:hud]; + [hud show:animated]; + return MB_AUTORELEASE(hud); +} + ++ (BOOL)hideView:(NSTimer *)theTimer +{ + return [MBProgressHUD hideAllHUDsForView:theTimer.userInfo animated:YES]; +} + ++ (BOOL)hideHUDForView:(UIView *)view +{ + return [MBProgressHUD hideHUDForView:view animated:YES]; +} + ++ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated { + MBProgressHUD *hud = [MBProgressHUD HUDForView:view]; + if (hud != nil) { + hud.removeFromSuperViewOnHide = YES; + [hud hide:animated]; + return YES; + } + return NO; +} + ++ (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated { + NSArray *huds = [self allHUDsForView:view]; + for (MBProgressHUD *hud in huds) { + hud.removeFromSuperViewOnHide = YES; + [hud hide:animated]; + } + return [huds count]; +} + ++ (MBProgressHUD *)HUDForView:(UIView *)view { + MBProgressHUD *hud = nil; + NSArray *subviews = view.subviews; + Class hudClass = [MBProgressHUD class]; + for (UIView *aView in subviews) { + if ([aView isKindOfClass:hudClass]) { + hud = (MBProgressHUD *)aView; + } + } + return hud; +} + ++ (NSArray *)allHUDsForView:(UIView *)view { + NSMutableArray *huds = [NSMutableArray array]; + NSArray *subviews = view.subviews; + Class hudClass = [MBProgressHUD class]; + for (UIView *aView in subviews) { + if ([aView isKindOfClass:hudClass]) { + [huds addObject:aView]; + } + } + return [NSArray arrayWithArray:huds]; +} + +#pragma mark - Lifecycle + +- (id)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + // Set default values for properties + self.animationType = MBProgressHUDAnimationFade; + self.mode = MBProgressHUDModeIndeterminate; + self.labelText = nil; + self.detailsLabelText = nil; + self.opacity = 0.8f; + self.color = nil; + self.labelFont = [UIFont boldSystemFontOfSize:kLabelFontSize]; + self.detailsLabelFont = [UIFont boldSystemFontOfSize:kDetailsLabelFontSize]; + self.xOffset = 0.0f; + self.yOffset = 0.0f; + self.dimBackground = NO; + self.margin = 20.0f; + self.graceTime = 0.0f; + self.minShowTime = 0.0f; + self.removeFromSuperViewOnHide = NO; + self.minSize = CGSizeZero; + self.square = NO; + self.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin + | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; + + // Transparent background + self.opaque = NO; + self.backgroundColor = [UIColor clearColor]; + // Make it invisible for now + self.alpha = 0.0f; + + taskInProgress = NO; + rotationTransform = CGAffineTransformIdentity; + + [self setupLabels]; + [self updateIndicators]; + [self registerForKVO]; + [self registerForNotifications]; + } + return self; +} + +- (id)initWithView:(UIView *)view { + id me = [self initWithFrame:view.bounds]; + // We need to take care of rotation ourselfs if we're adding the HUD to a window + if ([view isKindOfClass:[UIWindow class]]) { + [self setTransformForCurrentOrientation:NO]; + } + return me; +} + +- (id)initWithWindow:(UIWindow *)window { + return [self initWithView:window]; +} + +- (void)dealloc { + [self unregisterFromNotifications]; + [self unregisterFromKVO]; +#if !__has_feature(objc_arc) + [color release]; + [indicator release]; + [label release]; + [detailsLabel release]; + [labelText release]; + [detailsLabelText release]; + [graceTimer release]; + [minShowTimer release]; + [showStarted release]; + [customView release]; +#if NS_BLOCKS_AVAILABLE + [completionBlock release]; +#endif + [super dealloc]; +#endif +} + +#pragma mark - Show & hide + +- (void)show:(BOOL)animated { + useAnimation = animated; + // If the grace time is set postpone the HUD display + if (self.graceTime > 0.0) { + self.graceTimer = [NSTimer scheduledTimerWithTimeInterval:self.graceTime target:self + selector:@selector(handleGraceTimer:) userInfo:nil repeats:NO]; + } + // ... otherwise show the HUD imediately + else { + [self setNeedsDisplay]; + [self showUsingAnimation:useAnimation]; + } +} + +- (void)hide:(BOOL)animated { + useAnimation = animated; + // If the minShow time is set, calculate how long the hud was shown, + // and pospone the hiding operation if necessary + if (self.minShowTime > 0.0 && showStarted) { + NSTimeInterval interv = [[NSDate date] timeIntervalSinceDate:showStarted]; + if (interv < self.minShowTime) { + self.minShowTimer = [NSTimer scheduledTimerWithTimeInterval:(self.minShowTime - interv) target:self + selector:@selector(handleMinShowTimer:) userInfo:nil repeats:NO]; + return; + } + } + // ... otherwise hide the HUD immediately + [self hideUsingAnimation:useAnimation]; +} + +- (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay { + [self performSelector:@selector(hideDelayed:) withObject:[NSNumber numberWithBool:animated] afterDelay:delay]; +} + +- (void)hideDelayed:(NSNumber *)animated { + [self hide:[animated boolValue]]; +} + +#pragma mark - Timer callbacks + +- (void)handleGraceTimer:(NSTimer *)theTimer { + // Show the HUD only if the task is still running + if (taskInProgress) { + [self setNeedsDisplay]; + [self showUsingAnimation:useAnimation]; + } +} + +- (void)handleMinShowTimer:(NSTimer *)theTimer { + [self hideUsingAnimation:useAnimation]; +} + +#pragma mark - Internal show & hide operations + +- (void)showUsingAnimation:(BOOL)animated { + self.alpha = 0.0f; + if (animated && animationType == MBProgressHUDAnimationZoomIn) { + self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(0.5f, 0.5f)); + } else if (animated && animationType == MBProgressHUDAnimationZoomOut) { + self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(1.5f, 1.5f)); + } + self.showStarted = [NSDate date]; + // Fade in + if (animated) { + [UIView beginAnimations:nil context:NULL]; + [UIView setAnimationDuration:0.30]; + self.alpha = 1.0f; + if (animationType == MBProgressHUDAnimationZoomIn || animationType == MBProgressHUDAnimationZoomOut) { + self.transform = rotationTransform; + } + [UIView commitAnimations]; + } + else { + self.alpha = 1.0f; + } +} + +- (void)hideUsingAnimation:(BOOL)animated { + // Fade out + if (animated && showStarted) { + [UIView beginAnimations:nil context:NULL]; + [UIView setAnimationDuration:0.30]; + [UIView setAnimationDelegate:self]; + [UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)]; + // 0.02 prevents the hud from passing through touches during the animation the hud will get completely hidden + // in the done method + if (animationType == MBProgressHUDAnimationZoomIn) { + self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(1.5f, 1.5f)); + } else if (animationType == MBProgressHUDAnimationZoomOut) { + self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(0.5f, 0.5f)); + } + + self.alpha = 0.02f; + [UIView commitAnimations]; + } + else { + self.alpha = 0.0f; + [self done]; + } + self.showStarted = nil; +} + +- (void)animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void*)context { + [self done]; +} + +- (void)done { + isFinished = YES; + self.alpha = 0.0f; + if ([delegate respondsToSelector:@selector(hudWasHidden:)]) { + [delegate performSelector:@selector(hudWasHidden:) withObject:self]; + } +#if NS_BLOCKS_AVAILABLE + if (self.completionBlock) { + self.completionBlock(); + self.completionBlock = NULL; + } +#endif + if (removeFromSuperViewOnHide) { + [self removeFromSuperview]; + } +} + +#pragma mark - Threading + +- (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated { + methodForExecution = method; + targetForExecution = MB_RETAIN(target); + objectForExecution = MB_RETAIN(object); + // Launch execution in new thread + self.taskInProgress = YES; + [NSThread detachNewThreadSelector:@selector(launchExecution) toTarget:self withObject:nil]; + // Show HUD view + [self show:animated]; +} + +#if NS_BLOCKS_AVAILABLE + +- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block { + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + [self showAnimated:animated whileExecutingBlock:block onQueue:queue completionBlock:NULL]; +} + +- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(void (^)())completion { + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + [self showAnimated:animated whileExecutingBlock:block onQueue:queue completionBlock:completion]; +} + +- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue { + [self showAnimated:animated whileExecutingBlock:block onQueue:queue completionBlock:NULL]; +} + +- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue + completionBlock:(MBProgressHUDCompletionBlock)completion { + self.taskInProgress = YES; + self.completionBlock = completion; + dispatch_async(queue, ^(void) { + block(); + dispatch_async(dispatch_get_main_queue(), ^(void) { + [self cleanUp]; + }); + }); + [self show:animated]; +} + +#endif + +- (void)launchExecution { + @autoreleasepool { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + // Start executing the requested task + [targetForExecution performSelector:methodForExecution withObject:objectForExecution]; +#pragma clang diagnostic pop + // Task completed, update view in main thread (note: view operations should + // be done only in the main thread) + [self performSelectorOnMainThread:@selector(cleanUp) withObject:nil waitUntilDone:NO]; + } +} + +- (void)cleanUp { + taskInProgress = NO; + self.indicator = nil; +#if !__has_feature(objc_arc) + [targetForExecution release]; + [objectForExecution release]; +#else + targetForExecution = nil; + objectForExecution = nil; +#endif + [self hide:useAnimation]; +} + +#pragma mark - UI + +- (void)setupLabels { + label = [[UILabel alloc] initWithFrame:self.bounds]; + label.adjustsFontSizeToFitWidth = NO; + label.textAlignment = NSTextAlignmentCenter; + label.opaque = NO; + label.backgroundColor = [UIColor clearColor]; + label.textColor = [UIColor whiteColor]; + label.font = self.labelFont; + label.text = self.labelText; + [self addSubview:label]; + + detailsLabel = [[UILabel alloc] initWithFrame:self.bounds]; + detailsLabel.font = self.detailsLabelFont; + detailsLabel.adjustsFontSizeToFitWidth = NO; + detailsLabel.textAlignment = NSTextAlignmentCenter; + detailsLabel.opaque = NO; + detailsLabel.backgroundColor = [UIColor clearColor]; + detailsLabel.textColor = [UIColor whiteColor]; + detailsLabel.numberOfLines = 0; + detailsLabel.font = self.detailsLabelFont; + detailsLabel.text = self.detailsLabelText; + [self addSubview:detailsLabel]; +} + +- (void)updateIndicators { + + BOOL isActivityIndicator = [indicator isKindOfClass:[UIActivityIndicatorView class]]; + BOOL isRoundIndicator = [indicator isKindOfClass:[MBRoundProgressView class]]; + + if (mode == MBProgressHUDModeIndeterminate && !isActivityIndicator) { + // Update to indeterminate indicator + [indicator removeFromSuperview]; + self.indicator = MB_AUTORELEASE([[UIActivityIndicatorView alloc] + initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]); + [(UIActivityIndicatorView *)indicator startAnimating]; + [self addSubview:indicator]; + } + else if (mode == MBProgressHUDModeDeterminate || mode == MBProgressHUDModeAnnularDeterminate) { + if (!isRoundIndicator) { + // Update to determinante indicator + [indicator removeFromSuperview]; + self.indicator = MB_AUTORELEASE([[MBRoundProgressView alloc] init]); + [self addSubview:indicator]; + } + if (mode == MBProgressHUDModeAnnularDeterminate) { + [(MBRoundProgressView *)indicator setAnnular:YES]; + } + } + else if (mode == MBProgressHUDModeCustomView && customView != indicator) { + // Update custom view indicator + [indicator removeFromSuperview]; + self.indicator = customView; + [self addSubview:indicator]; + } else if (mode == MBProgressHUDModeText) { + [indicator removeFromSuperview]; + self.indicator = nil; + } + else if (mode == MBProgressHUDModeError) { + [indicator removeFromSuperview]; + self.indicator = MB_AUTORELEASE([[MBRoundProgressErrorView alloc] init]); + [self addSubview:indicator]; + } + else if (mode == MBProgressHUDModeSuccess) { + [indicator removeFromSuperview]; + self.indicator = MB_AUTORELEASE([[MBRoundProgressSuccessView alloc] init]); + [self addSubview:indicator]; + } +} + +#pragma mark - Layout + +- (void)layoutSubviews { + + // Entirely cover the parent view + UIView *parent = self.superview; + if (parent) { + self.frame = parent.bounds; + } + CGRect bounds = self.bounds; + + // Determine the total widt and height needed + CGFloat maxWidth = bounds.size.width - 4 * margin; + CGSize totalSize = CGSizeZero; + + CGRect indicatorF = indicator.bounds; + indicatorF.size.width = MIN(indicatorF.size.width, maxWidth); + totalSize.width = MAX(totalSize.width, indicatorF.size.width); + totalSize.height += indicatorF.size.height; + + CGSize labelSize = [label.text sizeWithFont:label.font]; + labelSize.width = MIN(labelSize.width, maxWidth); + totalSize.width = MAX(totalSize.width, labelSize.width); + totalSize.height += labelSize.height; + if (labelSize.height > 0.f && indicatorF.size.height > 0.f) { + totalSize.height += kPadding; + } + + CGFloat remainingHeight = bounds.size.height - totalSize.height - kPadding - 4 * margin; + CGSize maxSize = CGSizeMake(maxWidth, remainingHeight); + CGSize detailsLabelSize = [detailsLabel.text sizeWithFont:detailsLabel.font + constrainedToSize:maxSize lineBreakMode:detailsLabel.lineBreakMode]; + totalSize.width = MAX(totalSize.width, detailsLabelSize.width); + totalSize.height += detailsLabelSize.height; + if (detailsLabelSize.height > 0.f && (indicatorF.size.height > 0.f || labelSize.height > 0.f)) { + totalSize.height += kPadding; + } + + totalSize.width += 2 * margin; + totalSize.height += 2 * margin; + + // Position elements + CGFloat yPos = roundf(((bounds.size.height - totalSize.height) / 2)) + margin + yOffset; + CGFloat xPos = xOffset; + indicatorF.origin.y = yPos; + indicatorF.origin.x = roundf((bounds.size.width - indicatorF.size.width) / 2) + xPos; + indicator.frame = indicatorF; + yPos += indicatorF.size.height; + + if (labelSize.height > 0.f && indicatorF.size.height > 0.f) { + yPos += kPadding; + } + CGRect labelF; + labelF.origin.y = yPos; + labelF.origin.x = roundf((bounds.size.width - labelSize.width) / 2) + xPos; + labelF.size = labelSize; + label.frame = labelF; + yPos += labelF.size.height; + + if (detailsLabelSize.height > 0.f && (indicatorF.size.height > 0.f || labelSize.height > 0.f)) { + yPos += kPadding; + } + CGRect detailsLabelF; + detailsLabelF.origin.y = yPos; + detailsLabelF.origin.x = roundf((bounds.size.width - detailsLabelSize.width) / 2) + xPos; + detailsLabelF.size = detailsLabelSize; + detailsLabel.frame = detailsLabelF; + + // Enforce minsize and quare rules + if (square) { + CGFloat max = MAX(totalSize.width, totalSize.height); + if (max <= bounds.size.width - 2 * margin) { + totalSize.width = max; + } + if (max <= bounds.size.height - 2 * margin) { + totalSize.height = max; + } + } + if (totalSize.width < minSize.width) { + totalSize.width = minSize.width; + } + if (totalSize.height < minSize.height) { + totalSize.height = minSize.height; + } + + self.size = totalSize; +} + +#pragma mark BG Drawing + +- (void)drawRect:(CGRect)rect { + + CGContextRef context = UIGraphicsGetCurrentContext(); + UIGraphicsPushContext(context); + + if (self.dimBackground) { + //Gradient colours + size_t gradLocationsNum = 2; + CGFloat gradLocations[2] = {0.0f, 1.0f}; + CGFloat gradColors[8] = {0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.75f}; + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, gradColors, gradLocations, gradLocationsNum); + CGColorSpaceRelease(colorSpace); + //Gradient center + CGPoint gradCenter= CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2); + //Gradient radius + float gradRadius = MIN(self.bounds.size.width , self.bounds.size.height) ; + //Gradient draw + CGContextDrawRadialGradient (context, gradient, gradCenter, + 0, gradCenter, gradRadius, + kCGGradientDrawsAfterEndLocation); + CGGradientRelease(gradient); + } + + // Set background rect color + if (self.color) { + CGContextSetFillColorWithColor(context, self.color.CGColor); + } else { + CGContextSetGrayFillColor(context, 0.0f, self.opacity); + } + + + // Center HUD + CGRect allRect = self.bounds; + // Draw rounded HUD backgroud rect + CGRect boxRect = CGRectMake(roundf((allRect.size.width - size.width) / 2) + self.xOffset, + roundf((allRect.size.height - size.height) / 2) + self.yOffset, size.width, size.height); + float radius = 10.0f; + CGContextBeginPath(context); + CGContextMoveToPoint(context, CGRectGetMinX(boxRect) + radius, CGRectGetMinY(boxRect)); + CGContextAddArc(context, CGRectGetMaxX(boxRect) - radius, CGRectGetMinY(boxRect) + radius, radius, 3 * (float)M_PI / 2, 0, 0); + CGContextAddArc(context, CGRectGetMaxX(boxRect) - radius, CGRectGetMaxY(boxRect) - radius, radius, 0, (float)M_PI / 2, 0); + CGContextAddArc(context, CGRectGetMinX(boxRect) + radius, CGRectGetMaxY(boxRect) - radius, radius, (float)M_PI / 2, (float)M_PI, 0); + CGContextAddArc(context, CGRectGetMinX(boxRect) + radius, CGRectGetMinY(boxRect) + radius, radius, (float)M_PI, 3 * (float)M_PI / 2, 0); + CGContextClosePath(context); + CGContextFillPath(context); + + UIGraphicsPopContext(); +} + +#pragma mark - KVO + +- (void)registerForKVO { + for (NSString *keyPath in [self observableKeypaths]) { + [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:NULL]; + } +} + +- (void)unregisterFromKVO { + for (NSString *keyPath in [self observableKeypaths]) { + [self removeObserver:self forKeyPath:keyPath]; + } +} + +- (NSArray *)observableKeypaths { + return [NSArray arrayWithObjects:@"mode", @"customView", @"labelText", @"labelFont", + @"detailsLabelText", @"detailsLabelFont", @"progress", nil]; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + if (![NSThread isMainThread]) { + [self performSelectorOnMainThread:@selector(updateUIForKeypath:) withObject:keyPath waitUntilDone:NO]; + } else { + [self updateUIForKeypath:keyPath]; + } +} + +- (void)updateUIForKeypath:(NSString *)keyPath { + if ([keyPath isEqualToString:@"mode"] || [keyPath isEqualToString:@"customView"]) { + [self updateIndicators]; + } else if ([keyPath isEqualToString:@"labelText"]) { + label.text = self.labelText; + } else if ([keyPath isEqualToString:@"labelFont"]) { + label.font = self.labelFont; + } else if ([keyPath isEqualToString:@"detailsLabelText"]) { + detailsLabel.text = self.detailsLabelText; + } else if ([keyPath isEqualToString:@"detailsLabelFont"]) { + detailsLabel.font = self.detailsLabelFont; + } else if ([keyPath isEqualToString:@"progress"]) { + if ([indicator respondsToSelector:@selector(setProgress:)]) { + [(id)indicator setProgress:progress]; + } + return; + } + [self setNeedsLayout]; + [self setNeedsDisplay]; +} + +#pragma mark - Notifications + +- (void)registerForNotifications { + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + [nc addObserver:self selector:@selector(deviceOrientationDidChange:) + name:UIDeviceOrientationDidChangeNotification object:nil]; +} + +- (void)unregisterFromNotifications { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void)deviceOrientationDidChange:(NSNotification *)notification { + UIView *superview = self.superview; + if (!superview) { + return; + } else if ([superview isKindOfClass:[UIWindow class]]) { + [self setTransformForCurrentOrientation:YES]; + } else { + self.bounds = self.superview.bounds; + [self setNeedsDisplay]; + } +} + +- (void)setTransformForCurrentOrientation:(BOOL)animated { + // Stay in sync with the superview + if (self.superview) { + self.bounds = self.superview.bounds; + [self setNeedsDisplay]; + } + + UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; + CGFloat radians = 0; + if (UIInterfaceOrientationIsLandscape(orientation)) { + if (orientation == UIInterfaceOrientationLandscapeLeft) { radians = -(CGFloat)M_PI_2; } + else { radians = (CGFloat)M_PI_2; } + // Window coordinates differ! + self.bounds = CGRectMake(0, 0, self.bounds.size.height, self.bounds.size.width); + } else { + if (orientation == UIInterfaceOrientationPortraitUpsideDown) { radians = (CGFloat)M_PI; } + else { radians = 0; } + } + rotationTransform = CGAffineTransformMakeRotation(radians); + + if (animated) { + [UIView beginAnimations:nil context:nil]; + } + [self setTransform:rotationTransform]; + if (animated) { + [UIView commitAnimations]; + } +} + +@end + + +@implementation MBRoundProgressView { + float _progress; + BOOL _annular; +} + +#pragma mark - Accessors + +- (float)progress { + return _progress; +} + +- (void)setProgress:(float)progress { + _progress = progress; + [self setNeedsDisplay]; +} + +- (BOOL)isAnnular { + return _annular; +} + +- (void)setAnnular:(BOOL)annular { + _annular = annular; + [self setNeedsDisplay]; +} + +#pragma mark - Lifecycle + +- (id)init { + return [self initWithFrame:CGRectMake(0.f, 0.f, 37.f, 37.f)]; +} + +- (id)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor clearColor]; + self.opaque = NO; + _progress = 0.f; + _annular = NO; + } + return self; +} + +#pragma mark - Drawing + +- (void)drawRect:(CGRect)rect { + + CGRect allRect = self.bounds; + CGRect circleRect = CGRectInset(allRect, 2.0f, 2.0f); + CGContextRef context = UIGraphicsGetCurrentContext(); + + if (_annular) { + // Draw background + CGFloat lineWidth = 5.f; + UIBezierPath *processBackgroundPath = [UIBezierPath bezierPath]; + processBackgroundPath.lineWidth = lineWidth; + processBackgroundPath.lineCapStyle = kCGLineCapRound; + CGPoint center = CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2); + CGFloat radius = (self.bounds.size.width - lineWidth)/2; + CGFloat startAngle = - ((float)M_PI / 2); // 90 degrees + CGFloat endAngle = (2 * (float)M_PI) + startAngle; + [processBackgroundPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES]; + [[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.1f] set]; + [processBackgroundPath stroke]; + // Draw progress + UIBezierPath *processPath = [UIBezierPath bezierPath]; + processPath.lineCapStyle = kCGLineCapRound; + processPath.lineWidth = lineWidth; + endAngle = (self.progress * 2 * (float)M_PI) + startAngle; + [processPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES]; + [[UIColor whiteColor] set]; + [processPath stroke]; + } else { + // Draw background + CGContextSetRGBStrokeColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // white + CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 0.1f); // translucent white + CGContextSetLineWidth(context, 2.0f); + CGContextFillEllipseInRect(context, circleRect); + CGContextStrokeEllipseInRect(context, circleRect); + // Draw progress + CGPoint center = CGPointMake(allRect.size.width / 2, allRect.size.height / 2); + CGFloat radius = (allRect.size.width - 4) / 2; + CGFloat startAngle = - ((float)M_PI / 2); // 90 degrees + CGFloat endAngle = (self.progress * 2 * (float)M_PI) + startAngle; + CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // white + CGContextMoveToPoint(context, center.x, center.y); + CGContextAddArc(context, center.x, center.y, radius, startAngle, endAngle, 0); + CGContextClosePath(context); + CGContextFillPath(context); + } +} + +@end + +@implementation MBRoundProgressErrorView +{ float _progress; + BOOL _annular; +} + +#pragma mark - Accessors + +- (float)progress { + return _progress; +} + +- (void)setProgress:(float)progress { + _progress = progress; + [self setNeedsDisplay]; +} + +- (BOOL)isAnnular { + return _annular; +} + +- (void)setAnnular:(BOOL)annular { + _annular = annular; + [self setNeedsDisplay]; +} + +#pragma mark - Lifecycle + +- (id)init { + return [self initWithFrame:CGRectMake(0.f, 0.f, 37.f, 37.f)]; +} + +- (id)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor clearColor]; + self.opaque = NO; + _progress = 0.f; + _annular = NO; + _errorView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)]; + _errorView.center = CGPointMake(_errorView.center.x, _errorView.center.y); + _errorView.image = [UIImage imageNamed:@"error.png"]; + [self addSubview:_errorView]; + } + return self; +} + +- (void)dealloc +{ + [super dealloc]; + [_errorView release]; +} + +@end + +@implementation MBRoundProgressSuccessView +{ float _progress; + BOOL _annular; +} + +#pragma mark - Accessors + +- (float)progress { + return _progress; +} + +- (void)setProgress:(float)progress { + _progress = progress; + [self setNeedsDisplay]; +} + +- (BOOL)isAnnular { + return _annular; +} + +- (void)setAnnular:(BOOL)annular { + _annular = annular; + [self setNeedsDisplay]; +} + +#pragma mark - Lifecycle + +- (id)init { + return [self initWithFrame:CGRectMake(0.f, 0.f, 37.f, 37.f)]; +} + +- (id)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor clearColor]; + self.opaque = NO; + _progress = 0.f; + _annular = NO; + _successView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)]; + _successView.center = CGPointMake(_successView.center.x, _successView.center.y); + _successView.image = [UIImage imageNamed:@"success.png"]; + [self addSubview:_successView]; + } + return self; +} + +- (void)dealloc +{ + self.successView = nil; + + [super dealloc]; + //总崩在这里,先改一下试试看 +// [_successView release]; +} + +@end \ No newline at end of file diff --git a/SCS-iOS-Demo/MBProgressHUD/error.png b/SCS-iOS-Demo/MBProgressHUD/error.png new file mode 100755 index 0000000000000000000000000000000000000000..2b3115ba044225c8b76b76d9a2b65bd4bf181d77 GIT binary patch literal 3499 zcmV;c4OH@pP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=00004XF*Lt006O$eEU(80000WV@Og>004R=004l4008;_004mL004C` z008P>0026e000+nl3&F}0008UNkl6?$|!5m81O*WfWDr8_zZ@xD_=FQtTYiO-;-0TF7p|zpfP;IFH0jdi?tc6@d0DP_@ zwbpLDOKV-wT9>ufrc2F1pVWVCR%`8R6yI<|lBY-(Nb0KZl5`D5a^iqilbj>z^9-ew z3M!=vN-16AyGp58BOs;JgpF1!rC!(5)$OT{j*dN&X_Bb%Aj!{_O2x6qDwWDO$!Qzy zKFPQB@)~X)hA7NyUk&E8S>WG*QWtYxCkYHv7VlubTj)KUMJ5|sWby%ya7-u91g#0c5kDVad>rg z^(%n5!}3&bZ|?&y`+9~d7K@_*X6w9XTL7%SzP^=z0#zs!MgYvYcwjdGSpEI|#Uq7U zUS1xlR><#CvH`$~L?Xo_fm&Kx8m?Bz4(K|70RWe6)_wx8qS5G&L!GDc`TThinG+Ge zh@i%AM5ED{B63wk-q@_47Li;&pFeYGm0Da}90Ks(p+YxJ(|mp))>l2=QHP2Rn5Mbb z5>zgiI|tx{1JEtYvYy#!>VcI2Se9k2c{;v@g@vGq%sL#|Z95?R%}5bRiAdT;7Z#Bh zo_i`DkMEJZKyt5UCb|=k$DcOPl4OeHe2sR6@% literal 0 HcmV?d00001 diff --git a/SCS-iOS-Demo/MBProgressHUD/error@2x.png b/SCS-iOS-Demo/MBProgressHUD/error@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..676341d110950242747cd311e2278d703338646d GIT binary patch literal 3857 zcmV+s5AN`ZP)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C z1U^YbK~#9!?AuLCD?1nm@c-%57xXHMh$5o66hTA~5flY&tNXJUIGZWQuXDe_xioM$ z_u}kbR6$Yf5m7`G_adT*D2k%BNzP^}(_(Gylg!M$Cl7?aWSY+WNYYG_evwkbMD>Un z0t02B43vQ~PzK6`fih4A%0T_TP!@m{08Yr)<#^{|DJxM*NlHS9VzPt~D?$kACC8Vi zExmI-j_({+gb)_>8l{x@LY+MjLKJJ#KLEa#Wv2l!txX~p^Ph_YAX9dT3&4)WVx00l zWGK#gC8R*GEXyjM$9qU6Se9k+P@oEhLNz4qSn+rqg+k#Yq!O%nJkA4!dVPJZ6-hT% zEl4F;4Gj%E5U6}U|5+qmSf4>E!D?)5+5rM6i$XZ zKR>T_NDx>YfZgBU@9O#jGSu1GSuKa@#Nq(#fq?;6XLXHJ3#bv=1z>By;sETy!9iDd zyCy? zP~=~|)6>&1kV@_ihlht*Ay=VU3NAvB*Ik92`Um=?!aqe4ItSk8-4xKctlP z?n~lQ%0Iowy8EpC{e7iSnm3YtdK@K$$N~5p z_5C|R1rk7?R%QTl+MC|``nu&cJtqVtYRzH*mgnc^xpt^xtgWqOYQ)lkR1X#du)MIa z5X|;ze`K@SYFK#y-!vg1kw_q$&DMg&5{X1Q%mHUwO35k=^zu^5ZyyXM$;rd2HYg<_ zshmA{4@*0ezcnP2$x2u(nM|gs*Qs)v#g7#TQhB$LN~OxNSSpoDt7zh?m(c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxKsVXI%uvD1M9IxIyg#@@$ndN=gc>^!3Zj z%k|2Q_413-^$jg8E%gnI^o@*kfhu&1EAvVcD|GXUm0>2hq!uR^WfqiV=I1GZOiWD5 zFD$Tv3bSNU;+l1ennz|zM-B0$V)JVzP|XC=H|jx7ncO3BHWAB;NpiyW)Z+ZoqGVvir744~DzI`cN=+=uFAB-e&w+(vKt_H^esM;Afr4|esh**NZ(?$0 z9!LbN!`Ii!Gq1QLF)umQ)5TT^Xog;9W{Q=op^KBLo3ojjp{c2%p(`+;%p9GZ4BcFT zd1yI^Xl7`P!z~cKDOlVB)oX-PuRhQ*`k<&qifWh;F#Uj-@PrHGz>|Jz9x%NZ0TcGo z7c)0AFfi@*ba4!+xby;bH97m$;pFsP;yb$h#W|jSY_!?W?Qm%ym&oT+k=*@)P8_NMa^f7@Y?#^B zC-Q`Zu08mUc`a9|bQN!H^E{`^rx&Dco;hF9VTZ$+009mIyMP^Y3K!-b{3*PJ{cd}i z!f68@!P4fFDTijiXMUv2@VRA5YVq`PEz^b?g*a}re?b~P3P-pt-m}hI_KtP?rkiUz z8g8+BFyET%xBQ(9n_HU58XfTtTalRB#%1w*texD;xUryT@$1Cy!mUD zZQ2S$x&HE(+Qu&NvDe#mBy-Lxv^@T>dy$US$GC<=lkJZ4u2Vjs9NFfuz-nI9%d*{J z3j+k+mfb!p(70s%b$c!^+auql-kh}%c(|}_?(e_*`WV(TR2(VtFj#Ld@kOHe9>X8z zb@!*(?cq0fI((tMZDQIX z%`NyprB`3ND%QcCXLVdME=xf{t1dzm>Bf0U_TP}Hlxc}t#;VK(C%&W1kU&$q(gxUz4kjXQqP-S^-0 l2@a|OoFPnGfBjHBz_8(-my3`7+a;jF-P6_2Wt~$(699{HTBiU2 literal 0 HcmV?d00001 diff --git a/SCS-iOS-Demo/MBProgressHUD/success@2x.png b/SCS-iOS-Demo/MBProgressHUD/success@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..5ac8c212d87dd78dcdd0bbca602af4793cc9ae20 GIT binary patch literal 2156 zcmaJ?c~n#B6%P_X!=@At6-A!`EFfe75=bCGLcjzKgn$?*GKAy-0h1S!2P9}Ki{OEg zX@rO<<4ouT0gHg5&LWgu7A-0VM-fGdrHX4u7B?LGg2MEV(s#~#-*@l1zu#TYeI?w8 z?Uon^3<`y^WV4t&&R6LPFq2LK#crPzc#KKddlEMO|r&Qsz z#J~g2 zTPt85_*=aHlUNa>l7V<0sDQHMLZopiP6k&pYKR;Zz>qu!g7z*|k(&m=kRlC|0U^;O z91-9Mgkq^dvxwkusBEbM7D$C4n@PhW95}I9MD_6|Q$l?hVPv8=iAW4Z3Pq+f7{stp zB8lYZ<40P;G9h7>1eC%{SkW>z1nJibSi>+#WQb=bC>LjgqA)om0Tz>{idT+>xgy_Z ztZ2np7@;d-@klUuLu>!5)k`X5ehk;;!9|4S(Fdi-yvvcnw(EJAjzXa)*i3qi^3Jnr z|BM*AZU5^%wL3j^Yur}l`#9W16IV;W^SC|6XLVjn5=@!3SggL|TDloX%5V=oAAY1; zZM(&}{Blun;?s`_j}op858v&7(LOoxj3TRQZ*6@&yfA-YIDp(R|NcX1eA`Xi`~n^q z6Ha$?HK{$NwbdA;(`nfu^tWfM4p@COzF*Y*7e(t65{;JD71XtvKL<@lPTHTYKcEiu z1CG%0JILwPX{=v6OWB=@V( ztc|4D+5Nq9vF(W+^EHo(M1{mBM>rQBT&ee$lB;jUM{RMox3$-$Ul__lPg^bcm9fIj zFooto&9gh{zqqm5tboaP1M5nsOhD`2Vpyf3p!@4QT-^`;b1-hoXbR#_*&<@>G0sDmR5!*k1bApA7(VF zZzE^bl&?N)Ik?HE>qvOPA$5YbDIrQ&-#0d)tk*fK(ON!hw@q%!WtHhis{@1MdFw{? zC(ro(p*CNHGTD*$gX{`zRyIR=^OI_TrjckImH68DwkH*891iCm$o*=6OvBCelB1dp zu5dgVoRErufW3#wr@$~L%r-*DE*(R`}E{~trnzIYqP z-nBvJQEXRJSwHNp+m0SEVPCX&$Mje}|7yhD&zoCUSC{d)Gj~+8v*r4V{P@k5R8qu5N?&_8#Vx|Ka4z9k`(G0ur0j4#rcW9~ZxalD?LxiP zP2@bTRaaFr!`Z|<(wk7txH;Zck zGc$>ozI*WD!v{BuWK<;-d+uklaSMz6Cc)YH*42L%XpY8vnS@^a{`>7icREqy+4?LO z<+cQJ)SNnn`(s4;YuTCePv;zrY}D>%4~w}kv;*1M*{nF@7JYZvZRm~9BWkRuBl26v ziPm)hkJmb;lMK2~PzN6BoZRYT_O%~BetcqnKD)oMcYI@R)TGni_)R~ZE&buV!iM7J z7ReHO%voz&TU#|%{qm3rz`*TkH^)fmQF?7^$vKuq%ueSAY=+uHWC^ z5}^LGog?pO?JEB7XZKkAT6eH-8~n|$Cb~VN_i$8QKrpcpJUD6nuEN1|>kgyo*!94a zNokMFgs_Tlarg`4 + +@interface RootViewController : UITableViewController ; + +@property (strong, nonatomic) ASINetworkQueue *globleNetWorkQueue; + +@end diff --git a/SCS-iOS-Demo/RootViewController.m b/SCS-iOS-Demo/RootViewController.m new file mode 100644 index 00000000..d7878bb0 --- /dev/null +++ b/SCS-iOS-Demo/RootViewController.m @@ -0,0 +1,317 @@ +// +// RootViewController.m +// SCS-iOS-Demo +// +// Created by Littlebox222 on 14-8-14. +// Copyright (c) 2014年 Littlebox222. All rights reserved. +// + +#import "AppDelegate.h" +#import "RootViewController.h" +#import "MBProgressHUD.h" + +@interface RootViewController () + +@end + +@implementation RootViewController + +- (id)initWithStyle:(UITableViewStyle)style +{ + self = [super initWithStyle:style]; + if (self) { + +#ifdef __IPHONE_7_0 + if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) { + self.edgesForExtendedLayout = UIRectEdgeNone; + } +#endif + + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + + + [ASIS3Request setSharedSecretAccessKey:kSecretKey]; + [ASIS3Request setSharedAccessKey:kAccessKey]; + + self.globleNetWorkQueue = [ASINetworkQueue queue]; + [self.globleNetWorkQueue setDelegate:self]; + [self.globleNetWorkQueue setRequestDidFinishSelector:@selector(requestDidFinished:)]; + [self.globleNetWorkQueue setRequestDidFailSelector:@selector(requestDidFailed:)]; + [self.globleNetWorkQueue setRequestDidReceiveResponseHeadersSelector:@selector(requestDidReceivedResponseHeaders:)]; + [self.globleNetWorkQueue setRequestDidStartSelector:@selector(requestDidStarted:)]; + [self.globleNetWorkQueue setRequestWillRedirectSelector:@selector(requestWillRedirect:)]; + [self.globleNetWorkQueue setShouldCancelAllRequestsOnFailure:NO]; + + [self.globleNetWorkQueue go]; + +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; +} + +- (void)dealloc { + + [self.globleNetWorkQueue cancelAllOperations]; + self.globleNetWorkQueue.delegate = nil; + [self.globleNetWorkQueue release]; + + [super dealloc]; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 8; +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *cell = nil; + + if (cell == nil) { + + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"] autorelease]; + cell.backgroundColor = self.tableView.backgroundColor; + cell.selectionStyle = UITableViewCellSelectionStyleBlue; + + if (indexPath.row == 0) { + cell.textLabel.text = @"Create Bucket"; + }else if (indexPath.row == 1) { + cell.textLabel.text = @"Delete Bucket"; + }else if (indexPath.row == 2) { + cell.textLabel.text = @"List Buckets"; + }else if (indexPath.row == 3) { + cell.textLabel.text = @"List Objects"; + }else if (indexPath.row == 4) { + cell.textLabel.text = @"Upload Object"; + }else if (indexPath.row == 5) { + cell.textLabel.text = @"Download Object"; + }else if (indexPath.row == 6) { + cell.textLabel.text = @"Copy Object"; + }else if (indexPath.row == 7) { + cell.textLabel.text = @"Delete Object"; + } + } + + return cell; +} + +#pragma mark - Table view delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + + [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES]; + + if (indexPath.row == 0) { + + ASIS3BucketRequest *request = [ASIS3BucketRequest PUTRequestWithBucket:kUserTestBucketCreate]; + [request setUserInfo:[NSDictionary dictionaryWithObject:@"Create Bucket" forKey:@"requestKind"]]; + [self.globleNetWorkQueue addOperation:request]; + + }else if (indexPath.row == 1) { + + ASIS3BucketRequest *request = [ASIS3BucketRequest DELETERequestWithBucket:kUserTestBucketCreate]; + [request setUserInfo:[NSDictionary dictionaryWithObject:@"Delete Bucket" forKey:@"requestKind"]]; + [self.globleNetWorkQueue addOperation:request]; + + }else if (indexPath.row == 2) { + + ASIS3ServiceRequest *request = [ASIS3ServiceRequest serviceRequest]; + [request setUserInfo:[NSDictionary dictionaryWithObject:@"List Buckets" forKey:@"requestKind"]]; + [self.globleNetWorkQueue addOperation:request]; + + }else if (indexPath.row == 3) { + + ASIS3BucketRequest *request = [ASIS3BucketRequest requestWithBucket:kUserTestBucketCreate]; + [request setUserInfo:[NSDictionary dictionaryWithObject:@"List Objects" forKey:@"requestKind"]]; + [self.globleNetWorkQueue addOperation:request]; + + }else if (indexPath.row == 4) { + + NSString *filePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"png"]; + ASIS3ObjectRequest *request = [ASIS3ObjectRequest PUTRequestForFile:filePath + withBucket:kUserTestBucketCreate + key:[filePath lastPathComponent]]; + [request setUserInfo:[NSDictionary dictionaryWithObject:@"Upload Object" forKey:@"requestKind"]]; + [self.globleNetWorkQueue addOperation:request]; + + }else if (indexPath.row == 5) { + + ASIS3ObjectRequest *request = [ASIS3ObjectRequest requestWithBucket:kUserTestBucketCreate key:@"test.png"]; + + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); + NSString *documentsDirectory = [paths objectAtIndex:0]; + NSString *downloadPath = [NSString stringWithFormat:@"%@/test.png", documentsDirectory]; + [request setDownloadDestinationPath:downloadPath]; + [request setUserInfo:[NSDictionary dictionaryWithObject:@"Download Object" forKey:@"requestKind"]]; + [self.globleNetWorkQueue addOperation:request]; + + }else if (indexPath.row == 6) { + + ASIS3ObjectRequest *request = [ASIS3ObjectRequest COPYRequestFromBucket:kUserTestBucketCreate + key:@"test.png" + toBucket:kUserTestBucketCreate + key:@"test_copy.png"]; + [request setUserInfo:[NSDictionary dictionaryWithObject:@"Copy Object" forKey:@"requestKind"]]; + [self.globleNetWorkQueue addOperation:request]; + + }else if (indexPath.row == 7) { + + ASIS3ObjectRequest *request = [ASIS3ObjectRequest DELETERequestWithBucket:kUserTestBucketCreate key:@"test.png"]; + [request setUserInfo:[NSDictionary dictionaryWithObject:@"Delete Object" forKey:@"requestKind"]]; + [self.globleNetWorkQueue addOperation:request]; + + } + + [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; +} + + +#pragma - ASINetworkQueueDelegate + +- (void)requestDidFinished:(ASIS3Request *)request { + + NSString *requestKind = [[request userInfo] valueForKey:@"requestKind"]; + + if ([requestKind isEqualToString:@"Create Bucket"]) { + + [MBProgressHUD showSuccessHUDAddedTo:self.navigationController.view text:@"创建成功" duration:1.5]; + NSLog(@"%@ created", [(ASIS3BucketRequest *)request bucket]); + } + + if ([requestKind isEqualToString:@"Delete Bucket"]) { + + [MBProgressHUD showSuccessHUDAddedTo:self.navigationController.view text:@"删除成功" duration:1.5]; + NSLog(@"%@ deleted", [(ASIS3BucketRequest *)request bucket]); + } + + if ([requestKind isEqualToString:@"List Buckets"]) { + + [MBProgressHUD showSuccessHUDAddedTo:self.navigationController.view text:@"列取成功" duration:1.5]; + + NSArray *buckets = [(ASIS3ServiceRequest *)request buckets]; + NSLog(@"%@", buckets); + } + + if ([requestKind isEqualToString:@"List Objects"]) { + + [MBProgressHUD showSuccessHUDAddedTo:self.navigationController.view text:@"列取成功" duration:1.5]; + + NSArray *objects = [(ASIS3BucketRequest *)request objects]; + NSLog(@"%@", objects); + } + + if ([requestKind isEqualToString:@"Upload Object"]) { + + [MBProgressHUD showSuccessHUDAddedTo:self.navigationController.view text:@"上传成功" duration:1.5]; + NSLog(@"%@ uploaded", [(ASIS3ObjectRequest *)request key]); + } + + if ([requestKind isEqualToString:@"Download Object"]) { + + [MBProgressHUD showSuccessHUDAddedTo:self.navigationController.view text:@"下载成功" duration:1.5]; + NSLog(@"%@ downloaded", [(ASIS3ObjectRequest *)request key]); + NSLog(@"%@", [(ASIS3ObjectRequest *)request downloadDestinationPath]); + } + + if ([requestKind isEqualToString:@"Copy Object"]) { + + [MBProgressHUD showSuccessHUDAddedTo:self.navigationController.view text:@"拷贝成功" duration:1.5]; + NSLog(@"%@ copied to %@", [(ASIS3ObjectRequest *)request sourceKey], [(ASIS3ObjectRequest *)request key]); + } + + if ([requestKind isEqualToString:@"Delete Object"]) { + + [MBProgressHUD showSuccessHUDAddedTo:self.navigationController.view text:@"删除成功" duration:1.5]; + NSLog(@"%@ deleted", [(ASIS3ObjectRequest *)request key]); + } + + NSLog(@"===== <%@> finished", requestKind); +} + +- (void)requestDidFailed:(ASIS3Request *)request { + + NSString *requestKind = [[request userInfo] valueForKey:@"requestKind"]; + + if ([requestKind isEqualToString:@"Create Bucket"]) { + + [MBProgressHUD showErrorHUDAddedTo:self.navigationController.view text:@"创建失败" duration:1.5]; + NSLog(@"%@", [(ASIS3BucketRequest *)request error]); + } + + if ([requestKind isEqualToString:@"Delete Bucket"]) { + + [MBProgressHUD showErrorHUDAddedTo:self.navigationController.view text:@"删除失败" duration:1.5]; + NSLog(@"%@", [(ASIS3BucketRequest *)request error]); + } + + if ([requestKind isEqualToString:@"List Buckets"]) { + + [MBProgressHUD showErrorHUDAddedTo:self.navigationController.view text:@"列取失败" duration:1.5]; + NSLog(@"%@", [(ASIS3ServiceRequest *)request error]); + } + + if ([requestKind isEqualToString:@"List Objects"]) { + + [MBProgressHUD showErrorHUDAddedTo:self.navigationController.view text:@"列取失败" duration:1.5]; + NSLog(@"%@", [(ASIS3BucketRequest *)request error]); + } + + if ([requestKind isEqualToString:@"Upload Object"]) { + + [MBProgressHUD showErrorHUDAddedTo:self.navigationController.view text:@"上传失败" duration:1.5]; + NSLog(@"%@", [(ASIS3ObjectRequest *)request error]); + } + + if ([requestKind isEqualToString:@"Download Object"]) { + + [MBProgressHUD showErrorHUDAddedTo:self.navigationController.view text:@"下载失败" duration:1.5]; + NSLog(@"%@", [(ASIS3ObjectRequest *)request error]); + } + + if ([requestKind isEqualToString:@"Copy Object"]) { + + [MBProgressHUD showErrorHUDAddedTo:self.navigationController.view text:@"拷贝失败" duration:1.5]; + NSLog(@"%@", [(ASIS3ObjectRequest *)request error]); + } + + if ([requestKind isEqualToString:@"Delete Object"]) { + + [MBProgressHUD showErrorHUDAddedTo:self.navigationController.view text:@"删除失败" duration:1.5]; + NSLog(@"%@", [(ASIS3ObjectRequest *)request error]); + } + + NSLog(@"===== <%@> failed", requestKind); +} + +- (void)requestDidReceivedResponseHeaders:(ASIS3Request *)request { + +} + +- (void)requestDidStarted:(ASIS3Request *)request { + + NSString *requestKind = [[request userInfo] valueForKey:@"requestKind"]; + NSLog(@"===== <%@> started", requestKind); +} + +- (void)requestWillRedirect:(ASIS3Request *)request { + +} + +@end diff --git a/SCS-iOS-Demo/SCS-iOS-Demo-Info.plist b/SCS-iOS-Demo/SCS-iOS-Demo-Info.plist new file mode 100644 index 00000000..70dc7a8b --- /dev/null +++ b/SCS-iOS-Demo/SCS-iOS-Demo-Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.sina.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/SCS-iOS-Demo/SCS-iOS-Demo-Prefix.pch b/SCS-iOS-Demo/SCS-iOS-Demo-Prefix.pch new file mode 100644 index 00000000..743435c9 --- /dev/null +++ b/SCS-iOS-Demo/SCS-iOS-Demo-Prefix.pch @@ -0,0 +1,16 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#import + +#ifndef __IPHONE_3_0 +#warning "This project uses features only available in iOS SDK 3.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/SCS-iOS-Demo/en.lproj/InfoPlist.strings b/SCS-iOS-Demo/en.lproj/InfoPlist.strings new file mode 100644 index 00000000..477b28ff --- /dev/null +++ b/SCS-iOS-Demo/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/SCS-iOS-Demo/main.m b/SCS-iOS-Demo/main.m new file mode 100644 index 00000000..d348bde4 --- /dev/null +++ b/SCS-iOS-Demo/main.m @@ -0,0 +1,18 @@ +// +// main.m +// SCS-iOS-Demo +// +// Created by Littlebox222 on 14-8-14. +// Copyright (c) 2014年 Littlebox222. All rights reserved. +// + +#import + +#import "AppDelegate.h" + +int main(int argc, char * argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/SCS-iOS-Demo/test.png b/SCS-iOS-Demo/test.png new file mode 100644 index 0000000000000000000000000000000000000000..59e7f554f5042068e35cbfb6e38615369cedb688 GIT binary patch literal 8708 zcmZX21yEhhvhF4jAUMHYHWp;#?(XjH?(Xgzg1c*QcXtRL2oAw5xVv2bbMHInRJ~O- zYt3}`*FD`cHPgK!739Pb;c(#q005$-gox6|H~FK{!hZUA?|il`1_0oCEro>@B!z{E z6`btNENx5y013pZ6n7QnQLK@Ju2emXKv;<{U6SX-U16jWFnAW+hGsmIziYV)tW1If=Gvp3%EGo8)$6S>{b*4W#er?3E0 zFw#^qp?d%cG!t1FaR9)S7;-ldIx3sw1{M+V)BDQ$26UXs<&QG5g`W1; z^Ut10?7@ftbTEk0foaK-Dp$mtK$~g|3J@uH%C(#>^yQ$il1d0o#IqwL(X36b|4YLf z+YTD)e(2K;Kp?MHqks(X(_N7p7?m9|OyV!HEY!ON56HtVI2qfoeMuSj1GPVlQ+rtzIW$ItqNr02|X^v|U~<&5TL9#J-#n}kZ= zn}JD-?o8AIiuBB1LeukSxgmT|5Htd^M<)f35dbyG{W_@pk*T8>0{YOYedx85m<*M) zw6=h_PUc8tfc;0x~eYHUP>bkW>KzR{#e4ld{3*lK^H17(QY^NB}Gfd9>m(d-;CXy-h#O(e29f&5==A@ zy&xY%g$h9oVd^*R*X##u;TVFc#OHuqsKOEWMj%JLx|k)oPC^oiRFcd}7@~gcSY-R0`4G^pc9v8BJ-5b7m#m#66{p zm2S(<<~Xb?s+Guq~RO0nLbEID(Pq2K9m-fo+wzVdKQ5d zS=DqaGpgF!2i`@jO#BG&yh5yLwmUfH320gVx z>kjAwH49aCDu>f3WPhtB)@YV{%3XgJj@;^#Fim0xF;O(mHNG?rYO!i{X(_Kjuf(t5 zHD)#u{f%?Mclqin<=XB-;lk<~?0W5r=X!pOdW(PK;ni{5e#>`=cPM^rKWjhlZ$Hi9w2S#d^*h0dE!eI-2IYeOfPt8--6|7sV@lEj&IJ zEan`j)mV!0mSK{~mW6<=F!OV|ErT_yw`sLCp?UW}=juylXq9NWX!a1K^yhKFIAY3a zihX5t)skAWT1#cwLid7o)oP{wYTA;6?cMTPQ}HtNs$KnQ{i~I^J!QRhJzm3NQ*293 zea}wbA<9wh&=wfDF!S57$~b(7l9IbbresIXpEHxIgoDV*Vs@>}3m zAV#2kP;{_};Ax+OgTTeqW_Z*M<`>MSumBXZpHp$-`Ox`)^Ls$UbV#~7Z4Z`drW$@4 z?i_SJq7Pda_oz9jtE7Y?xME;nM}bLUiWsYiZ^T^;D3TD&7^_L(%&W$lLbQq*9vcPb z#%6CDG#{-dFO;@T#RPSAO&DlS)mMzGrj~&C8-(0GTMtEg*!Z}-Y(3CdqNveXGXvvCldms@d$3yOXb$dyD&; zpp?s$jhnraB_AMMlut?8E0By!cY|a z4P--qCnlV7nk=7qN+U@2B^BorkNcfyoz=m4ubE@NK3&03u~gB1)pWIZfLwE@q1ynh zm00`3x@u}AsHyPyWr09TUMsi$tpyPiPl~N`6}zjhOQ6d@x9=yiA3qD`7&;j4+{S5L z{7K<&|3L0j(L}2&9C{U^7i{?VX&%e^`!Z9HD(pGZ`!6ys5OQ zR;pOhxizFWKkwzc_m!PLnjf0ay}!QSsJg7MESs;P;|}1CbKSJmRnfhlM&f73SK-z0 zxv=ia^E*^n%8x?4LqrUpN3ypL!5jK+ES^I6m;1=Kv1+uj>__^#jt>Gp8j<&<^b37U zEDYf}*Oo)U-=g)=a^*&4Q91=_yKxbk8rM>~=Bjs>-oMpu2Y1Rn8LwI!`SXgNVt*%^ z8;Tk}o0m-QWoMqCyT#K;28;-!5j8$GcPMUA$d#JGPyQcglay z|6ateZqjS%Sf4dsbv|NW-H^Loxouvn?U`9PSXx}~seL~QSnYkxTxX}>Fj{ZtYqh9- zciTPfa8FssX&-NUe$hMXTD)&KljqgAM|rM2j9)9PAF+zH_Gf?U^89IcI8l4=Fr9co zi7d7Rq<{bUurqGar+oCg-aKO(H%FWI9Q&H!*t>3b=umoVyzH`{fA780%k<%BSO3ia zR%TEpx*M}A$FE_pYHan%o$b7xLYR`MN8X$NHvh12Y(zL0pU>4l=IzCX`WgOB`cb{G z=5*sz4{w%SW)5b(NF@$kKprqF4YoJa3s72D>UIbjK*n4VY|fLXc^XqMG9cYv^oliY zwU>^;4LJG(5upPkpg;+D{#6~$^f{Y6fvTUNcVS^RMvIINIJ05}O$>%jrXVUQ*(iq$ zu!q^Ku<-J-I={JDq#rXUYnhmTwr0O0Z9`smu4x)>6B*xJ}Rb9wNR{!4=EqyGSr?{m0P1pZ}ewsfXo%EZI5#pIaXe(*MJuX9O|O|6BJ5l;jkB>)0Nyqxo`woV;)Hh^XB$(1+M$KEfX1r(mM3wReJwzfpIXlTP zn|~`Dredo&*)f*j+gGm6`bniRWx}+l-)^$nu8M_!LO^K8fc?u`(VGm{1N(izfMqF4 z(9RAt+z^dV;_W#mR>=4At*eKB*cc;xd~~W_WV$YNL7jA?;X7dzmQ`zzkm9>LivbGw zEs^)`=k#P#@gE0zECUAIK2n>EZMP+{7?ub0hQB7GHqEz3f#HT^Jm+e|veG?)WA`*B z^hA=g=V1<%gk%G0dVnJw*_jyJR;Hy~xS?DQV(#WoFSEwTv zOL;y$fk$D+6reVX0(%tv6NZyQqms^3#|a4)`aC#tO;0%X%-W4um}f3OpLVEG~uzVO0h`U2JeW2y!F8ayPlS75)E zw)sWvEFO3j(ANwJBas5;ly@C2xU0o&&3&CPYj9%Vb3c%)=?lJKleVc$@Krw8so4Zk z%I^Y*MsYtqPUR+!2flCb(ST3E)Z&xAeK z=)QyWLsajs!8e7`v4twlzn3S>b{|{C6d<38HHdFcX!lZj z$b*011HKioJlFK!_E~rbrO0|NY!6jZB%a-G*h)&a=)x5rp^yI2z2=!zLJ)Ct$x_r; zxBpWwn?s88-93wmQk{@*?!iUd{cx#o_c*pOXIV;F0Ma=~6ZOLt*JFM{UcZ;t zSm{&{d1e0*)_Z!h+v(GIYK;XgE~`zg*Sx!rAKxQCv$=1B%V^L7YSo#jc+DbwqBS+Q z>(R|UBTbe6*<#ul2F=~!3iebyz{|H944Au_+&0mP~#@+@%A{J)oxB83Sx2~7aU;`DYW6$F?~nCjZCE zKG(8AEY7?^LMAz1p{|YEP$ctrmTK>MRJl6?^|aM1*D?H#UM`mn1JcE(D^qro+$vb& zsCZnxT8~b>*~Z`zz(&4L;GJEm-DXtAu(d~{uGQjMZ5Zsu+>@i$z?NCwVlyg)@K1dMAu9 znfk9(@?4uYwOFuC^U{^`Bo;_AQu4>CWAmi8&9@R&yu@`far2~~{tFG}E+xv9w=bM( zp{5tt*HI_eG4ocxkL@=cu;E3MkP*_D-2-cCrccs;k70Dqelhv;P83)IgFUO?$dyGC>)LugS(_J;e@wO_zsZ47O)YYhP>PzRo2v8 zhJe`n1POT-Sk9={R?;yuk zT|;_;L!HRMV8Lk*{Bmu!oRhASlNLWxdt%cj^tsL2e7ah9?RX*Z$kwsZe{IcWT`%k_ zd2xIGS@uS)PFF&YO`GSDi?&ty`l@#DS4h>;!?yjJl0w)Lay}aM>cOWqPxv0)2iftI z$#l&YJKwp@t@!w^T;IFD^24&5jVa%hp?SHszUF}+pV@6^BLsEUK3Rq^#9WJAxts!O62m%w(D^u3JH_sl1A zxu|6^j*Um&wbIA8CTATO-Z5Vq2((!AJ9Cye*GA#rn!F?{`k64L(44ipDfj~`XWEZ_ z7PCe9;9!L07q;}7-B?Q1LZ{A{q6#3Tw-_cYHE?hz5}{nhGspm`cgFb0T*D%}P&}5g zRG(g^%K~$bo+@-Q7=E|D7+w*LK|GeAWTV^nU{tvThl7nc(se?mTt~7NdIoiq&v-MR zeixl$qr?5Z7FlfThS^MpPO%__A{mHU%VC?Ab&7z)ri6_g5E25!V|$U|T55k3j}F0Z zOiE&={S2M-r{4AXp0NU#-A18M%+(CP$;F$Nnn+xZll?ax>#>xkCd1%Jl260-**@Q% zbB(*VwHYKIo7-zb@iK{pEw_+tc8im?G>#41C6eVx+OH0r%t|<@My# zyxh@ER;1vtp$EQEWCpq7W>3VZ;GXkEf>PJZZBwB5_wJ zCuh_%ISQhDt87;9smW-W?<$?w~+RNgy`sWoS5JV#=2tik}HpkLp3SAidg*0X&RI_*!TY5sSaVlalP&NIRV zDI}C$Pe~u~>iktwcNvDBdV@cPTX=T$|XJ@UKEGHb*=k7$l+;Y0t zbckEZo0`|lk)^s^M-hQO50BBuYb-nIYDLAQo14rB6zH?Xd)|*lC3QS3)8x>$6Dx#8 zmd#{a_utH`-8gNejQGiP5;9_~^|igg-SIuq?JVV#9U>)JdwF<<$dISwpiD0zIr&!V zS*~Nd+2X5Ja7aiA+6YEfjpZO6$edCJeyBhQPQPia5Cgydn+ zs1Y0I6B|KdZpYnye`%2bOxV1d!n9*^k->>hWU<0Lcg;6ESJZSPpsFF`^FX~`T>L=c zaXDlt-keBxz6tA4t}Gyim}Ar@2Y)dH~~Qz*o^k`79F|I`dT(#R34)678G1nb4G1s9fiQ$mqEtzbx$G6;SEnsr2~+8F#7z+R zI8o#%Wf-y)%r~JpX;|97HtRNEfP5>cEtwB9&)IqtQInrM-?DHigMx#Zn3y=AmS{nC zi*xkm45OaK=tji2YVVIFuC)s{1D$McTmDQnsdow$y9e00@2Ohyn2k}XpvhczaUVrf z)K?nSa&&a`U2JLjY_8K;KarPDOn3g1m}Oq9x_^~yBJH7O5j2^}(f~ovj6DWhMm`a* z#$WjL`5mJy=1L)sgtyv6o zC9n6LleRgbYJV#9Lh~uNws>Q2I20=d4#yqYe)PnI8l5&Vc4rt8j>vN4Yf!K?{^RT6 zkKFSZNwCvjrSgdCZoY1Pxy-G7GkmriU)X*Y#z!a-p`hTeXo)xv&yPwFi~{|aJA6*g z&gK)jbTT4v4oKLCxNagj4YP*&R0z+fk7??96^^ z7r&Pq%;6U1{r~W)tcPZh5=g7)14NX^3-H_gi)JQuVMiK&;qs;jOezSAPrt!E&)X}c zMu=u*ahr=7CHSrivMTVR#==U%^`(5mQffp6ic^wPwpgGdO_pS^U0z-qHknVK)$!X! z$I7QMnXY`C7j2tpA@n+}RFy-D8g*8P7hPU=y~(VS_{9aZlnAi)zt((vy4Eb#O1Dzz zdPF{M<8@QuJ0rh?K#@kMZo(fM5)#3R#Y(h99arqyWwXitNKo{09*ZfL6Wqsz-$rFw zq(w5@e9BhXJ}4`4dO8vZ(IV%?6H5sxB`cNObZlfk{gfd&^YZ!{9CXIi_QXSSEYsny zdUuM3C1r)3W4{ZR>{{b0pg^Jq0r6!Zi`zXXZnoUC;n-ityxV6pJ4ga*V&$$BKFwEE zmZTs*^^nu*OL)(|$pM3Ag`2D(kys+7?~_%yoQl^(&&_tva5T=4Ay$M191QsvR{LtL zE(hUqbZ-I7d?i3B#O5~n@S2)-i{0(pX5fk*HW_7Z@A`?+U1iN?%!q+2YPBHAyCL>m zaz@6Od2Y8aSEGL@{8|3PMtjdAQm>3q$ZG=a=2Xe}K54nsbd$0T#qECY^LqDd-WMl? zPh(}4DQLQ#9*%;btzUwSD8At_*;&W(n&uRdu{h=(u2JgB7!y_lk1o=fANAN4NG8HI zDyMz3L^d;h_m+uK@;lv{p(qoj2L*Y>s+c|?3RbgQ$aC@?X^?1p5(Nu~(Z}LwuR`Do z4tNNuU$v6>r`>fQEnu3`7ktUmy+Ied_27QKfFla;Q9{T`zaoo){}qbc7Q+)8h};a3 zdZ1$myip-#w=1ecS7L^8WgMV3>)n;97e^}n$rL1{ajIq1(9NTPsp8)c3=S@bf3}>p zT1#&`u2JkY0TXFCB8{5NC?Z|bJf87tQQI%@WB~_k4d=v-kqD#T9p)@XCe+zBBV)zC z2efy6^T+{PH0>i2{&>4gZ;91HyZq!%qupXt=Djm~qUqpr;`q5bxwKn0GlI;!ac~t% z)N2a3idmvj6jzeLvY#jxgwL?)i$W=f|B(md5Z9qmok;u&C-@AXNK2>Fh@BYW+4wlH za!aff%V0)`UXpVUrT7QdEr_BwZuV2_4oKt4^_;IYd`Y;A0+NBHo?iMp?m`K_<2D&7 zM9+JG*Y)#xfxX%=?OxB`c=zc-C^w#azQDGmNWK_dBL zrJ>RZoBL&~Ht(1Scs!Eet+NF`MzUS%s>2h#FUGEy4^LIvO z5^-&UhnJT^_631{H&Kksr)dC>CM0B;S z_Fh9BVSYa7d$>jfpY@%NPTg)FxC?#wD$@893lBP&f-b+#;|>t)g_`aUW2 z`XuEeXMfs>`Bft?8k$e_0HOU`!CS&Z&7Nkv`?W5b2rayX(F$V|nhk+%)3U*;xW$$# zD(_0<^H%t@8Lf~il^TMFSWgJewi|)FZU~VBA=oj)kYUqklyVTgQBWmPKRMlAL`W%_ zLc&;4TMNvS5A^%wexA>b<70|LF^UQ9(xUMb-}q=ZV|@b0w&Y7=-4p8m>Ce0Z{*)yo zyFcqla4QVS<*(EBW*hKpPD<*m>PbtXO>{dA%$Uqelr?K}v-NzT9F9;s3ni>4Xlw9~ zb^+3TzoG>)7ykKe8<}FnM92GQaRde#9?p6V<;PnN_9lrdFoT_@Y{iQdcwM{QOJK8{+>DbT_O*~TU)e| z)^?*34fXVQ)2oIUUr@r{it6~>-?1RkJE1vh??-9GV;oW~9ATl>&el{~2(sz(lyUVW zc&y3D$o-Iw-4Lj~ZBA}TUjMtYM%yayj*@Os=E78VJIbWeI(JTiXQ5047LQ%jUODC! z%3dnzXDDoR!I8aAvoEPkFX@sbC53SYm*1!c{wQLL2lbcY7BsV>do{Zm+Qsc-Q~D41#we#!23jckf5EC9Ya)e2pTQNk>f@3H+g6!tuaksu@rJv)e)j* z56{02A_@4h9E0fFu9dvDB!;mvh#6=eyF8bNyfXK|`dEKwxcZgM}9~NJB?uh>R;VmgDCsHkB5cEIye7Vd3 literal 0 HcmV?d00001 From 1cd1983af3ef48521c5a993e31f55a913812d52f Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Tue, 9 Sep 2014 17:13:11 +0800 Subject: [PATCH 23/37] SDK for Swift --- .gitignore | 4 +- Classes/ASIDataCompressor.h | 4 +- Classes/ASIDataCompressor.m | 7 +- Classes/ASIDataDecompressor.h | 4 +- Classes/ASIDataDecompressor.m | 7 +- SCSwift/SCSwift.xcodeproj/project.pbxproj | 638 ++++++++++++++++++++++ SCSwift/SCSwift/Info.plist | 26 + SCSwift/SCSwift/SCSwift.h | 49 ++ SCSwift/SCSwift/SCSwift.swift | 353 ++++++++++++ 9 files changed, 1081 insertions(+), 11 deletions(-) create mode 100644 SCSwift/SCSwift.xcodeproj/project.pbxproj create mode 100644 SCSwift/SCSwift/Info.plist create mode 100644 SCSwift/SCSwift/SCSwift.h create mode 100644 SCSwift/SCSwift/SCSwift.swift diff --git a/.gitignore b/.gitignore index 76f8393d..dcb7d83b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ profile *.mode1v3 External/GHUnit/* .svn -Products \ No newline at end of file +Products +xcuserdata/ +project.xcworkspace/ \ No newline at end of file diff --git a/Classes/ASIDataCompressor.h b/Classes/ASIDataCompressor.h index fb57a1a9..39da2deb 100644 --- a/Classes/ASIDataCompressor.h +++ b/Classes/ASIDataCompressor.h @@ -11,11 +11,9 @@ // Most of the zlib stuff is based on the sample code by Mark Adler available at http://zlib.net #import -#import @interface ASIDataCompressor : NSObject { BOOL streamReady; - z_stream zStream; } // Convenience constructor will call setupStream for you @@ -23,7 +21,7 @@ // Compress the passed chunk of data // Passing YES for shouldFinish will finalize the deflated data - you must pass YES when you are on the last chunk of data -- (NSData *)compressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err shouldFinish:(BOOL)shouldFinish; +- (NSData *)compressBytes:(Byte *)bytes length:(NSUInteger)length error:(NSError **)err shouldFinish:(BOOL)shouldFinish; // Convenience method - pass it some data, and you'll get deflated data back + (NSData *)compressData:(NSData*)uncompressedData error:(NSError **)err; diff --git a/Classes/ASIDataCompressor.m b/Classes/ASIDataCompressor.m index 41dce4e5..f56e8f8f 100644 --- a/Classes/ASIDataCompressor.m +++ b/Classes/ASIDataCompressor.m @@ -8,11 +8,14 @@ #import "ASIDataCompressor.h" #import "ASIHTTPRequest.h" +#import #define DATA_CHUNK_SIZE 262144 // Deal with gzipped data in 256KB chunks #define COMPRESSION_AMOUNT Z_DEFAULT_COMPRESSION -@interface ASIDataCompressor () +@interface ASIDataCompressor () { + z_stream zStream; +} + (NSError *)deflateErrorWithCode:(int)code; @end @@ -66,7 +69,7 @@ - (NSError *)closeStream return nil; } -- (NSData *)compressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err shouldFinish:(BOOL)shouldFinish +- (NSData *)compressBytes:(Byte *)bytes length:(NSUInteger)length error:(NSError **)err shouldFinish:(BOOL)shouldFinish { if (length == 0) return nil; diff --git a/Classes/ASIDataDecompressor.h b/Classes/ASIDataDecompressor.h index 32a40a94..915f8a84 100644 --- a/Classes/ASIDataDecompressor.h +++ b/Classes/ASIDataDecompressor.h @@ -11,18 +11,16 @@ // Most of the zlib stuff is based on the sample code by Mark Adler available at http://zlib.net #import -#import @interface ASIDataDecompressor : NSObject { BOOL streamReady; - z_stream zStream; } // Convenience constructor will call setupStream for you + (id)decompressor; // Uncompress the passed chunk of data -- (NSData *)uncompressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err; +- (NSData *)uncompressBytes:(Byte *)bytes length:(NSUInteger)length error:(NSError **)err; // Convenience method - pass it some deflated data, and you'll get inflated data back + (NSData *)uncompressData:(NSData*)compressedData error:(NSError **)err; diff --git a/Classes/ASIDataDecompressor.m b/Classes/ASIDataDecompressor.m index fa0ef013..3c77b8dc 100644 --- a/Classes/ASIDataDecompressor.m +++ b/Classes/ASIDataDecompressor.m @@ -8,10 +8,13 @@ #import "ASIDataDecompressor.h" #import "ASIHTTPRequest.h" +#import #define DATA_CHUNK_SIZE 262144 // Deal with gzipped data in 256KB chunks -@interface ASIDataDecompressor () +@interface ASIDataDecompressor () { + z_stream zStream; +} + (NSError *)inflateErrorWithCode:(int)code; @end; @@ -65,7 +68,7 @@ - (NSError *)closeStream return nil; } -- (NSData *)uncompressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err +- (NSData *)uncompressBytes:(Byte *)bytes length:(NSUInteger)length error:(NSError **)err { if (length == 0) return nil; diff --git a/SCSwift/SCSwift.xcodeproj/project.pbxproj b/SCSwift/SCSwift.xcodeproj/project.pbxproj new file mode 100644 index 00000000..e9540e42 --- /dev/null +++ b/SCSwift/SCSwift.xcodeproj/project.pbxproj @@ -0,0 +1,638 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + AD2705CD19BEF3CE00CF1A64 /* ASIAuthenticationDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27057919BEF3CE00CF1A64 /* ASIAuthenticationDialog.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705CE19BEF3CE00CF1A64 /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27057A19BEF3CE00CF1A64 /* ASIAuthenticationDialog.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705CF19BEF3CE00CF1A64 /* ASICacheDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27057B19BEF3CE00CF1A64 /* ASICacheDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705D019BEF3CE00CF1A64 /* ASIDataCompressor.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27057C19BEF3CE00CF1A64 /* ASIDataCompressor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705D119BEF3CE00CF1A64 /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27057D19BEF3CE00CF1A64 /* ASIDataCompressor.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705D219BEF3CE00CF1A64 /* ASIDataDecompressor.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27057E19BEF3CE00CF1A64 /* ASIDataDecompressor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705D319BEF3CE00CF1A64 /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27057F19BEF3CE00CF1A64 /* ASIDataDecompressor.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705D419BEF3CE00CF1A64 /* ASIDownloadCache.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27058019BEF3CE00CF1A64 /* ASIDownloadCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705D519BEF3CE00CF1A64 /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27058119BEF3CE00CF1A64 /* ASIDownloadCache.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705D619BEF3CE00CF1A64 /* ASIFormDataRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27058219BEF3CE00CF1A64 /* ASIFormDataRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705D719BEF3CE00CF1A64 /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27058319BEF3CE00CF1A64 /* ASIFormDataRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705D819BEF3CE00CF1A64 /* ASIHTTPRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27058419BEF3CE00CF1A64 /* ASIHTTPRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705D919BEF3CE00CF1A64 /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27058519BEF3CE00CF1A64 /* ASIHTTPRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705DA19BEF3CE00CF1A64 /* ASIHTTPRequestConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27058619BEF3CE00CF1A64 /* ASIHTTPRequestConfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705DB19BEF3CE00CF1A64 /* ASIHTTPRequestDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27058719BEF3CE00CF1A64 /* ASIHTTPRequestDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705DC19BEF3CE00CF1A64 /* ASIInputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27058819BEF3CE00CF1A64 /* ASIInputStream.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705DD19BEF3CE00CF1A64 /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27058919BEF3CE00CF1A64 /* ASIInputStream.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705DE19BEF3CE00CF1A64 /* ASINetworkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27058A19BEF3CE00CF1A64 /* ASINetworkQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705DF19BEF3CE00CF1A64 /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27058B19BEF3CE00CF1A64 /* ASINetworkQueue.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705E019BEF3CE00CF1A64 /* ASIProgressDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27058C19BEF3CE00CF1A64 /* ASIProgressDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705E119BEF3CE00CF1A64 /* ASIWebPageRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27058E19BEF3CE00CF1A64 /* ASIWebPageRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705E219BEF3CE00CF1A64 /* ASIWebPageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27058F19BEF3CE00CF1A64 /* ASIWebPageRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705E319BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27059119BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705E419BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27059219BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705E519BEF3CE00CF1A64 /* ASICloudFilesContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27059319BEF3CE00CF1A64 /* ASICloudFilesContainer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705E619BEF3CE00CF1A64 /* ASICloudFilesContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27059419BEF3CE00CF1A64 /* ASICloudFilesContainer.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705E719BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27059519BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705E819BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27059619BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705E919BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27059719BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705EA19BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27059819BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705EB19BEF3CE00CF1A64 /* ASICloudFilesObject.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27059919BEF3CE00CF1A64 /* ASICloudFilesObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705EC19BEF3CE00CF1A64 /* ASICloudFilesObject.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27059A19BEF3CE00CF1A64 /* ASICloudFilesObject.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705ED19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27059B19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705EE19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27059C19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705EF19BEF3CE00CF1A64 /* ASICloudFilesRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27059D19BEF3CE00CF1A64 /* ASICloudFilesRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705F019BEF3CE00CF1A64 /* ASICloudFilesRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27059E19BEF3CE00CF1A64 /* ASICloudFilesRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705F119BEF3CE00CF1A64 /* ASINSXMLParserCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2705A019BEF3CE00CF1A64 /* ASINSXMLParserCompat.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705F219BEF3CE00CF1A64 /* ASIS3Bucket.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2705A119BEF3CE00CF1A64 /* ASIS3Bucket.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705F319BEF3CE00CF1A64 /* ASIS3Bucket.m in Sources */ = {isa = PBXBuildFile; fileRef = AD2705A219BEF3CE00CF1A64 /* ASIS3Bucket.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705F419BEF3CE00CF1A64 /* ASIS3BucketObject.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2705A319BEF3CE00CF1A64 /* ASIS3BucketObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705F519BEF3CE00CF1A64 /* ASIS3BucketObject.m in Sources */ = {isa = PBXBuildFile; fileRef = AD2705A419BEF3CE00CF1A64 /* ASIS3BucketObject.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705F619BEF3CE00CF1A64 /* ASIS3BucketRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2705A519BEF3CE00CF1A64 /* ASIS3BucketRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705F719BEF3CE00CF1A64 /* ASIS3BucketRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD2705A619BEF3CE00CF1A64 /* ASIS3BucketRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705F819BEF3CE00CF1A64 /* ASIS3ObjectRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2705A719BEF3CE00CF1A64 /* ASIS3ObjectRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705F919BEF3CE00CF1A64 /* ASIS3ObjectRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD2705A819BEF3CE00CF1A64 /* ASIS3ObjectRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705FA19BEF3CE00CF1A64 /* ASIS3Request.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2705A919BEF3CE00CF1A64 /* ASIS3Request.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705FB19BEF3CE00CF1A64 /* ASIS3Request.m in Sources */ = {isa = PBXBuildFile; fileRef = AD2705AA19BEF3CE00CF1A64 /* ASIS3Request.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD2705FC19BEF3CE00CF1A64 /* ASIS3ServiceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2705AB19BEF3CE00CF1A64 /* ASIS3ServiceRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD2705FD19BEF3CE00CF1A64 /* ASIS3ServiceRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = AD2705AC19BEF3CE00CF1A64 /* ASIS3ServiceRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + AD27062419BEF3DA00CF1A64 /* Reachability.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27062119BEF3DA00CF1A64 /* Reachability.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AD27062519BEF3DA00CF1A64 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27062219BEF3DA00CF1A64 /* Reachability.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + ADA0EC3719B993640027793D /* SCSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = ADA0EC3619B993640027793D /* SCSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; + ADA0ECB719B996AB0027793D /* SCSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADA0ECB619B996AB0027793D /* SCSwift.swift */; }; + ADA0ECB919B996FB0027793D /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ADA0ECB819B996FB0027793D /* libz.dylib */; }; + ADA0ECBB19B997010027793D /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ADA0ECBA19B997010027793D /* libxml2.dylib */; }; + ADA0ECBD19B997070027793D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADA0ECBC19B997070027793D /* UIKit.framework */; }; + ADA0ECBF19B9970E0027793D /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADA0ECBE19B9970E0027793D /* CoreFoundation.framework */; }; + ADA0ECC119B997150027793D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADA0ECC019B997150027793D /* Foundation.framework */; }; + ADA0ECC319B9971C0027793D /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADA0ECC219B9971C0027793D /* MobileCoreServices.framework */; }; + ADA0ECC519B997220027793D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADA0ECC419B997220027793D /* SystemConfiguration.framework */; }; + ADA0ECC719B9972D0027793D /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADA0ECC619B9972D0027793D /* CFNetwork.framework */; }; + ADA0ECC919B997370027793D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADA0ECC819B997370027793D /* CoreGraphics.framework */; }; + ADA0ECCC19B99C860027793D /* SCSwift.swift in Resources */ = {isa = PBXBuildFile; fileRef = ADA0ECB619B996AB0027793D /* SCSwift.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + AD27057919BEF3CE00CF1A64 /* ASIAuthenticationDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIAuthenticationDialog.h; sourceTree = ""; }; + AD27057A19BEF3CE00CF1A64 /* ASIAuthenticationDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIAuthenticationDialog.m; sourceTree = ""; }; + AD27057B19BEF3CE00CF1A64 /* ASICacheDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICacheDelegate.h; sourceTree = ""; }; + AD27057C19BEF3CE00CF1A64 /* ASIDataCompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDataCompressor.h; sourceTree = ""; }; + AD27057D19BEF3CE00CF1A64 /* ASIDataCompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIDataCompressor.m; sourceTree = ""; }; + AD27057E19BEF3CE00CF1A64 /* ASIDataDecompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDataDecompressor.h; sourceTree = ""; }; + AD27057F19BEF3CE00CF1A64 /* ASIDataDecompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIDataDecompressor.m; sourceTree = ""; }; + AD27058019BEF3CE00CF1A64 /* ASIDownloadCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDownloadCache.h; sourceTree = ""; }; + AD27058119BEF3CE00CF1A64 /* ASIDownloadCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIDownloadCache.m; sourceTree = ""; }; + AD27058219BEF3CE00CF1A64 /* ASIFormDataRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIFormDataRequest.h; sourceTree = ""; }; + AD27058319BEF3CE00CF1A64 /* ASIFormDataRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIFormDataRequest.m; sourceTree = ""; }; + AD27058419BEF3CE00CF1A64 /* ASIHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIHTTPRequest.h; sourceTree = ""; }; + AD27058519BEF3CE00CF1A64 /* ASIHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIHTTPRequest.m; sourceTree = ""; }; + AD27058619BEF3CE00CF1A64 /* ASIHTTPRequestConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIHTTPRequestConfig.h; sourceTree = ""; }; + AD27058719BEF3CE00CF1A64 /* ASIHTTPRequestDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIHTTPRequestDelegate.h; sourceTree = ""; }; + AD27058819BEF3CE00CF1A64 /* ASIInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIInputStream.h; sourceTree = ""; }; + AD27058919BEF3CE00CF1A64 /* ASIInputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIInputStream.m; sourceTree = ""; }; + AD27058A19BEF3CE00CF1A64 /* ASINetworkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASINetworkQueue.h; sourceTree = ""; }; + AD27058B19BEF3CE00CF1A64 /* ASINetworkQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASINetworkQueue.m; sourceTree = ""; }; + AD27058C19BEF3CE00CF1A64 /* ASIProgressDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIProgressDelegate.h; sourceTree = ""; }; + AD27058E19BEF3CE00CF1A64 /* ASIWebPageRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIWebPageRequest.h; sourceTree = ""; }; + AD27058F19BEF3CE00CF1A64 /* ASIWebPageRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIWebPageRequest.m; sourceTree = ""; }; + AD27059119BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICloudFilesCDNRequest.h; sourceTree = ""; }; + AD27059219BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASICloudFilesCDNRequest.m; sourceTree = ""; }; + AD27059319BEF3CE00CF1A64 /* ASICloudFilesContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICloudFilesContainer.h; sourceTree = ""; }; + AD27059419BEF3CE00CF1A64 /* ASICloudFilesContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASICloudFilesContainer.m; sourceTree = ""; }; + AD27059519BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICloudFilesContainerRequest.h; sourceTree = ""; }; + AD27059619BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASICloudFilesContainerRequest.m; sourceTree = ""; }; + AD27059719BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICloudFilesContainerXMLParserDelegate.h; sourceTree = ""; }; + AD27059819BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASICloudFilesContainerXMLParserDelegate.m; sourceTree = ""; }; + AD27059919BEF3CE00CF1A64 /* ASICloudFilesObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICloudFilesObject.h; sourceTree = ""; }; + AD27059A19BEF3CE00CF1A64 /* ASICloudFilesObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASICloudFilesObject.m; sourceTree = ""; }; + AD27059B19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICloudFilesObjectRequest.h; sourceTree = ""; }; + AD27059C19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASICloudFilesObjectRequest.m; sourceTree = ""; }; + AD27059D19BEF3CE00CF1A64 /* ASICloudFilesRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICloudFilesRequest.h; sourceTree = ""; }; + AD27059E19BEF3CE00CF1A64 /* ASICloudFilesRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASICloudFilesRequest.m; sourceTree = ""; }; + AD2705A019BEF3CE00CF1A64 /* ASINSXMLParserCompat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASINSXMLParserCompat.h; sourceTree = ""; }; + AD2705A119BEF3CE00CF1A64 /* ASIS3Bucket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIS3Bucket.h; sourceTree = ""; }; + AD2705A219BEF3CE00CF1A64 /* ASIS3Bucket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIS3Bucket.m; sourceTree = ""; }; + AD2705A319BEF3CE00CF1A64 /* ASIS3BucketObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIS3BucketObject.h; sourceTree = ""; }; + AD2705A419BEF3CE00CF1A64 /* ASIS3BucketObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIS3BucketObject.m; sourceTree = ""; }; + AD2705A519BEF3CE00CF1A64 /* ASIS3BucketRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIS3BucketRequest.h; sourceTree = ""; }; + AD2705A619BEF3CE00CF1A64 /* ASIS3BucketRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIS3BucketRequest.m; sourceTree = ""; }; + AD2705A719BEF3CE00CF1A64 /* ASIS3ObjectRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIS3ObjectRequest.h; sourceTree = ""; }; + AD2705A819BEF3CE00CF1A64 /* ASIS3ObjectRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIS3ObjectRequest.m; sourceTree = ""; }; + AD2705A919BEF3CE00CF1A64 /* ASIS3Request.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIS3Request.h; sourceTree = ""; }; + AD2705AA19BEF3CE00CF1A64 /* ASIS3Request.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIS3Request.m; sourceTree = ""; }; + AD2705AB19BEF3CE00CF1A64 /* ASIS3ServiceRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIS3ServiceRequest.h; sourceTree = ""; }; + AD2705AC19BEF3CE00CF1A64 /* ASIS3ServiceRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIS3ServiceRequest.m; sourceTree = ""; }; + AD27062119BEF3DA00CF1A64 /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; + AD27062219BEF3DA00CF1A64 /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; + ADA0EC3119B993640027793D /* SCSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SCSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + ADA0EC3519B993640027793D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + ADA0EC3619B993640027793D /* SCSwift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCSwift.h; sourceTree = ""; }; + ADA0ECB619B996AB0027793D /* SCSwift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SCSwift.swift; sourceTree = ""; }; + ADA0ECB819B996FB0027793D /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + ADA0ECBA19B997010027793D /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; + ADA0ECBC19B997070027793D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + ADA0ECBE19B9970E0027793D /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + ADA0ECC019B997150027793D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + ADA0ECC219B9971C0027793D /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; + ADA0ECC419B997220027793D /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + ADA0ECC619B9972D0027793D /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; + ADA0ECC819B997370027793D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + ADA0EC2D19B993640027793D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ADA0ECC919B997370027793D /* CoreGraphics.framework in Frameworks */, + ADA0ECC719B9972D0027793D /* CFNetwork.framework in Frameworks */, + ADA0ECC519B997220027793D /* SystemConfiguration.framework in Frameworks */, + ADA0ECC319B9971C0027793D /* MobileCoreServices.framework in Frameworks */, + ADA0ECC119B997150027793D /* Foundation.framework in Frameworks */, + ADA0ECBF19B9970E0027793D /* CoreFoundation.framework in Frameworks */, + ADA0ECBD19B997070027793D /* UIKit.framework in Frameworks */, + ADA0ECBB19B997010027793D /* libxml2.dylib in Frameworks */, + ADA0ECB919B996FB0027793D /* libz.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + AD27057819BEF3CE00CF1A64 /* Classes */ = { + isa = PBXGroup; + children = ( + AD27057919BEF3CE00CF1A64 /* ASIAuthenticationDialog.h */, + AD27057A19BEF3CE00CF1A64 /* ASIAuthenticationDialog.m */, + AD27057B19BEF3CE00CF1A64 /* ASICacheDelegate.h */, + AD27057C19BEF3CE00CF1A64 /* ASIDataCompressor.h */, + AD27057D19BEF3CE00CF1A64 /* ASIDataCompressor.m */, + AD27057E19BEF3CE00CF1A64 /* ASIDataDecompressor.h */, + AD27057F19BEF3CE00CF1A64 /* ASIDataDecompressor.m */, + AD27058019BEF3CE00CF1A64 /* ASIDownloadCache.h */, + AD27058119BEF3CE00CF1A64 /* ASIDownloadCache.m */, + AD27058219BEF3CE00CF1A64 /* ASIFormDataRequest.h */, + AD27058319BEF3CE00CF1A64 /* ASIFormDataRequest.m */, + AD27058419BEF3CE00CF1A64 /* ASIHTTPRequest.h */, + AD27058519BEF3CE00CF1A64 /* ASIHTTPRequest.m */, + AD27058619BEF3CE00CF1A64 /* ASIHTTPRequestConfig.h */, + AD27058719BEF3CE00CF1A64 /* ASIHTTPRequestDelegate.h */, + AD27058819BEF3CE00CF1A64 /* ASIInputStream.h */, + AD27058919BEF3CE00CF1A64 /* ASIInputStream.m */, + AD27058A19BEF3CE00CF1A64 /* ASINetworkQueue.h */, + AD27058B19BEF3CE00CF1A64 /* ASINetworkQueue.m */, + AD27058C19BEF3CE00CF1A64 /* ASIProgressDelegate.h */, + AD27058D19BEF3CE00CF1A64 /* ASIWebPageRequest */, + AD27059019BEF3CE00CF1A64 /* CloudFiles */, + AD27059F19BEF3CE00CF1A64 /* S3 */, + ); + name = Classes; + path = ../Classes; + sourceTree = ""; + }; + AD27058D19BEF3CE00CF1A64 /* ASIWebPageRequest */ = { + isa = PBXGroup; + children = ( + AD27058E19BEF3CE00CF1A64 /* ASIWebPageRequest.h */, + AD27058F19BEF3CE00CF1A64 /* ASIWebPageRequest.m */, + ); + path = ASIWebPageRequest; + sourceTree = ""; + }; + AD27059019BEF3CE00CF1A64 /* CloudFiles */ = { + isa = PBXGroup; + children = ( + AD27059119BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.h */, + AD27059219BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.m */, + AD27059319BEF3CE00CF1A64 /* ASICloudFilesContainer.h */, + AD27059419BEF3CE00CF1A64 /* ASICloudFilesContainer.m */, + AD27059519BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.h */, + AD27059619BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.m */, + AD27059719BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.h */, + AD27059819BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.m */, + AD27059919BEF3CE00CF1A64 /* ASICloudFilesObject.h */, + AD27059A19BEF3CE00CF1A64 /* ASICloudFilesObject.m */, + AD27059B19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.h */, + AD27059C19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.m */, + AD27059D19BEF3CE00CF1A64 /* ASICloudFilesRequest.h */, + AD27059E19BEF3CE00CF1A64 /* ASICloudFilesRequest.m */, + ); + path = CloudFiles; + sourceTree = ""; + }; + AD27059F19BEF3CE00CF1A64 /* S3 */ = { + isa = PBXGroup; + children = ( + AD2705A019BEF3CE00CF1A64 /* ASINSXMLParserCompat.h */, + AD2705A119BEF3CE00CF1A64 /* ASIS3Bucket.h */, + AD2705A219BEF3CE00CF1A64 /* ASIS3Bucket.m */, + AD2705A319BEF3CE00CF1A64 /* ASIS3BucketObject.h */, + AD2705A419BEF3CE00CF1A64 /* ASIS3BucketObject.m */, + AD2705A519BEF3CE00CF1A64 /* ASIS3BucketRequest.h */, + AD2705A619BEF3CE00CF1A64 /* ASIS3BucketRequest.m */, + AD2705A719BEF3CE00CF1A64 /* ASIS3ObjectRequest.h */, + AD2705A819BEF3CE00CF1A64 /* ASIS3ObjectRequest.m */, + AD2705A919BEF3CE00CF1A64 /* ASIS3Request.h */, + AD2705AA19BEF3CE00CF1A64 /* ASIS3Request.m */, + AD2705AB19BEF3CE00CF1A64 /* ASIS3ServiceRequest.h */, + AD2705AC19BEF3CE00CF1A64 /* ASIS3ServiceRequest.m */, + ); + path = S3; + sourceTree = ""; + }; + AD27061D19BEF3DA00CF1A64 /* External */ = { + isa = PBXGroup; + children = ( + AD27062019BEF3DA00CF1A64 /* Reachability */, + ); + name = External; + path = ../External; + sourceTree = ""; + }; + AD27062019BEF3DA00CF1A64 /* Reachability */ = { + isa = PBXGroup; + children = ( + AD27062119BEF3DA00CF1A64 /* Reachability.h */, + AD27062219BEF3DA00CF1A64 /* Reachability.m */, + ); + path = Reachability; + sourceTree = ""; + }; + ADA0EC2719B993640027793D = { + isa = PBXGroup; + children = ( + AD27057819BEF3CE00CF1A64 /* Classes */, + AD27061D19BEF3DA00CF1A64 /* External */, + ADA0EC3319B993640027793D /* SCSwift */, + ADA0ECCA19B997B40027793D /* Frameworks */, + ADA0EC3219B993640027793D /* Products */, + ); + sourceTree = ""; + }; + ADA0EC3219B993640027793D /* Products */ = { + isa = PBXGroup; + children = ( + ADA0EC3119B993640027793D /* SCSwift.framework */, + ); + name = Products; + sourceTree = ""; + }; + ADA0EC3319B993640027793D /* SCSwift */ = { + isa = PBXGroup; + children = ( + ADA0EC3619B993640027793D /* SCSwift.h */, + ADA0ECB619B996AB0027793D /* SCSwift.swift */, + ADA0EC3419B993640027793D /* Supporting Files */, + ); + path = SCSwift; + sourceTree = ""; + }; + ADA0EC3419B993640027793D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + ADA0EC3519B993640027793D /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + ADA0ECCA19B997B40027793D /* Frameworks */ = { + isa = PBXGroup; + children = ( + ADA0ECC819B997370027793D /* CoreGraphics.framework */, + ADA0ECC619B9972D0027793D /* CFNetwork.framework */, + ADA0ECC419B997220027793D /* SystemConfiguration.framework */, + ADA0ECC219B9971C0027793D /* MobileCoreServices.framework */, + ADA0ECC019B997150027793D /* Foundation.framework */, + ADA0ECBE19B9970E0027793D /* CoreFoundation.framework */, + ADA0ECBC19B997070027793D /* UIKit.framework */, + ADA0ECBA19B997010027793D /* libxml2.dylib */, + ADA0ECB819B996FB0027793D /* libz.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + ADA0EC2E19B993640027793D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + AD2705CF19BEF3CE00CF1A64 /* ASICacheDelegate.h in Headers */, + AD2705F419BEF3CE00CF1A64 /* ASIS3BucketObject.h in Headers */, + AD2705DC19BEF3CE00CF1A64 /* ASIInputStream.h in Headers */, + AD2705F119BEF3CE00CF1A64 /* ASINSXMLParserCompat.h in Headers */, + AD2705F619BEF3CE00CF1A64 /* ASIS3BucketRequest.h in Headers */, + AD2705E919BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.h in Headers */, + AD2705EB19BEF3CE00CF1A64 /* ASICloudFilesObject.h in Headers */, + AD2705D419BEF3CE00CF1A64 /* ASIDownloadCache.h in Headers */, + AD2705FC19BEF3CE00CF1A64 /* ASIS3ServiceRequest.h in Headers */, + AD2705ED19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.h in Headers */, + AD2705E019BEF3CE00CF1A64 /* ASIProgressDelegate.h in Headers */, + AD2705FA19BEF3CE00CF1A64 /* ASIS3Request.h in Headers */, + AD2705D019BEF3CE00CF1A64 /* ASIDataCompressor.h in Headers */, + AD27062419BEF3DA00CF1A64 /* Reachability.h in Headers */, + AD2705D619BEF3CE00CF1A64 /* ASIFormDataRequest.h in Headers */, + AD2705DA19BEF3CE00CF1A64 /* ASIHTTPRequestConfig.h in Headers */, + AD2705DB19BEF3CE00CF1A64 /* ASIHTTPRequestDelegate.h in Headers */, + AD2705E519BEF3CE00CF1A64 /* ASICloudFilesContainer.h in Headers */, + AD2705E319BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.h in Headers */, + AD2705E119BEF3CE00CF1A64 /* ASIWebPageRequest.h in Headers */, + AD2705E719BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.h in Headers */, + AD2705D819BEF3CE00CF1A64 /* ASIHTTPRequest.h in Headers */, + AD2705F819BEF3CE00CF1A64 /* ASIS3ObjectRequest.h in Headers */, + AD2705CD19BEF3CE00CF1A64 /* ASIAuthenticationDialog.h in Headers */, + AD2705F219BEF3CE00CF1A64 /* ASIS3Bucket.h in Headers */, + AD2705EF19BEF3CE00CF1A64 /* ASICloudFilesRequest.h in Headers */, + ADA0EC3719B993640027793D /* SCSwift.h in Headers */, + AD2705D219BEF3CE00CF1A64 /* ASIDataDecompressor.h in Headers */, + AD2705DE19BEF3CE00CF1A64 /* ASINetworkQueue.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + ADA0EC3019B993640027793D /* SCSwift */ = { + isa = PBXNativeTarget; + buildConfigurationList = ADA0EC4419B993650027793D /* Build configuration list for PBXNativeTarget "SCSwift" */; + buildPhases = ( + ADA0EC2C19B993640027793D /* Sources */, + ADA0EC2D19B993640027793D /* Frameworks */, + ADA0EC2E19B993640027793D /* Headers */, + ADA0EC2F19B993640027793D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SCSwift; + productName = SCSwift; + productReference = ADA0EC3119B993640027793D /* SCSwift.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + ADA0EC2819B993640027793D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0600; + ORGANIZATIONNAME = Littlebox222; + TargetAttributes = { + ADA0EC3019B993640027793D = { + CreatedOnToolsVersion = 6.0; + }; + }; + }; + buildConfigurationList = ADA0EC2B19B993640027793D /* Build configuration list for PBXProject "SCSwift" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = ADA0EC2719B993640027793D; + productRefGroup = ADA0EC3219B993640027793D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + ADA0EC3019B993640027793D /* SCSwift */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + ADA0EC2F19B993640027793D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ADA0ECCC19B99C860027793D /* SCSwift.swift in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + ADA0EC2C19B993640027793D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AD2705D119BEF3CE00CF1A64 /* ASIDataCompressor.m in Sources */, + AD2705E219BEF3CE00CF1A64 /* ASIWebPageRequest.m in Sources */, + AD2705FD19BEF3CE00CF1A64 /* ASIS3ServiceRequest.m in Sources */, + AD2705EC19BEF3CE00CF1A64 /* ASICloudFilesObject.m in Sources */, + AD2705D719BEF3CE00CF1A64 /* ASIFormDataRequest.m in Sources */, + AD2705DF19BEF3CE00CF1A64 /* ASINetworkQueue.m in Sources */, + AD2705D319BEF3CE00CF1A64 /* ASIDataDecompressor.m in Sources */, + AD2705E619BEF3CE00CF1A64 /* ASICloudFilesContainer.m in Sources */, + AD2705D519BEF3CE00CF1A64 /* ASIDownloadCache.m in Sources */, + AD2705F919BEF3CE00CF1A64 /* ASIS3ObjectRequest.m in Sources */, + AD2705EA19BEF3CE00CF1A64 /* ASICloudFilesContainerXMLParserDelegate.m in Sources */, + AD2705F719BEF3CE00CF1A64 /* ASIS3BucketRequest.m in Sources */, + AD2705F019BEF3CE00CF1A64 /* ASICloudFilesRequest.m in Sources */, + AD2705DD19BEF3CE00CF1A64 /* ASIInputStream.m in Sources */, + AD2705D919BEF3CE00CF1A64 /* ASIHTTPRequest.m in Sources */, + AD2705E419BEF3CE00CF1A64 /* ASICloudFilesCDNRequest.m in Sources */, + AD2705F319BEF3CE00CF1A64 /* ASIS3Bucket.m in Sources */, + ADA0ECB719B996AB0027793D /* SCSwift.swift in Sources */, + AD2705E819BEF3CE00CF1A64 /* ASICloudFilesContainerRequest.m in Sources */, + AD2705EE19BEF3CE00CF1A64 /* ASICloudFilesObjectRequest.m in Sources */, + AD27062519BEF3DA00CF1A64 /* Reachability.m in Sources */, + AD2705FB19BEF3CE00CF1A64 /* ASIS3Request.m in Sources */, + AD2705F519BEF3CE00CF1A64 /* ASIS3BucketObject.m in Sources */, + AD2705CE19BEF3CE00CF1A64 /* ASIAuthenticationDialog.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + ADA0EC4219B993650027793D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = NO; + CLANG_WARN_CONSTANT_CONVERSION = NO; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = NO; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = NO; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = YES; + ENABLE_STRICT_OBJC_MSGSEND = NO; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = NO; + "GCC_WARN_64_TO_32_BIT_CONVERSION[arch=*64]" = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + ADA0EC4319B993650027793D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = NO; + CLANG_WARN_CONSTANT_CONVERSION = NO; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = NO; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = NO; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = YES; + ENABLE_STRICT_OBJC_MSGSEND = NO; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_PREPROCESSOR_DEFINITIONS = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = NO; + "GCC_WARN_64_TO_32_BIT_CONVERSION[arch=*64]" = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + ADA0EC4519B993650027793D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "/Applications/Xcode6-Beta6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", + "$(SDK_DIR)/usr/include/libxml2", + ); + INFOPLIST_FILE = SCSwift/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + ADA0EC4619B993650027793D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "/Applications/Xcode6-Beta6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", + "$(SDK_DIR)/usr/include/libxml2", + ); + INFOPLIST_FILE = SCSwift/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + ADA0EC2B19B993640027793D /* Build configuration list for PBXProject "SCSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ADA0EC4219B993650027793D /* Debug */, + ADA0EC4319B993650027793D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + ADA0EC4419B993650027793D /* Build configuration list for PBXNativeTarget "SCSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ADA0EC4519B993650027793D /* Debug */, + ADA0EC4619B993650027793D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = ADA0EC2819B993640027793D /* Project object */; +} diff --git a/SCSwift/SCSwift/Info.plist b/SCSwift/SCSwift/Info.plist new file mode 100644 index 00000000..ef4a14e3 --- /dev/null +++ b/SCSwift/SCSwift/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.sina.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/SCSwift/SCSwift/SCSwift.h b/SCSwift/SCSwift/SCSwift.h new file mode 100644 index 00000000..bbe9b263 --- /dev/null +++ b/SCSwift/SCSwift/SCSwift.h @@ -0,0 +1,49 @@ +// +// SCSwift.h +// SCSwift +// +// Created by Littlebox222 on 14-9-5. +// Copyright (c) 2014年 Littlebox222. All rights reserved. +// + +#import + +#import "Reachability.h" +#import "ASIAuthenticationDialog.h" +#import "ASIHTTPRequestConfig.h" +#import "ASICacheDelegate.h" +#import "ASIHTTPRequestDelegate.h" +#import "ASIProgressDelegate.h" +#import "ASIInputStream.h" +#import "ASIFormDataRequest.h" +#import "ASIHTTPRequest.h" +#import "ASINetworkQueue.h" +#import "ASIDownloadCache.h" +#import "ASIDataDecompressor.h" +#import "ASIDataCompressor.h" +#import "ASIWebPageRequest.h" + +#import "ASIS3Bucket.h" +#import "ASIS3BucketObject.h" +#import "ASIS3BucketRequest.h" +#import "ASIS3ObjectRequest.h" +#import "ASIS3ServiceRequest.h" +#import "ASIS3Request.h" + +#import "ASICloudFilesCDNRequest.h" +#import "ASICloudFilesContainer.h" +#import "ASICloudFilesContainerRequest.h" +#import "ASICloudFilesContainerXMLParserDelegate.h" +#import "ASICloudFilesObject.h" +#import "ASICloudFilesObjectRequest.h" +#import "ASICloudFilesRequest.h" + +//! Project version number for SCSwift. +FOUNDATION_EXPORT double SCSwiftVersionNumber; + +//! Project version string for SCSwift. +FOUNDATION_EXPORT const unsigned char SCSwiftVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/SCSwift/SCSwift/SCSwift.swift b/SCSwift/SCSwift/SCSwift.swift new file mode 100644 index 00000000..f0f0ffb7 --- /dev/null +++ b/SCSwift/SCSwift/SCSwift.swift @@ -0,0 +1,353 @@ +// +// SCSwift.swift +// SCSwift +// +// Created by Littlebox222 on 14-9-5. +// Copyright (c) 2014年 Littlebox222. All rights reserved. +// + +import Foundation + + +public enum AccessPolicy:String { + case access_private = "private", + access_public_read = "public-read", + access_public_read_write = "public-read-write", + access_authenticated_read = "authenticated-read" +} + +public class SCSServiceRequest:ASIS3ServiceRequest {} +public class SCSBucketRequest:ASIS3BucketRequest {} +public class SCSObjectRquest:ASIS3ObjectRequest {} + +public class SCS { + + var config:Dictionary! + var globleConfig:Dictionary! = [:] + + public class var sharedInstance: SCS { + + struct Static { + static var instance: SCS? + static var token: dispatch_once_t = 0 + } + + dispatch_once(&Static.token) { + Static.instance = SCS() + } + + return Static.instance! + } + + public class func GlobalConfig(accessKey:String!=nil, secretKey:String!=nil, useSSL:Bool!=false, maxConcurrentOperationCount:Int! = 3) { + + SCS.sharedInstance.globleConfig["accessKey"] = accessKey + SCS.sharedInstance.globleConfig["secretKey"] = secretKey + SCS.sharedInstance.globleConfig["useSSL"] = useSSL + SCS.sharedInstance.globleConfig["maxConcurrentOperationCount"] = maxConcurrentOperationCount + } + + internal func configureRequest(request:ASIS3Request) { + + var cfg:Dictionary! + + if (self.config == nil) { + cfg = SCS.sharedInstance.globleConfig + }else { + cfg = self.config + } + + if (cfg["accessKey"] != nil) { + request.accessKey = cfg["accessKey"] as String + } + + if (cfg["secretKey"] != nil) { + request.secretAccessKey = cfg["secretKey"] as String + } + + if (cfg["useSSL"] != nil && cfg["useSSL"] as Bool) { + request.requestScheme = ASIS3RequestSchemeHTTPS + }else { + request.requestScheme = ASIS3RequestSchemeHTTP + } + + if (cfg["maxConcurrentOperationCount"] != nil) { + ASIHTTPRequest.sharedQueue().maxConcurrentOperationCount = cfg["maxConcurrentOperationCount"] as Int + } + } + + //初始化 + public init (accessKey:String! = nil, secretKey:String! = nil, useSSL:Bool! = false, maxConcurrentOperationCount:Int! = 3) { + + if (accessKey != nil || secretKey != nil) { + self.config = [:] + self.config["accessKey"] = accessKey + self.config["secretKey"] = secretKey + self.config["useSSL"] = useSSL + self.config["maxConcurrentOperationCount"] = maxConcurrentOperationCount + } + } + + + //Service + public func listBuckets(started:((SCSServiceRequest)->Void)! = nil, + finished:((SCSServiceRequest)->Void)! = nil, + failed:((SCSServiceRequest)->Void)! = nil, + headerReceived:((SCSServiceRequest)->Void)! = nil, + redirected:((SCSServiceRequest)->Void)! = nil) + { + + let request = SCSServiceRequest.serviceRequest() as SCSServiceRequest + self.configureRequest(request) + + if (started != nil) { + request.setStartedBlock({started(request)}) + } + if (finished != nil) { + request.setCompletionBlock({finished(request)}) + } + if (failed != nil) { + request.setFailedBlock({failed(request)}) + } + if (headerReceived != nil) { + request.setHeadersReceivedBlock({header in headerReceived(request)}) + } + if (redirected != nil) { + request.setRequestRedirectedBlock({redirected(request)}) + } + + request.startAsynchronous() + } + + + //Bucket + public func createBucket(#bucket:String, started:((SCSBucketRequest)->Void)! = nil, + finished:((SCSBucketRequest)->Void)! = nil, + failed:((SCSBucketRequest)->Void)! = nil, + headerReceived:((SCSBucketRequest)->Void)! = nil, + redirected:((SCSBucketRequest)->Void)! = nil) + { + + let request = SCSBucketRequest.PUTRequestWithBucket(bucket as NSString) as SCSBucketRequest + self.configureRequest(request) + + if (started != nil) { + request.setStartedBlock({started(request)}) + } + if (finished != nil) { + request.setCompletionBlock({finished(request)}) + } + if (failed != nil) { + request.setFailedBlock({failed(request)}) + } + if (headerReceived != nil) { + request.setHeadersReceivedBlock({header in headerReceived(request)}) + } + if (redirected != nil) { + request.setRequestRedirectedBlock({redirected(request)}) + } + + request.startAsynchronous() + } + + public func deleteBucket(#bucket:String, started:((SCSBucketRequest)->Void)! = nil, + finished:((SCSBucketRequest)->Void)! = nil, + failed:((SCSBucketRequest)->Void)! = nil, + headerReceived:((SCSBucketRequest)->Void)! = nil, + redirected:((SCSBucketRequest)->Void)! = nil) + { + + let request = SCSBucketRequest.DELETERequestWithBucket(bucket as NSString) as SCSBucketRequest + self.configureRequest(request) + + if (started != nil) { + request.setStartedBlock({started(request)}) + } + if (finished != nil) { + request.setCompletionBlock({finished(request)}) + } + if (failed != nil) { + request.setFailedBlock({failed(request)}) + } + if (headerReceived != nil) { + request.setHeadersReceivedBlock({header in headerReceived(request)}) + } + if (redirected != nil) { + request.setRequestRedirectedBlock({redirected(request)}) + } + + request.startAsynchronous() + } + + //Object + public func listObjects(#param:Dictionary, started:((SCSBucketRequest)->Void)! = nil, + finished:((SCSBucketRequest)->Void)! = nil, + failed:((SCSBucketRequest)->Void)! = nil, + headerReceived:((SCSBucketRequest)->Void)! = nil, + redirected:((SCSBucketRequest)->Void)! = nil) + { + + let request = SCSBucketRequest.requestWithBucket(param["bucket"] as String) as SCSBucketRequest + request.maxResultCount = param["maxKeys"] as Int32 + request.prefix = param["prefix"]! as String + request.delimiter = param["delimiter"]! as String + request.marker = param["marker"]! as String + + self.configureRequest(request) + + if (started != nil) { + request.setStartedBlock({started(request)}) + } + if (finished != nil) { + request.setCompletionBlock({finished(request)}) + } + if (failed != nil) { + request.setFailedBlock({failed(request)}) + } + if (headerReceived != nil) { + request.setHeadersReceivedBlock({header in headerReceived(request)}) + } + if (redirected != nil) { + request.setRequestRedirectedBlock({redirected(request)}) + } + + request.startAsynchronous() + } + + public func uploadObject(#param:Dictionary, started:((SCSObjectRquest)->Void)! = nil, + finished:((SCSObjectRquest)->Void)! = nil, + failed:((SCSObjectRquest)->Void)! = nil, + headerReceived:((SCSObjectRquest)->Void)! = nil, + redirected:((SCSObjectRquest)->Void)! = nil, + progress:((SCSObjectRquest, UInt64, UInt64)->Void)! = nil) + { + + let request = SCSObjectRquest.PUTRequestForFile(param["filePath"], withBucket:param["bucket"], key:param["key"]) as SCSObjectRquest + self.configureRequest(request) + + if (started != nil) { + request.setStartedBlock({started(request)}) + } + if (finished != nil) { + request.setCompletionBlock({finished(request)}) + } + if (failed != nil) { + request.setFailedBlock({failed(request)}) + } + if (headerReceived != nil) { + request.setHeadersReceivedBlock({header in headerReceived(request)}) + } + if (redirected != nil) { + request.setRequestRedirectedBlock({redirected(request)}) + } + if (progress != nil) { + request.setBytesSentBlock({sentSize,total in + progress(request, sentSize, total) + }) + } + + request.timeOutSeconds = 60 + request.accessPolicy = param["accessPolicy"] + request.addRequestHeader("Expect", value:"100-continue") + request.showAccurateProgress = true + + request.startAsynchronous() + } + + public func downloadObject(#param:Dictionary, started:((SCSObjectRquest)->Void)! = nil, + finished:((SCSObjectRquest)->Void)! = nil, + failed:((SCSObjectRquest)->Void)! = nil, + headerReceived:((SCSObjectRquest)->Void)! = nil, + redirected:((SCSObjectRquest)->Void)! = nil, + progress:((SCSObjectRquest, UInt64, UInt64)->Void)! = nil) + { + + let request = SCSObjectRquest.requestWithBucket(param["bucket"], key: param["key"]) as SCSObjectRquest + self.configureRequest(request) + + if (started != nil) { + request.setStartedBlock({started(request)}) + } + if (finished != nil) { + request.setCompletionBlock({finished(request)}) + } + if (failed != nil) { + request.setFailedBlock({failed(request)}) + } + if (headerReceived != nil) { + request.setHeadersReceivedBlock({header in headerReceived(request)}) + } + if (redirected != nil) { + request.setRequestRedirectedBlock({redirected(request)}) + } + if (progress != nil) { + request.setBytesReceivedBlock({sentSize,total in + progress(request, sentSize, total) + }) + } + + request.downloadDestinationPath = param["downloadDestinationPath"] + request.showAccurateProgress = true + request.startAsynchronous() + } + + public func copyObject(#param:Dictionary, started:((SCSObjectRquest)->Void)! = nil, + finished:((SCSObjectRquest)->Void)! = nil, + failed:((SCSObjectRquest)->Void)! = nil, + headerReceived:((SCSObjectRquest)->Void)! = nil, + redirected:((SCSObjectRquest)->Void)! = nil) + { + + let request = SCSObjectRquest.COPYRequestFromBucket(param["srcBucket"], key: param["srcKey"], toBucket: param["desBucket"], key: param["desKey"]) as SCSObjectRquest + self.configureRequest(request) + + if (started != nil) { + request.setStartedBlock({started(request)}) + } + if (finished != nil) { + request.setCompletionBlock({finished(request)}) + } + if (failed != nil) { + request.setFailedBlock({failed(request)}) + } + if (headerReceived != nil) { + request.setHeadersReceivedBlock({header in headerReceived(request)}) + } + if (redirected != nil) { + request.setRequestRedirectedBlock({redirected(request)}) + } + + request.startAsynchronous() + } + + public func deleteObject(#param:Dictionary, started:((SCSObjectRquest)->Void)! = nil, + finished:((SCSObjectRquest)->Void)! = nil, + failed:((SCSObjectRquest)->Void)! = nil, + headerReceived:((SCSObjectRquest)->Void)! = nil, + redirected:((SCSObjectRquest)->Void)! = nil) + { + + let request = SCSObjectRquest.DELETERequestWithBucket(param["bucket"], key: param["key"]) as SCSObjectRquest + self.configureRequest(request) + + if (started != nil) { + request.setStartedBlock({started(request)}) + } + if (finished != nil) { + request.setCompletionBlock({finished(request)}) + } + if (failed != nil) { + request.setFailedBlock({failed(request)}) + } + if (headerReceived != nil) { + request.setHeadersReceivedBlock({header in headerReceived(request)}) + } + if (redirected != nil) { + request.setRequestRedirectedBlock({redirected(request)}) + } + + request.startAsynchronous() + } + + //ACL +} \ No newline at end of file From 0ee05cbe1713de7ea8b7121121016e7a484e7dcd Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Tue, 9 Sep 2014 17:34:38 +0800 Subject: [PATCH 24/37] add readme --- SCSwift/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 SCSwift/README.md diff --git a/SCSwift/README.md b/SCSwift/README.md new file mode 100644 index 00000000..e7bfdbb5 --- /dev/null +++ b/SCSwift/README.md @@ -0,0 +1,2 @@ +SCSwift +======= From 26ced0a7948f8cb5d4c6065aa1ac8abfa81b9f75 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 10 Sep 2014 21:45:04 +0800 Subject: [PATCH 25/37] update readme --- SCSwift/README.md | 209 ++++++++++++++++++++++ SCSwift/SCSwift.xcodeproj/project.pbxproj | 60 ++++++- SCSwift/SCSwift/SCSwift.h | 1 + 3 files changed, 268 insertions(+), 2 deletions(-) diff --git a/SCSwift/README.md b/SCSwift/README.md index e7bfdbb5..8d9630eb 100644 --- a/SCSwift/README.md +++ b/SCSwift/README.md @@ -1,2 +1,211 @@ SCSwift ======= + +新浪云存储(SCS)for Swift。 + +### SDK环境要求 +####系统版本: +> * iOS: 8.0及以上。 + +####相关配置: +> * 1、下载SCSwift.framework(你可以手动下载,链接如下;也可以执行步骤(1)—(4),写脚本由程序自动下载) +>> * http://sdk.sinastorage.cn/SCSwift.framework.zip +>> * (1)、打开工程,单击XCode侧边栏中的project行,并选择右侧的Build Phase; +>> * (2)、选择项目的Target,在顶部菜单栏选择Editor > Add Build Phase > Add Run Script Build Phase; +>> * (3)、设置Run Script如下; +>> * (4)、Commond+B编译工程,会自动下载所需的SCSwift.framework包到工程目录。 + +> * 2、添加下载的framework到工程 +>> * 选择Link Binary With Libraries; +>> * 点击“+”; +>> * 点击“Add Other...”,到工程目录下选择添加SCSwift.Framework; +>> * (或者将下载好的SCSwift.Framework直接拖到xcode工程里的Frameworks分组下;) +>> * (在Add to targets里选中你所要关联的target。) +>> * 选择Copy Files,设置Destination为Frameworks; +>> * 点击“+”,选择SCSwift.framework。 + +> * 3、在所需文件中添加:import SCSwift + +```shell +# If not present, download SCSwift archive, extract it and cleanup. + if [ ! -e $SRCROOT/SCSwift.framework ]; then + rm -rf $SRCROOT/SCSwift + mkdir $SRCROOT/SCSwift + cd $SRCROOT/SCSwift + echo "Downloading SCSwift framework" + curl -s -O http://sdk.sinastorage.cn/SCSwift.framework.zip + echo "Unzipping SCSwift" + unzip SCSwift.framework.zip + mv SCSwift.framework $SRCROOT + rm -rf $SRCROOT/SCSwift + echo "SCSwift installed for build" +fi +``` + + +###快速上手 +####初始化 +#####方法1: +```Swift +//全局生效 +SCS.GlobalConfig(accessKey:"YOUR ACCESS KEY", secretKey:"YOU SECRET KEY", useSSL:false, maxConcurrentOperationCount:5) + +//useSSL缺省为false,最大并发数maxConcurrentOperationCount缺省为3 +``` + +#####方法2: +```Swift +//当前实例生效 +var scs = SCS(accessKey:"YOUR ACCESS KEY", secretKey:"YOU SECRET KEY", useSSL:true) +``` + +#####方法3: +```Swift +//方法3 全局设置,并使实例生效 +SCS.GlobalConfig(accessKey:"YOUR ACCESS KEY", secretKey:"YOU SECRET KEY", useSSL:true) +var scs = SCS() +``` + +####Bucket操作 +#####列取bucket +```Swift +SCS.sharedInstance.listBuckets( + finished: { request in + let list = NSString(format:"%@", request.buckets) as String + println(list) + }, + failed: { request in + let error = NSString(format:"%@", request.error) as String + println(error) + } +) +``` + +#####创建bucket +```Swift +SCS.sharedInstance.createBucket( + bucket:"BucketName", + finished:{request in + let list = NSString(format:"%@ created", request.bucket) as String + println(list) + }, + failed:{request in + let error = NSString(format:"%@", request.error) as String + println(error) + } +) +``` + +#####删除bucket +```Swift +SCS.sharedInstance.deleteBucket( + bucket:"BucketName", + finished:{request in + let bucket = NSString(format:"%@ deleted", request.bucket) as String + println(bucket) + }, + failed:{request in + let error = NSString(format:"%@", request.error) as String + println(error) + } +) +``` + +####Object操作 +#####列取object +```Swift +SCS.sharedInstance.listObjects( + param: ["bucket":"BucketName" as String, + "maxKeys":3 as Int32, + "prefix":"YourPrefix/" as String, + "delimiter":"/" as String, + "marker":"" as String], + finished:{request in + let objects = NSString(format:"%@", request.objects) as String + println(objects) + }, + failed:{request in + let error = NSString(format:"%@", request.error) as String + println(error) + } +) +``` + +#####上传object +```Swift +let filePath:String = "YourFilePath" + +SCS.sharedInstance.uploadObject( + param: ["filePath":filePath, + "bucket":"BucketName", + "key":"FileKey", + "accessPolicy":AccessPolicy.access_private.toRaw()], + finished:{request in + let object = NSString(format:"%@ uploaded", request.key) as String + println(object) + }, + failed:{request in + let error = NSString(format:"%@", request.error) as String + println(error) + }, + progress:{request, sentSize, totalSize in + println("uploaded bytes: \(sentSize) in total: \(totalSize)") + } +) +``` + +#####下载object +```Swift +let downloadPath = "YourDownloadPath" + +SCS.sharedInstance.downloadObject( + param: ["bucket":"BucketName", + "key":"FileKey", + "downloadDestinationPath":downloadPath], + finished:{request in + let object = NSString(format:"%@ downloaded", request.downloadDestinationPath) as String + println(object) + }, + failed:{request in + let error = NSString(format:"%@", request.error) as String + println(error) + }, + progress:{request, sentSize, totalSize in + println("downloaded bytes: \(sentSize) in total: \(totalSize)") + } +) +``` + +#####删除object +```Swift +SCS.sharedInstance.deleteObject( + param: ["bucket":"BucketName", + "key":"FileKey"], + finished:{request in + let object = NSString(format:"%@ deleted", request.key) as String + println(object) + }, + failed:{request in + let error = NSString(format:"%@", request.error) as String + println(error) + } +) +``` + +#####拷贝object +```Swift +SCS.sharedInstance.copyObject( + param: ["srcBucket":"SourceBucketName", + "srcKey":"SourceFileKey", + "desBucket":"DestinationBucketName", + "desKey":"DestinationFileKey"], + finished:{request in + let object = NSString(format:"Object %@ has been copied to %@", request.sourceKey, request.key) as String + println(object) + }, + failed:{request in + let error = NSString(format:"%@", request.error) as String + println(error) + } +) +``` diff --git a/SCSwift/SCSwift.xcodeproj/project.pbxproj b/SCSwift/SCSwift.xcodeproj/project.pbxproj index e9540e42..2522fb40 100644 --- a/SCSwift/SCSwift.xcodeproj/project.pbxproj +++ b/SCSwift/SCSwift.xcodeproj/project.pbxproj @@ -6,6 +6,20 @@ objectVersion = 46; objects = { +/* Begin PBXAggregateTarget section */ + AD95CB2819C0842E007B0E3D /* SCSwift-iOS */ = { + isa = PBXAggregateTarget; + buildConfigurationList = AD95CB2919C0842E007B0E3D /* Build configuration list for PBXAggregateTarget "SCSwift-iOS" */; + buildPhases = ( + AD95CB2C19C08437007B0E3D /* ShellScript */, + ); + dependencies = ( + ); + name = "SCSwift-iOS"; + productName = "SCSwift-iOS"; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ AD2705CD19BEF3CE00CF1A64 /* ASIAuthenticationDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = AD27057919BEF3CE00CF1A64 /* ASIAuthenticationDialog.h */; settings = {ATTRIBUTES = (Public, ); }; }; AD2705CE19BEF3CE00CF1A64 /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = AD27057A19BEF3CE00CF1A64 /* ASIAuthenticationDialog.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; @@ -380,6 +394,9 @@ LastUpgradeCheck = 0600; ORGANIZATIONNAME = Littlebox222; TargetAttributes = { + AD95CB2819C0842E007B0E3D = { + CreatedOnToolsVersion = 6.0; + }; ADA0EC3019B993640027793D = { CreatedOnToolsVersion = 6.0; }; @@ -398,6 +415,7 @@ projectRoot = ""; targets = ( ADA0EC3019B993640027793D /* SCSwift */, + AD95CB2819C0842E007B0E3D /* SCSwift-iOS */, ); }; /* End PBXProject section */ @@ -413,6 +431,22 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + AD95CB2C19C08437007B0E3D /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\nUNIVERSAL_OUTPUTFOLDER=${SRCROOT}/Products/${CONFIGURATION}-universal\n\n\nxcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator | echo\n\nxcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphoneos -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos | echo\n\n\n\n\n# make sure the output directory exists\nmkdir -p \"${UNIVERSAL_OUTPUTFOLDER}\"\n\n# Step 2. Copy the framework structure to the universal folder\ncp -R \"${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework\" \"${UNIVERSAL_OUTPUTFOLDER}/\"\ncp -R \"${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework\" \"${UNIVERSAL_OUTPUTFOLDER}/\"\n\n# Step 3. Create universal binary file using lipo and place the combined executable in the copied framework directory\nlipo -create -output \"${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}\" \"${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}\" \"${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}\"\n\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ ADA0EC2C19B993640027793D /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -448,6 +482,20 @@ /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ + AD95CB2A19C0842E007B0E3D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + AD95CB2B19C0842E007B0E3D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; ADA0EC4219B993650027793D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -563,7 +611,7 @@ "$(SDK_DIR)/usr/include/libxml2", ); INFOPLIST_FILE = SCSwift/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + INSTALL_PATH = "@executable_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -602,7 +650,7 @@ "$(SDK_DIR)/usr/include/libxml2", ); INFOPLIST_FILE = SCSwift/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + INSTALL_PATH = "@executable_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -614,6 +662,14 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + AD95CB2919C0842E007B0E3D /* Build configuration list for PBXAggregateTarget "SCSwift-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AD95CB2A19C0842E007B0E3D /* Debug */, + AD95CB2B19C0842E007B0E3D /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; ADA0EC2B19B993640027793D /* Build configuration list for PBXProject "SCSwift" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/SCSwift/SCSwift/SCSwift.h b/SCSwift/SCSwift/SCSwift.h index bbe9b263..f9030987 100644 --- a/SCSwift/SCSwift/SCSwift.h +++ b/SCSwift/SCSwift/SCSwift.h @@ -47,3 +47,4 @@ FOUNDATION_EXPORT const unsigned char SCSwiftVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import +#import \ No newline at end of file From 203f0afda32031cdb9978b64c70eaca7a852abd6 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Fri, 19 Sep 2014 14:59:25 +0800 Subject: [PATCH 26/37] update acl request --- Classes/S3/ASIS3BucketRequest.h | 4 ++++ Classes/S3/ASIS3BucketRequest.m | 24 ++++++++++++++++++++++++ Classes/S3/ASIS3ObjectRequest.h | 3 +++ Classes/S3/ASIS3ObjectRequest.m | 29 ++++++++++++++++++++++++----- 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/Classes/S3/ASIS3BucketRequest.h b/Classes/S3/ASIS3BucketRequest.h index 8688f795..4437b2ba 100644 --- a/Classes/S3/ASIS3BucketRequest.h +++ b/Classes/S3/ASIS3BucketRequest.h @@ -60,6 +60,9 @@ // Use for deleting buckets - they must be empty for this to succeed + (id)DELETERequestWithBucket:(NSString *)bucket; ++ (id)GETACLRequestWithBucket:(NSString *)bucket; ++ (id)PUTACLRequestWithBucket:(NSString *)bucket aclDict:(NSDictionary *)aclDict; + - (id)requestForNextChunk; @property (retain, nonatomic) NSString *bucket; @@ -72,4 +75,5 @@ @property (retain, readonly) NSMutableArray *objects; @property (retain, readonly) NSMutableArray *commonPrefixes; @property (assign, readonly) BOOL isTruncated; +@property (assign) BOOL formatterJson; @end diff --git a/Classes/S3/ASIS3BucketRequest.m b/Classes/S3/ASIS3BucketRequest.m index 6018fec0..1d1b7f75 100644 --- a/Classes/S3/ASIS3BucketRequest.m +++ b/Classes/S3/ASIS3BucketRequest.m @@ -80,6 +80,27 @@ + (id)DELETERequestWithBucket:(NSString *)theBucket return request; } ++ (id)GETACLRequestWithBucket:(NSString *)theBucket +{ + ASIS3BucketRequest *getACLRequest = [self requestWithBucket:theBucket subResource:@"acl"]; + [getACLRequest setFormatterJson:YES]; + [getACLRequest setRequestMethod:@"GET"]; + return getACLRequest; +} + ++ (id)PUTACLRequestWithBucket:(NSString *)theBucket aclDict:(NSDictionary *)theAclDict; +{ + ASIS3BucketRequest *putACLRequest = [self requestWithBucket:theBucket subResource:@"acl"]; + [putACLRequest setFormatterJson:YES]; + [putACLRequest setRequestMethod:@"PUT"]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:theAclDict options:kNilOptions error:&error]; + + [putACLRequest setPostBody:(NSMutableData *)jsonData]; + return putACLRequest; +} + - (void)dealloc { [currentObject release]; @@ -122,6 +143,9 @@ - (void)buildURL if ([self maxResultCount] > 0) { [queryParts addObject:[NSString stringWithFormat:@"max-keys=%i",[self maxResultCount]]]; } + if ([self formatterJson]) { + [queryParts addObject:[NSString stringWithFormat:@"formatter=json"]]; + } if ([queryParts count]) { NSString* template = @"%@?%@"; if ([[self subResource] length] > 0) { diff --git a/Classes/S3/ASIS3ObjectRequest.h b/Classes/S3/ASIS3ObjectRequest.h index f4e52439..9e16b94c 100644 --- a/Classes/S3/ASIS3ObjectRequest.h +++ b/Classes/S3/ASIS3ObjectRequest.h @@ -70,6 +70,9 @@ extern NSString *const ASIS3StorageClassReducedRedundancy; // Creates a HEAD request for the object at path + (id)HEADRequestWithBucket:(NSString *)bucket key:(NSString *)key; ++ (id)GETACLRequestWithBucket:(NSString *)bucket key:(NSString *)key; ++ (id)PUTACLRequestWithBucket:(NSString *)bucket key:(NSString *)key aclDict:(NSDictionary *)aclDict; + @property (retain, nonatomic) NSString *bucket; @property (retain, nonatomic) NSString *key; @property (retain, nonatomic) NSString *sourceBucket; diff --git a/Classes/S3/ASIS3ObjectRequest.m b/Classes/S3/ASIS3ObjectRequest.m index d032aa91..2cee0d43 100644 --- a/Classes/S3/ASIS3ObjectRequest.m +++ b/Classes/S3/ASIS3ObjectRequest.m @@ -79,6 +79,25 @@ + (id)HEADRequestWithBucket:(NSString *)theBucket key:(NSString *)theKey return newRequest; } ++ (id)GETACLRequestWithBucket:(NSString *)bucket key:(NSString *)key { + + ASIS3ObjectRequest *getACLRequest = [self requestWithBucket:bucket key:key subResource:@"acl"]; + [getACLRequest setRequestMethod:@"GET"]; + return getACLRequest; +} + ++ (id)PUTACLRequestWithBucket:(NSString *)bucket key:(NSString *)key aclDict:(NSDictionary *)aclDict { + + ASIS3ObjectRequest *putACLRequest = [self requestWithBucket:bucket key:key subResource:@"acl"]; + [putACLRequest setRequestMethod:@"PUT"]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:aclDict options:kNilOptions error:&error]; + + [putACLRequest setPostBody:(NSMutableData *)jsonData]; + return putACLRequest; +} + - (id)copyWithZone:(NSZone *)zone { ASIS3ObjectRequest *newRequest = [super copyWithZone:zone]; @@ -106,11 +125,11 @@ - (void)dealloc - (void)buildURL { - if ([self subResource]) { - [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.%@%@?%@",[self requestScheme],[self bucket],[[self class] S3Host],[ASIS3Request stringByURLEncodingForS3Path:[self key]],[self subResource]]]]; - } else { - [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.%@%@",[self requestScheme],[self bucket],[[self class] S3Host],[ASIS3Request stringByURLEncodingForS3Path:[self key]]]]]; - } + if ([self subResource]) { + [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.%@%@?%@&formatter=json",[self requestScheme],[self bucket],[[self class] S3Host],[ASIS3Request stringByURLEncodingForS3Path:[self key]],[self subResource]]]]; + } else { + [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.%@%@?formatter=json",[self requestScheme],[self bucket],[[self class] S3Host],[ASIS3Request stringByURLEncodingForS3Path:[self key]]]]]; + } } - (NSString *)mimeType From e594eeac9be10d79a10155f3f730858876b72073 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 24 Sep 2014 14:52:39 +0800 Subject: [PATCH 27/37] update --- Classes/S3/ASIS3ObjectRequest.h | 8 +++++++ Classes/S3/ASIS3ObjectRequest.m | 41 +++++++++++++++++++++++++++++++++ Classes/S3/ASIS3Request.h | 2 ++ Classes/S3/ASIS3Request.m | 18 +++++++++++++-- 4 files changed, 67 insertions(+), 2 deletions(-) diff --git a/Classes/S3/ASIS3ObjectRequest.h b/Classes/S3/ASIS3ObjectRequest.h index 9e16b94c..798e65aa 100644 --- a/Classes/S3/ASIS3ObjectRequest.h +++ b/Classes/S3/ASIS3ObjectRequest.h @@ -73,6 +73,14 @@ extern NSString *const ASIS3StorageClassReducedRedundancy; + (id)GETACLRequestWithBucket:(NSString *)bucket key:(NSString *)key; + (id)PUTACLRequestWithBucket:(NSString *)bucket key:(NSString *)key aclDict:(NSDictionary *)aclDict; ++ (NSURL *)GETPresignedURLWithBucket:(NSString *)theBucket + key:(NSString *)theKey + expires:(NSDate *)expires + ip:(NSString *)ip + useCDN:(BOOL)useCDN + useCustomHost:(BOOL)useCustomHost + bucketFront:(BOOL)bucketFront; + @property (retain, nonatomic) NSString *bucket; @property (retain, nonatomic) NSString *key; @property (retain, nonatomic) NSString *sourceBucket; diff --git a/Classes/S3/ASIS3ObjectRequest.m b/Classes/S3/ASIS3ObjectRequest.m index 2cee0d43..c9912329 100644 --- a/Classes/S3/ASIS3ObjectRequest.m +++ b/Classes/S3/ASIS3ObjectRequest.m @@ -98,6 +98,47 @@ + (id)PUTACLRequestWithBucket:(NSString *)bucket key:(NSString *)key aclDict:(NS return putACLRequest; } ++ (NSURL *)GETPresignedURLWithBucket:(NSString *)theBucket + key:(NSString *)theKey + expires:(NSDate *)expires + ip:(NSString *)ip + useCDN:(BOOL)useCDN + useCustomHost:(BOOL)useCustomHost + bucketFront:(BOOL)bucketFront +{ + ASIS3ObjectRequest *objectRequest = [ASIS3ObjectRequest requestWithBucket:theBucket key:theKey]; + + if (useCustomHost) { + [objectRequest setBucket:[ASIS3ObjectRequest sharedCustomHost]]; + } + + int timestamp = [expires timeIntervalSince1970]; + NSString *dateString = [NSString stringWithFormat:@"%d",timestamp]; + + [objectRequest setDateString:dateString]; + [objectRequest buildRequestHeaders]; + + NSString *str = [[objectRequest requestHeaders] objectForKey:@"Authorization"]; + NSString *kid = [NSString stringWithFormat:@"sina,%@", [str substringWithRange:NSMakeRange(5, 20)]]; + NSString *ssig = [[ASIS3Request stringByURLEncodingForS3Path:[str substringWithRange:NSMakeRange(26, 10)]] substringFromIndex:1]; + NSString *host = useCDN ? [NSString stringWithFormat:@"cdn.%@", (useCustomHost ? [ASIS3ObjectRequest sharedCustomHost] : [ASIS3ObjectRequest S3Host])] : + (useCustomHost ? [ASIS3ObjectRequest sharedCustomHost] : [ASIS3ObjectRequest S3Host]); + + NSString *formatter = nil; + if (useCustomHost) { + formatter = [NSString stringWithFormat:@"%@://%@%@", [objectRequest requestScheme], host, [ASIS3Request stringByURLEncodingForS3Path:theKey]]; + }else { + formatter = bucketFront ? [NSString stringWithFormat:@"%@://%@.%@%@", [objectRequest requestScheme], theBucket, host, [ASIS3Request stringByURLEncodingForS3Path:theKey]] + : [NSString stringWithFormat:@"%@://%@/%@%@", [objectRequest requestScheme], host, theBucket, [ASIS3Request stringByURLEncodingForS3Path:theKey]]; + } + NSString *urlString = (ip==nil) ? [NSString stringWithFormat:@"%@?KID=%@&Expires=%@&ssig=%@",formatter,kid,dateString,ssig] + : [NSString stringWithFormat:@"%@?ip=%@&KID=%@&Expires=%@&ssig=%@",formatter,ip,kid,dateString,ssig]; + + NSURL *presignedUrl = [NSURL URLWithString:urlString]; + + return presignedUrl; +} + - (id)copyWithZone:(NSZone *)zone { ASIS3ObjectRequest *newRequest = [super copyWithZone:zone]; diff --git a/Classes/S3/ASIS3Request.h b/Classes/S3/ASIS3Request.h index 7759ba83..9a331b11 100644 --- a/Classes/S3/ASIS3Request.h +++ b/Classes/S3/ASIS3Request.h @@ -80,6 +80,8 @@ typedef enum _ASIS3ErrorType { + (void)setSharedAccessKey:(NSString *)newAccessKey; + (NSString *)sharedSecretAccessKey; + (void)setSharedSecretAccessKey:(NSString *)newAccessKey; ++ (NSString *)sharedCustomHost; ++ (void)setSharedCustomHost:(NSString *)newCustomHost; # pragma mark helpers diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index e94188bc..74f231b6 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -21,6 +21,7 @@ static NSString *sharedAccessKey = nil; static NSString *sharedSecretAccessKey = nil; +static NSString *sharedCustomHost = nil; // Private stuff @interface ASIS3Request () @@ -55,7 +56,7 @@ - (void)dealloc - (void)setDate:(NSDate *)date { - [self setDateString:[[ASIS3Request S3RequestDateFormatter] stringFromDate:date]]; + [self setDateString:[[ASIS3Request S3RequestDateFormatter] stringFromDate:date]]; } - (ASIHTTPRequest *)HEADRequest @@ -126,6 +127,7 @@ - (void)buildRequestHeaders // Jump through hoops while eating hot food NSString *stringToSign = [self stringToSignForHeaders:canonicalizedAmzHeaders resource:canonicalizedResource]; + NSString *signature = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:[self secretAccessKey] forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; NSString *authorizationString = [NSString stringWithFormat:@"SINA %@:%@",[self accessKey],signature]; [self addRequestHeader:@"Authorization" value:authorizationString]; @@ -257,6 +259,16 @@ + (void)setSharedSecretAccessKey:(NSString *)newAccessKey sharedSecretAccessKey = [newAccessKey retain]; } ++ (NSString *)sharedCustomHost +{ + return sharedCustomHost; +} + ++ (void)setSharedCustomHost:(NSString *)newCustomHost +{ + [sharedCustomHost release]; + sharedCustomHost = [newCustomHost retain]; +} #pragma mark helpers @@ -325,8 +337,10 @@ + (NSData *)HMACSHA1withKey:(NSString *)key forString:(NSString *)string + (NSString *)S3Host { - return @"sinastorage.cn"; + //return @"sinastorage.cn"; //return @"s3.amazonaws.com"; + + return @"sinacloud.net"; } - (void)buildURL From 04f4249b812465e456fb8c54fa2551ee4445e059 Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Mon, 29 Sep 2014 14:47:46 +0800 Subject: [PATCH 28/37] Revert 26ced0a..e594eea This rolls back to commit 26ced0a7948f8cb5d4c6065aa1ac8abfa81b9f75. --- Classes/S3/ASIS3BucketRequest.h | 4 -- Classes/S3/ASIS3BucketRequest.m | 24 ----------- Classes/S3/ASIS3ObjectRequest.h | 11 ------ Classes/S3/ASIS3ObjectRequest.m | 70 +++------------------------------ Classes/S3/ASIS3Request.h | 2 - Classes/S3/ASIS3Request.m | 18 +-------- 6 files changed, 7 insertions(+), 122 deletions(-) diff --git a/Classes/S3/ASIS3BucketRequest.h b/Classes/S3/ASIS3BucketRequest.h index 4437b2ba..8688f795 100644 --- a/Classes/S3/ASIS3BucketRequest.h +++ b/Classes/S3/ASIS3BucketRequest.h @@ -60,9 +60,6 @@ // Use for deleting buckets - they must be empty for this to succeed + (id)DELETERequestWithBucket:(NSString *)bucket; -+ (id)GETACLRequestWithBucket:(NSString *)bucket; -+ (id)PUTACLRequestWithBucket:(NSString *)bucket aclDict:(NSDictionary *)aclDict; - - (id)requestForNextChunk; @property (retain, nonatomic) NSString *bucket; @@ -75,5 +72,4 @@ @property (retain, readonly) NSMutableArray *objects; @property (retain, readonly) NSMutableArray *commonPrefixes; @property (assign, readonly) BOOL isTruncated; -@property (assign) BOOL formatterJson; @end diff --git a/Classes/S3/ASIS3BucketRequest.m b/Classes/S3/ASIS3BucketRequest.m index 1d1b7f75..6018fec0 100644 --- a/Classes/S3/ASIS3BucketRequest.m +++ b/Classes/S3/ASIS3BucketRequest.m @@ -80,27 +80,6 @@ + (id)DELETERequestWithBucket:(NSString *)theBucket return request; } -+ (id)GETACLRequestWithBucket:(NSString *)theBucket -{ - ASIS3BucketRequest *getACLRequest = [self requestWithBucket:theBucket subResource:@"acl"]; - [getACLRequest setFormatterJson:YES]; - [getACLRequest setRequestMethod:@"GET"]; - return getACLRequest; -} - -+ (id)PUTACLRequestWithBucket:(NSString *)theBucket aclDict:(NSDictionary *)theAclDict; -{ - ASIS3BucketRequest *putACLRequest = [self requestWithBucket:theBucket subResource:@"acl"]; - [putACLRequest setFormatterJson:YES]; - [putACLRequest setRequestMethod:@"PUT"]; - - NSError *error; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:theAclDict options:kNilOptions error:&error]; - - [putACLRequest setPostBody:(NSMutableData *)jsonData]; - return putACLRequest; -} - - (void)dealloc { [currentObject release]; @@ -143,9 +122,6 @@ - (void)buildURL if ([self maxResultCount] > 0) { [queryParts addObject:[NSString stringWithFormat:@"max-keys=%i",[self maxResultCount]]]; } - if ([self formatterJson]) { - [queryParts addObject:[NSString stringWithFormat:@"formatter=json"]]; - } if ([queryParts count]) { NSString* template = @"%@?%@"; if ([[self subResource] length] > 0) { diff --git a/Classes/S3/ASIS3ObjectRequest.h b/Classes/S3/ASIS3ObjectRequest.h index 798e65aa..f4e52439 100644 --- a/Classes/S3/ASIS3ObjectRequest.h +++ b/Classes/S3/ASIS3ObjectRequest.h @@ -70,17 +70,6 @@ extern NSString *const ASIS3StorageClassReducedRedundancy; // Creates a HEAD request for the object at path + (id)HEADRequestWithBucket:(NSString *)bucket key:(NSString *)key; -+ (id)GETACLRequestWithBucket:(NSString *)bucket key:(NSString *)key; -+ (id)PUTACLRequestWithBucket:(NSString *)bucket key:(NSString *)key aclDict:(NSDictionary *)aclDict; - -+ (NSURL *)GETPresignedURLWithBucket:(NSString *)theBucket - key:(NSString *)theKey - expires:(NSDate *)expires - ip:(NSString *)ip - useCDN:(BOOL)useCDN - useCustomHost:(BOOL)useCustomHost - bucketFront:(BOOL)bucketFront; - @property (retain, nonatomic) NSString *bucket; @property (retain, nonatomic) NSString *key; @property (retain, nonatomic) NSString *sourceBucket; diff --git a/Classes/S3/ASIS3ObjectRequest.m b/Classes/S3/ASIS3ObjectRequest.m index c9912329..d032aa91 100644 --- a/Classes/S3/ASIS3ObjectRequest.m +++ b/Classes/S3/ASIS3ObjectRequest.m @@ -79,66 +79,6 @@ + (id)HEADRequestWithBucket:(NSString *)theBucket key:(NSString *)theKey return newRequest; } -+ (id)GETACLRequestWithBucket:(NSString *)bucket key:(NSString *)key { - - ASIS3ObjectRequest *getACLRequest = [self requestWithBucket:bucket key:key subResource:@"acl"]; - [getACLRequest setRequestMethod:@"GET"]; - return getACLRequest; -} - -+ (id)PUTACLRequestWithBucket:(NSString *)bucket key:(NSString *)key aclDict:(NSDictionary *)aclDict { - - ASIS3ObjectRequest *putACLRequest = [self requestWithBucket:bucket key:key subResource:@"acl"]; - [putACLRequest setRequestMethod:@"PUT"]; - - NSError *error; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:aclDict options:kNilOptions error:&error]; - - [putACLRequest setPostBody:(NSMutableData *)jsonData]; - return putACLRequest; -} - -+ (NSURL *)GETPresignedURLWithBucket:(NSString *)theBucket - key:(NSString *)theKey - expires:(NSDate *)expires - ip:(NSString *)ip - useCDN:(BOOL)useCDN - useCustomHost:(BOOL)useCustomHost - bucketFront:(BOOL)bucketFront -{ - ASIS3ObjectRequest *objectRequest = [ASIS3ObjectRequest requestWithBucket:theBucket key:theKey]; - - if (useCustomHost) { - [objectRequest setBucket:[ASIS3ObjectRequest sharedCustomHost]]; - } - - int timestamp = [expires timeIntervalSince1970]; - NSString *dateString = [NSString stringWithFormat:@"%d",timestamp]; - - [objectRequest setDateString:dateString]; - [objectRequest buildRequestHeaders]; - - NSString *str = [[objectRequest requestHeaders] objectForKey:@"Authorization"]; - NSString *kid = [NSString stringWithFormat:@"sina,%@", [str substringWithRange:NSMakeRange(5, 20)]]; - NSString *ssig = [[ASIS3Request stringByURLEncodingForS3Path:[str substringWithRange:NSMakeRange(26, 10)]] substringFromIndex:1]; - NSString *host = useCDN ? [NSString stringWithFormat:@"cdn.%@", (useCustomHost ? [ASIS3ObjectRequest sharedCustomHost] : [ASIS3ObjectRequest S3Host])] : - (useCustomHost ? [ASIS3ObjectRequest sharedCustomHost] : [ASIS3ObjectRequest S3Host]); - - NSString *formatter = nil; - if (useCustomHost) { - formatter = [NSString stringWithFormat:@"%@://%@%@", [objectRequest requestScheme], host, [ASIS3Request stringByURLEncodingForS3Path:theKey]]; - }else { - formatter = bucketFront ? [NSString stringWithFormat:@"%@://%@.%@%@", [objectRequest requestScheme], theBucket, host, [ASIS3Request stringByURLEncodingForS3Path:theKey]] - : [NSString stringWithFormat:@"%@://%@/%@%@", [objectRequest requestScheme], host, theBucket, [ASIS3Request stringByURLEncodingForS3Path:theKey]]; - } - NSString *urlString = (ip==nil) ? [NSString stringWithFormat:@"%@?KID=%@&Expires=%@&ssig=%@",formatter,kid,dateString,ssig] - : [NSString stringWithFormat:@"%@?ip=%@&KID=%@&Expires=%@&ssig=%@",formatter,ip,kid,dateString,ssig]; - - NSURL *presignedUrl = [NSURL URLWithString:urlString]; - - return presignedUrl; -} - - (id)copyWithZone:(NSZone *)zone { ASIS3ObjectRequest *newRequest = [super copyWithZone:zone]; @@ -166,11 +106,11 @@ - (void)dealloc - (void)buildURL { - if ([self subResource]) { - [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.%@%@?%@&formatter=json",[self requestScheme],[self bucket],[[self class] S3Host],[ASIS3Request stringByURLEncodingForS3Path:[self key]],[self subResource]]]]; - } else { - [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.%@%@?formatter=json",[self requestScheme],[self bucket],[[self class] S3Host],[ASIS3Request stringByURLEncodingForS3Path:[self key]]]]]; - } + if ([self subResource]) { + [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.%@%@?%@",[self requestScheme],[self bucket],[[self class] S3Host],[ASIS3Request stringByURLEncodingForS3Path:[self key]],[self subResource]]]]; + } else { + [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.%@%@",[self requestScheme],[self bucket],[[self class] S3Host],[ASIS3Request stringByURLEncodingForS3Path:[self key]]]]]; + } } - (NSString *)mimeType diff --git a/Classes/S3/ASIS3Request.h b/Classes/S3/ASIS3Request.h index 9a331b11..7759ba83 100644 --- a/Classes/S3/ASIS3Request.h +++ b/Classes/S3/ASIS3Request.h @@ -80,8 +80,6 @@ typedef enum _ASIS3ErrorType { + (void)setSharedAccessKey:(NSString *)newAccessKey; + (NSString *)sharedSecretAccessKey; + (void)setSharedSecretAccessKey:(NSString *)newAccessKey; -+ (NSString *)sharedCustomHost; -+ (void)setSharedCustomHost:(NSString *)newCustomHost; # pragma mark helpers diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index 74f231b6..e94188bc 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -21,7 +21,6 @@ static NSString *sharedAccessKey = nil; static NSString *sharedSecretAccessKey = nil; -static NSString *sharedCustomHost = nil; // Private stuff @interface ASIS3Request () @@ -56,7 +55,7 @@ - (void)dealloc - (void)setDate:(NSDate *)date { - [self setDateString:[[ASIS3Request S3RequestDateFormatter] stringFromDate:date]]; + [self setDateString:[[ASIS3Request S3RequestDateFormatter] stringFromDate:date]]; } - (ASIHTTPRequest *)HEADRequest @@ -127,7 +126,6 @@ - (void)buildRequestHeaders // Jump through hoops while eating hot food NSString *stringToSign = [self stringToSignForHeaders:canonicalizedAmzHeaders resource:canonicalizedResource]; - NSString *signature = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:[self secretAccessKey] forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; NSString *authorizationString = [NSString stringWithFormat:@"SINA %@:%@",[self accessKey],signature]; [self addRequestHeader:@"Authorization" value:authorizationString]; @@ -259,16 +257,6 @@ + (void)setSharedSecretAccessKey:(NSString *)newAccessKey sharedSecretAccessKey = [newAccessKey retain]; } -+ (NSString *)sharedCustomHost -{ - return sharedCustomHost; -} - -+ (void)setSharedCustomHost:(NSString *)newCustomHost -{ - [sharedCustomHost release]; - sharedCustomHost = [newCustomHost retain]; -} #pragma mark helpers @@ -337,10 +325,8 @@ + (NSData *)HMACSHA1withKey:(NSString *)key forString:(NSString *)string + (NSString *)S3Host { - //return @"sinastorage.cn"; + return @"sinastorage.cn"; //return @"s3.amazonaws.com"; - - return @"sinacloud.net"; } - (void)buildURL From f0f9b4b9ae81eba523f28dc7db6274bdc23feffb Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Mon, 29 Sep 2014 15:05:12 +0800 Subject: [PATCH 29/37] update --- Classes/S3/ASIS3BucketRequest.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Classes/S3/ASIS3BucketRequest.m b/Classes/S3/ASIS3BucketRequest.m index 6018fec0..bacfe290 100644 --- a/Classes/S3/ASIS3BucketRequest.m +++ b/Classes/S3/ASIS3BucketRequest.m @@ -90,6 +90,7 @@ - (void)dealloc [delimiter release]; [subResource release]; [bucket release]; + [nextMarker release]; [super dealloc]; } From 576db2aa1eaebd4fbe7707c829df18126f5ea1ff Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Mon, 29 Sep 2014 19:52:45 +0800 Subject: [PATCH 30/37] add url authenticate --- Classes/S3/ASIS3Request.h | 17 ++++++++- Classes/S3/ASIS3Request.m | 72 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/Classes/S3/ASIS3Request.h b/Classes/S3/ASIS3Request.h index 7759ba83..7c2db0b5 100644 --- a/Classes/S3/ASIS3Request.h +++ b/Classes/S3/ASIS3Request.h @@ -34,7 +34,10 @@ typedef enum _ASIS3ErrorType { ASIS3ResponseErrorType = 2 } ASIS3ErrorType; - +typedef enum _ASIS3UrlStyle { + vhostStyle = 1, + pathStyle = 2 +} ASIS3UrlStyle; @interface ASIS3Request : ASIHTTPRequest { @@ -100,6 +103,18 @@ typedef enum _ASIS3ErrorType { // This is called automatically before the request starts to build the request URL (if one has not been manually set already) - (void)buildURL; ++ (NSURL *)authenticatedURLWithBucket:(NSString *)bucket + key:(NSString *)key + expires:(NSDate *)expires + host:(NSString *)host + hostBucket:(BOOL)hostBucket + https:(BOOL)https + ip:(NSString *)ip + httpMethod:(NSString *)httpMethod + contentType:(NSString *)contentType + urlStyle:(ASIS3UrlStyle)urlStyle + subResource:(NSString *)subResource; + @property (retain) NSString *dateString; @property (retain) NSString *accessKey; @property (retain) NSString *secretAccessKey; diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index e94188bc..8af51e8e 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -75,6 +75,78 @@ - (NSMutableDictionary *)S3Headers return headers; } ++ (NSURL *)authenticatedURLWithBucket:(NSString *)bucket + key:(NSString *)key + expires:(NSDate *)expires + host:(NSString *)host + hostBucket:(BOOL)hostBucket + https:(BOOL)https + ip:(NSString *)ip + httpMethod:(NSString *)httpMethod + contentType:(NSString *)contentType + urlStyle:(ASIS3UrlStyle)urlStyle + subResource:(NSString *)subResource +{ + NSString *kid = [NSString stringWithFormat:@"sina,%@", sharedAccessKey]; + + int timestamp = [expires timeIntervalSince1970]; + NSString *expiresTimeStamp = [NSString stringWithFormat:@"%d",timestamp]; + + /* + StringToSign = HTTP-Verb + "\n" + + Content-MD5 + "\n" + + Content-Type + "\n" + + Date + "\n" + + CanonicalizedAmzHeaders + + CanonicalizedResource; + */ + + //TODO:各种头 + NSString *canonicalizedAmzHeaders = @""; + + + NSString *canonicalizedResource = nil; + if (subResource && [subResource length] > 0) { + canonicalizedResource = [NSString stringWithFormat:@"/%@%@?%@%@",bucket,[ASIS3Request stringByURLEncodingForS3Path:key],subResource,ip?[NSString stringWithFormat:@"&ip=%@",ip]:@""]; + }else { + canonicalizedResource = [NSString stringWithFormat:@"/%@%@%@",bucket,[ASIS3Request stringByURLEncodingForS3Path:key],ip?[NSString stringWithFormat:@"?ip=%@",ip]:@""]; + } + + NSString *stringToSign = [NSString stringWithFormat:@"%@\n\n%@\n%@\n%@%@", httpMethod,contentType?contentType:@"",expiresTimeStamp,canonicalizedAmzHeaders,canonicalizedResource]; + + NSLog(@"%@", stringToSign); + + NSString *ssig = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:sharedSecretAccessKey forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; + ssig = [[ASIS3Request stringByURLEncodingForS3Path:ssig] substringFromIndex:1]; + + NSString *httpString = https ? @"https" : @"http"; + NSString *hostString = hostBucket ? bucket : host; + + + NSString *baseUrl = nil; + if (hostBucket) { + baseUrl = [NSString stringWithFormat:@"%@%@", hostString, [ASIS3Request stringByURLEncodingForS3Path:key]]; + }else { + if (urlStyle == vhostStyle) { + baseUrl = [NSString stringWithFormat:@"%@.%@%@", bucket, hostString, [ASIS3Request stringByURLEncodingForS3Path:key]]; + }else { + baseUrl = [NSString stringWithFormat:@"%@/%@%@", hostString, bucket, [ASIS3Request stringByURLEncodingForS3Path:key]]; + } + } + + + NSString *urlString = nil; + if (ip && [ip length] > 0) { + urlString = [NSString stringWithFormat:@"%@://%@?ip=%@&KID=%@&Expires=%@&ssig=%@",httpString,baseUrl,ip,kid,expiresTimeStamp,ssig]; + }else { + urlString = [NSString stringWithFormat:@"%@://%@?KID=%@&Expires=%@&ssig=%@",httpString,baseUrl,kid,expiresTimeStamp,ssig]; + } + + NSURL *authenticatedURL = [NSURL URLWithString:urlString]; + + return authenticatedURL; +} + - (void)main { if (![self url]) { From 72b55327fef4aaa688d1f74fc48d01310ebc7f68 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Tue, 30 Sep 2014 11:25:15 +0800 Subject: [PATCH 31/37] update --- Classes/S3/ASIS3Request.h | 4 ++-- Classes/S3/ASIS3Request.m | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/S3/ASIS3Request.h b/Classes/S3/ASIS3Request.h index 7c2db0b5..c274cc5b 100644 --- a/Classes/S3/ASIS3Request.h +++ b/Classes/S3/ASIS3Request.h @@ -35,8 +35,8 @@ typedef enum _ASIS3ErrorType { } ASIS3ErrorType; typedef enum _ASIS3UrlStyle { - vhostStyle = 1, - pathStyle = 2 + ASIS3UrlVhostStyle = 1, + ASIS3UrlPathStyle = 2 } ASIS3UrlStyle; @interface ASIS3Request : ASIHTTPRequest { diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index 8af51e8e..934414d4 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -118,7 +118,7 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket NSString *ssig = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:sharedSecretAccessKey forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; ssig = [[ASIS3Request stringByURLEncodingForS3Path:ssig] substringFromIndex:1]; - + NSString *httpString = https ? @"https" : @"http"; NSString *hostString = hostBucket ? bucket : host; @@ -127,7 +127,7 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket if (hostBucket) { baseUrl = [NSString stringWithFormat:@"%@%@", hostString, [ASIS3Request stringByURLEncodingForS3Path:key]]; }else { - if (urlStyle == vhostStyle) { + if (urlStyle == ASIS3UrlVhostStyle) { baseUrl = [NSString stringWithFormat:@"%@.%@%@", bucket, hostString, [ASIS3Request stringByURLEncodingForS3Path:key]]; }else { baseUrl = [NSString stringWithFormat:@"%@/%@%@", hostString, bucket, [ASIS3Request stringByURLEncodingForS3Path:key]]; From 7a27a6e93415154e9f0c175dcf09de0a4babc017 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Tue, 30 Sep 2014 16:15:53 +0800 Subject: [PATCH 32/37] update --- Classes/S3/ASIS3Request.h | 3 +- Classes/S3/ASIS3Request.m | 105 +++++++++++++++++++++++++++----------- 2 files changed, 78 insertions(+), 30 deletions(-) diff --git a/Classes/S3/ASIS3Request.h b/Classes/S3/ASIS3Request.h index c274cc5b..3b1fb74d 100644 --- a/Classes/S3/ASIS3Request.h +++ b/Classes/S3/ASIS3Request.h @@ -113,7 +113,8 @@ typedef enum _ASIS3UrlStyle { httpMethod:(NSString *)httpMethod contentType:(NSString *)contentType urlStyle:(ASIS3UrlStyle)urlStyle - subResource:(NSString *)subResource; + subResource:(NSString *)subResource + canonicalizedAmzHeaders:(NSDictionary *)canonicalizedAmzHeaders; @property (retain) NSString *dateString; @property (retain) NSString *accessKey; diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index 934414d4..e56bfb1b 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -86,12 +86,23 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket contentType:(NSString *)contentType urlStyle:(ASIS3UrlStyle)urlStyle subResource:(NSString *)subResource + canonicalizedAmzHeaders:(NSDictionary *)canonicalizedAmzHeaders { - NSString *kid = [NSString stringWithFormat:@"sina,%@", sharedAccessKey]; + NSString *_bucket = @""; + NSString *_key = @""; + if (!bucket) { + _key = @""; + }else { + _bucket = bucket; + _key = [ASIS3Request stringByURLEncodingForS3Path:key]; + } - int timestamp = [expires timeIntervalSince1970]; - NSString *expiresTimeStamp = [NSString stringWithFormat:@"%d",timestamp]; + // ip=ip&KID=sina,MyAccessKey&ssig=ssig_value&Expires=expires + NSString *_ip = ip; + NSString *_kid = [NSString stringWithFormat:@"sina,%@", sharedAccessKey ? sharedAccessKey : @""]; + NSString *_expires = expires ? [NSString stringWithFormat:@"%.0f",[expires timeIntervalSince1970]] : [NSString stringWithFormat:@"%.0f",[[NSDate date] timeIntervalSince1970]]; + NSString *_ssig = @""; /* StringToSign = HTTP-Verb + "\n" + Content-MD5 + "\n" + @@ -100,46 +111,82 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket CanonicalizedAmzHeaders + CanonicalizedResource; */ + NSString *_verb = httpMethod ? httpMethod : @"GET"; + NSString *_contentMd5 = @""; + NSString *_contentType = contentType ? contentType : @""; + NSString *_date = _expires; - //TODO:各种头 - NSString *canonicalizedAmzHeaders = @""; - - - NSString *canonicalizedResource = nil; - if (subResource && [subResource length] > 0) { - canonicalizedResource = [NSString stringWithFormat:@"/%@%@?%@%@",bucket,[ASIS3Request stringByURLEncodingForS3Path:key],subResource,ip?[NSString stringWithFormat:@"&ip=%@",ip]:@""]; - }else { - canonicalizedResource = [NSString stringWithFormat:@"/%@%@%@",bucket,[ASIS3Request stringByURLEncodingForS3Path:key],ip?[NSString stringWithFormat:@"?ip=%@",ip]:@""]; + NSString *_canonicalizedAmzHeaders = @""; + { + if (canonicalizedAmzHeaders != nil) { + for (NSString *header in [canonicalizedAmzHeaders keysSortedByValueUsingSelector:@selector(compare:)]) { + _canonicalizedAmzHeaders = [NSString stringWithFormat:@"%@%@:%@\n",_canonicalizedAmzHeaders,[header lowercaseString],[canonicalizedAmzHeaders objectForKey:header]]; + } + } + } + + NSString *_canonicalizedResource = @""; + { + if (subResource && [subResource length] > 0) { + _canonicalizedResource = [NSString stringWithFormat:@"/%@%@?%@",_bucket,_key,subResource]; + }else { + _canonicalizedResource = [NSString stringWithFormat:@"/%@%@",_bucket,_key]; + } + + if (_ip && [_canonicalizedResource rangeOfString:@"?"].location == NSNotFound) { + _canonicalizedResource = [NSString stringWithFormat:@"%@?%@", _canonicalizedResource,_ip]; + }else if (_ip && [_canonicalizedResource rangeOfString:@"?"].location != NSNotFound) { + _canonicalizedResource = [NSString stringWithFormat:@"%@&%@", _canonicalizedResource,_ip]; + } } - NSString *stringToSign = [NSString stringWithFormat:@"%@\n\n%@\n%@\n%@%@", httpMethod,contentType?contentType:@"",expiresTimeStamp,canonicalizedAmzHeaders,canonicalizedResource]; - + NSString *stringToSign = [NSString stringWithFormat:@"%@\n%@\n%@\n%@\n%@%@", _verb,_contentMd5,_contentType,_date,_canonicalizedAmzHeaders,_canonicalizedResource]; NSLog(@"%@", stringToSign); + _ssig = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:sharedSecretAccessKey forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; + _ssig = [[ASIS3Request stringByURLEncodingForS3Path:_ssig] substringFromIndex:1]; + - NSString *ssig = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:sharedSecretAccessKey forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; - ssig = [[ASIS3Request stringByURLEncodingForS3Path:ssig] substringFromIndex:1]; - - NSString *httpString = https ? @"https" : @"http"; - NSString *hostString = hostBucket ? bucket : host; - NSString *baseUrl = nil; - if (hostBucket) { - baseUrl = [NSString stringWithFormat:@"%@%@", hostString, [ASIS3Request stringByURLEncodingForS3Path:key]]; + NSString *_https = https ? @"https" : @"http"; + NSString *_baseUrl = @""; + + if (bucket == nil) { + + _baseUrl = [NSString stringWithFormat:@"%@://%@", _https, host]; + }else { - if (urlStyle == ASIS3UrlVhostStyle) { - baseUrl = [NSString stringWithFormat:@"%@.%@%@", bucket, hostString, [ASIS3Request stringByURLEncodingForS3Path:key]]; + + if (hostBucket) { + + _baseUrl = [NSString stringWithFormat:@"%@://%@", _https, bucket]; + }else { - baseUrl = [NSString stringWithFormat:@"%@/%@%@", hostString, bucket, [ASIS3Request stringByURLEncodingForS3Path:key]]; + + if (urlStyle == ASIS3UrlVhostStyle) { + _baseUrl = [NSString stringWithFormat:@"%@://%@.%@", _https, bucket, host]; + }else { + _baseUrl = [NSString stringWithFormat:@"%@://%@/%@", _https, host, bucket]; + } } } - NSString *urlString = nil; - if (ip && [ip length] > 0) { - urlString = [NSString stringWithFormat:@"%@://%@?ip=%@&KID=%@&Expires=%@&ssig=%@",httpString,baseUrl,ip,kid,expiresTimeStamp,ssig]; + + + if (subResource && [subResource length] > 0) { + + if (ip && [ip length]>0) { + urlString = [NSString stringWithFormat:@"%@%@?%@&ip=%@&KID=%@&Expires=%@&ssig=%@",_baseUrl,_key,subResource,_ip,_kid,_expires,_ssig]; + }else { + urlString = [NSString stringWithFormat:@"%@%@?%@&KID=%@&Expires=%@&ssig=%@",_baseUrl,_key,subResource,_kid,_expires,_ssig]; + } }else { - urlString = [NSString stringWithFormat:@"%@://%@?KID=%@&Expires=%@&ssig=%@",httpString,baseUrl,kid,expiresTimeStamp,ssig]; + if (ip && [ip length]>0) { + urlString = [NSString stringWithFormat:@"%@%@?ip=%@&KID=%@&Expires=%@&ssig=%@",_baseUrl,_key,_ip,_kid,_expires,_ssig]; + }else { + urlString = [NSString stringWithFormat:@"%@%@?KID=%@&Expires=%@&ssig=%@",_baseUrl,_key,_kid,_expires,_ssig]; + } } NSURL *authenticatedURL = [NSURL URLWithString:urlString]; From e3d5db47ffe9b7ca8c9da8d6914f2bdda07bb6d6 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Tue, 30 Sep 2014 19:51:59 +0800 Subject: [PATCH 33/37] =?UTF-8?q?update=20=E7=B2=BE=E7=AE=80=E7=89=88=20au?= =?UTF-8?q?thUrl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Classes/S3/ASIS3Request.h | 6 +- Classes/S3/ASIS3Request.m | 126 +++++++++----------------------------- 2 files changed, 31 insertions(+), 101 deletions(-) diff --git a/Classes/S3/ASIS3Request.h b/Classes/S3/ASIS3Request.h index 3b1fb74d..a2ff0e88 100644 --- a/Classes/S3/ASIS3Request.h +++ b/Classes/S3/ASIS3Request.h @@ -96,6 +96,7 @@ typedef enum _ASIS3UrlStyle { // URL-encodes an S3 key so it can be used in a url // You shouldn't normally need to use this yourself + (NSString *)stringByURLEncodingForS3Path:(NSString *)key; ++ (NSString *)urlEncodeForString:(NSString *)string; // Returns a string for the hostname used for S3 requests. You shouldn't ever need to change this. + (NSString *)S3Host; @@ -110,11 +111,8 @@ typedef enum _ASIS3UrlStyle { hostBucket:(BOOL)hostBucket https:(BOOL)https ip:(NSString *)ip - httpMethod:(NSString *)httpMethod - contentType:(NSString *)contentType urlStyle:(ASIS3UrlStyle)urlStyle - subResource:(NSString *)subResource - canonicalizedAmzHeaders:(NSDictionary *)canonicalizedAmzHeaders; + subResource:(NSString *)subResource; @property (retain) NSString *dateString; @property (retain) NSString *accessKey; diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index e56bfb1b..bf89b9ea 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -82,112 +82,35 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket hostBucket:(BOOL)hostBucket https:(BOOL)https ip:(NSString *)ip - httpMethod:(NSString *)httpMethod - contentType:(NSString *)contentType urlStyle:(ASIS3UrlStyle)urlStyle subResource:(NSString *)subResource - canonicalizedAmzHeaders:(NSDictionary *)canonicalizedAmzHeaders { - NSString *_bucket = @""; - NSString *_key = @""; - if (!bucket) { - _key = @""; - }else { - _bucket = bucket; - _key = [ASIS3Request stringByURLEncodingForS3Path:key]; - } + key = bucket ? [ASIS3Request stringByURLEncodingForS3Path:key]:@""; + host = hostBucket ? bucket : + (urlStyle == ASIS3UrlVhostStyle ? [NSString stringWithFormat:@"%@%@",bucket?[NSString stringWithFormat:@"%@.",bucket]:@"",host] : + [NSString stringWithFormat:@"%@%@",host,bucket?[NSString stringWithFormat:@"/%@",bucket]:@""]); + bucket = bucket ? bucket : @""; - // ip=ip&KID=sina,MyAccessKey&ssig=ssig_value&Expires=expires - NSString *_ip = ip; - NSString *_kid = [NSString stringWithFormat:@"sina,%@", sharedAccessKey ? sharedAccessKey : @""]; - NSString *_expires = expires ? [NSString stringWithFormat:@"%.0f",[expires timeIntervalSince1970]] : [NSString stringWithFormat:@"%.0f",[[NSDate date] timeIntervalSince1970]]; + NSString *kid = [ASIS3Request urlEncodeForString:[NSString stringWithFormat:@"sina,%@", sharedAccessKey ? sharedAccessKey : @""]]; + NSString *expiresString = expires ? [NSString stringWithFormat:@"%.0f",[expires timeIntervalSince1970]] : + [NSString stringWithFormat:@"%.0f",[[NSDate date] timeIntervalSince1970]]; - NSString *_ssig = @""; - /* - StringToSign = HTTP-Verb + "\n" + - Content-MD5 + "\n" + - Content-Type + "\n" + - Date + "\n" + - CanonicalizedAmzHeaders + - CanonicalizedResource; - */ - NSString *_verb = httpMethod ? httpMethod : @"GET"; - NSString *_contentMd5 = @""; - NSString *_contentType = contentType ? contentType : @""; - NSString *_date = _expires; + subResource = subResource ? [NSString stringWithFormat:@"%@%@",subResource,ip?[NSString stringWithFormat:@"&ip=%@",ip]:@""] : + (ip ? [NSString stringWithFormat:@"ip=%@",ip]:nil); - NSString *_canonicalizedAmzHeaders = @""; - { - if (canonicalizedAmzHeaders != nil) { - for (NSString *header in [canonicalizedAmzHeaders keysSortedByValueUsingSelector:@selector(compare:)]) { - _canonicalizedAmzHeaders = [NSString stringWithFormat:@"%@%@:%@\n",_canonicalizedAmzHeaders,[header lowercaseString],[canonicalizedAmzHeaders objectForKey:header]]; - } - } - } - - NSString *_canonicalizedResource = @""; - { - if (subResource && [subResource length] > 0) { - _canonicalizedResource = [NSString stringWithFormat:@"/%@%@?%@",_bucket,_key,subResource]; - }else { - _canonicalizedResource = [NSString stringWithFormat:@"/%@%@",_bucket,_key]; - } - - if (_ip && [_canonicalizedResource rangeOfString:@"?"].location == NSNotFound) { - _canonicalizedResource = [NSString stringWithFormat:@"%@?%@", _canonicalizedResource,_ip]; - }else if (_ip && [_canonicalizedResource rangeOfString:@"?"].location != NSNotFound) { - _canonicalizedResource = [NSString stringWithFormat:@"%@&%@", _canonicalizedResource,_ip]; - } - } - - NSString *stringToSign = [NSString stringWithFormat:@"%@\n%@\n%@\n%@\n%@%@", _verb,_contentMd5,_contentType,_date,_canonicalizedAmzHeaders,_canonicalizedResource]; + NSString *stringToSign = [NSString stringWithFormat:@"GET\n\n\n%@\n/%@%@%@",expiresString, bucket,key,subResource?[NSString stringWithFormat:@"?%@",subResource]:@""]; NSLog(@"%@", stringToSign); - _ssig = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:sharedSecretAccessKey forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; - _ssig = [[ASIS3Request stringByURLEncodingForS3Path:_ssig] substringFromIndex:1]; - - + NSString *ssig = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:sharedSecretAccessKey forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; + ssig = [ASIS3Request urlEncodeForString:ssig]; - NSString *_https = https ? @"https" : @"http"; - NSString *_baseUrl = @""; - - if (bucket == nil) { - - _baseUrl = [NSString stringWithFormat:@"%@://%@", _https, host]; - - }else { - - if (hostBucket) { - - _baseUrl = [NSString stringWithFormat:@"%@://%@", _https, bucket]; - - }else { - - if (urlStyle == ASIS3UrlVhostStyle) { - _baseUrl = [NSString stringWithFormat:@"%@://%@.%@", _https, bucket, host]; - }else { - _baseUrl = [NSString stringWithFormat:@"%@://%@/%@", _https, host, bucket]; - } - } - } - - NSString *urlString = nil; - - - if (subResource && [subResource length] > 0) { - - if (ip && [ip length]>0) { - urlString = [NSString stringWithFormat:@"%@%@?%@&ip=%@&KID=%@&Expires=%@&ssig=%@",_baseUrl,_key,subResource,_ip,_kid,_expires,_ssig]; - }else { - urlString = [NSString stringWithFormat:@"%@%@?%@&KID=%@&Expires=%@&ssig=%@",_baseUrl,_key,subResource,_kid,_expires,_ssig]; - } - }else { - if (ip && [ip length]>0) { - urlString = [NSString stringWithFormat:@"%@%@?ip=%@&KID=%@&Expires=%@&ssig=%@",_baseUrl,_key,_ip,_kid,_expires,_ssig]; - }else { - urlString = [NSString stringWithFormat:@"%@%@?KID=%@&Expires=%@&ssig=%@",_baseUrl,_key,_kid,_expires,_ssig]; - } - } + NSString *urlString = [NSString stringWithFormat:@"%@://%@%@?%@KID=%@&Expires=%@&ssig=%@",https?@"https":@"http", + host, + key, + subResource?[NSString stringWithFormat:@"%@&",subResource]:@"", + kid, + expiresString, + ssig]; NSURL *authenticatedURL = [NSURL URLWithString:urlString]; @@ -391,6 +314,15 @@ + (NSString *)stringByURLEncodingForS3Path:(NSString *)key return path; } ++ (NSString *)urlEncodeForString:(NSString *)string +{ + NSString *newString = [NSMakeCollectable(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding))) autorelease]; + if (newString) { + return newString; + } + return @""; +} + // Thanks to Tom Andersen for pointing out the threading issues and providing this code! + (NSDateFormatter*)S3ResponseDateFormatter { From bf15c02496dbc7264f2b9abc463d1a37cc024c29 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 8 Oct 2014 11:10:18 +0800 Subject: [PATCH 34/37] update --- Classes/S3/ASIS3Request.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index bf89b9ea..89c9266f 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -86,9 +86,10 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket subResource:(NSString *)subResource { key = bucket ? [ASIS3Request stringByURLEncodingForS3Path:key]:@""; - host = hostBucket ? bucket : - (urlStyle == ASIS3UrlVhostStyle ? [NSString stringWithFormat:@"%@%@",bucket?[NSString stringWithFormat:@"%@.",bucket]:@"",host] : - [NSString stringWithFormat:@"%@%@",host,bucket?[NSString stringWithFormat:@"/%@",bucket]:@""]); + host = host ? host : @"sinacloud.net"; + NSString *baseStr = hostBucket ? bucket : + (urlStyle == ASIS3UrlVhostStyle ? [NSString stringWithFormat:@"%@%@",bucket?[NSString stringWithFormat:@"%@.",bucket]:@"",host] : + [NSString stringWithFormat:@"%@%@",host,bucket?[NSString stringWithFormat:@"/%@",bucket]:@""]); bucket = bucket ? bucket : @""; NSString *kid = [ASIS3Request urlEncodeForString:[NSString stringWithFormat:@"sina,%@", sharedAccessKey ? sharedAccessKey : @""]]; @@ -105,7 +106,7 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket ssig = [ASIS3Request urlEncodeForString:ssig]; NSString *urlString = [NSString stringWithFormat:@"%@://%@%@?%@KID=%@&Expires=%@&ssig=%@",https?@"https":@"http", - host, + baseStr, key, subResource?[NSString stringWithFormat:@"%@&",subResource]:@"", kid, From f1bceaf306facf08b65b094be6eaa911e276df6d Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 8 Oct 2014 13:58:49 +0800 Subject: [PATCH 35/37] update --- Classes/ASIHTTPRequest.h | 1 + Classes/ASIHTTPRequest.m | 9 +++++++ Classes/S3/ASIS3Request.h | 1 - Classes/S3/ASIS3Request.m | 50 ++++++++++++++++++--------------------- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/Classes/ASIHTTPRequest.h b/Classes/ASIHTTPRequest.h index 31582b23..66ec3abb 100644 --- a/Classes/ASIHTTPRequest.h +++ b/Classes/ASIHTTPRequest.h @@ -881,6 +881,7 @@ typedef void (^ASIDataBlock)(NSData *data); // Returns a date from a string in RFC1123 format + (NSDate *)dateFromRFC1123String:(NSString *)string; ++ (NSString*)encodeURL:(NSString *)string; // Used for detecting multitasking support at runtime (for backgrounding requests) #if TARGET_OS_IPHONE diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m index c4f4f5a7..018b1f07 100644 --- a/Classes/ASIHTTPRequest.m +++ b/Classes/ASIHTTPRequest.m @@ -4935,6 +4935,15 @@ + (void)parseMimeType:(NSString **)mimeType andResponseEncoding:(NSStringEncodin } } ++ (NSString*)encodeURL:(NSString *)string +{ + NSString *newString = [NSMakeCollectable(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding))) autorelease]; + if (newString) { + return newString; + } + return @""; +} + #pragma mark - #pragma mark blocks #if NS_BLOCKS_AVAILABLE diff --git a/Classes/S3/ASIS3Request.h b/Classes/S3/ASIS3Request.h index a2ff0e88..5864ceed 100644 --- a/Classes/S3/ASIS3Request.h +++ b/Classes/S3/ASIS3Request.h @@ -96,7 +96,6 @@ typedef enum _ASIS3UrlStyle { // URL-encodes an S3 key so it can be used in a url // You shouldn't normally need to use this yourself + (NSString *)stringByURLEncodingForS3Path:(NSString *)key; -+ (NSString *)urlEncodeForString:(NSString *)string; // Returns a string for the hostname used for S3 requests. You shouldn't ever need to change this. + (NSString *)S3Host; diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index 89c9266f..90567476 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -85,33 +85,38 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket urlStyle:(ASIS3UrlStyle)urlStyle subResource:(NSString *)subResource { - key = bucket ? [ASIS3Request stringByURLEncodingForS3Path:key]:@""; - host = host ? host : @"sinacloud.net"; - NSString *baseStr = hostBucket ? bucket : - (urlStyle == ASIS3UrlVhostStyle ? [NSString stringWithFormat:@"%@%@",bucket?[NSString stringWithFormat:@"%@.",bucket]:@"",host] : - [NSString stringWithFormat:@"%@%@",host,bucket?[NSString stringWithFormat:@"/%@",bucket]:@""]); - bucket = bucket ? bucket : @""; + NSString *domain = host ? host : [ASIS3Request S3Host]; + NSString *uri = [NSString stringWithFormat:@"%@%@", bucket ? [NSString stringWithFormat:@"/%@",bucket] : @"", [ASIS3Request stringByURLEncodingForS3Path:key]]; - NSString *kid = [ASIS3Request urlEncodeForString:[NSString stringWithFormat:@"sina,%@", sharedAccessKey ? sharedAccessKey : @""]]; + if (bucket && urlStyle == ASIS3UrlVhostStyle) { + domain = [NSString stringWithFormat:@"%@.%@", bucket, domain]; + uri = [ASIS3Request stringByURLEncodingForS3Path:key]; + } + + if (bucket && hostBucket) { + domain = bucket; + uri = [ASIS3Request stringByURLEncodingForS3Path:key]; + } + + + NSString *kid = [ASIHTTPRequest encodeURL:[NSString stringWithFormat:@"sina,%@", sharedAccessKey ? sharedAccessKey : @""]]; NSString *expiresString = expires ? [NSString stringWithFormat:@"%.0f",[expires timeIntervalSince1970]] : - [NSString stringWithFormat:@"%.0f",[[NSDate date] timeIntervalSince1970]]; + [NSString stringWithFormat:@"%.0f",[[[NSDate date] dateByAddingTimeInterval:600] timeIntervalSince1970]]; subResource = subResource ? [NSString stringWithFormat:@"%@%@",subResource,ip?[NSString stringWithFormat:@"&ip=%@",ip]:@""] : (ip ? [NSString stringWithFormat:@"ip=%@",ip]:nil); - NSString *stringToSign = [NSString stringWithFormat:@"GET\n\n\n%@\n/%@%@%@",expiresString, bucket,key,subResource?[NSString stringWithFormat:@"?%@",subResource]:@""]; - NSLog(@"%@", stringToSign); + NSString *stringToSign = [NSString stringWithFormat:@"GET\n\n\n%@\n%@%@%@",expiresString, + bucket?[NSString stringWithFormat:@"/%@",bucket]:@"", + [ASIS3Request stringByURLEncodingForS3Path:key], + subResource?[NSString stringWithFormat:@"?%@",subResource]:@""]; + //NSLog(@"%@", stringToSign); NSString *ssig = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:sharedSecretAccessKey forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; - ssig = [ASIS3Request urlEncodeForString:ssig]; + ssig = [ASIHTTPRequest encodeURL:ssig]; - NSString *urlString = [NSString stringWithFormat:@"%@://%@%@?%@KID=%@&Expires=%@&ssig=%@",https?@"https":@"http", - baseStr, - key, - subResource?[NSString stringWithFormat:@"%@&",subResource]:@"", - kid, - expiresString, - ssig]; + uri = [NSString stringWithFormat:@"%@?%@KID=%@&Expires=%@&ssig=%@",uri,subResource?[NSString stringWithFormat:@"%@&",subResource]:@"",kid,expiresString,ssig]; + NSString *urlString = [NSString stringWithFormat:@"%@://%@%@",https?@"https":@"http",domain,uri]; NSURL *authenticatedURL = [NSURL URLWithString:urlString]; @@ -315,15 +320,6 @@ + (NSString *)stringByURLEncodingForS3Path:(NSString *)key return path; } -+ (NSString *)urlEncodeForString:(NSString *)string -{ - NSString *newString = [NSMakeCollectable(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding))) autorelease]; - if (newString) { - return newString; - } - return @""; -} - // Thanks to Tom Andersen for pointing out the threading issues and providing this code! + (NSDateFormatter*)S3ResponseDateFormatter { From 42c31033ab248f63dbb3b2133f6aaaabcd253a89 Mon Sep 17 00:00:00 2001 From: Littlebox222 Date: Wed, 8 Oct 2014 14:36:38 +0800 Subject: [PATCH 36/37] update --- Classes/S3/ASIS3Request.m | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Classes/S3/ASIS3Request.m b/Classes/S3/ASIS3Request.m index 90567476..58e56927 100644 --- a/Classes/S3/ASIS3Request.m +++ b/Classes/S3/ASIS3Request.m @@ -85,26 +85,27 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket urlStyle:(ASIS3UrlStyle)urlStyle subResource:(NSString *)subResource { + NSUInteger lifeTime = 600; + NSString *domain = host ? host : [ASIS3Request S3Host]; - NSString *uri = [NSString stringWithFormat:@"%@%@", bucket ? [NSString stringWithFormat:@"/%@",bucket] : @"", [ASIS3Request stringByURLEncodingForS3Path:key]]; + NSString *path = [NSString stringWithFormat:@"%@%@", bucket ? [NSString stringWithFormat:@"/%@",bucket] : @"", [ASIS3Request stringByURLEncodingForS3Path:key]]; if (bucket && urlStyle == ASIS3UrlVhostStyle) { domain = [NSString stringWithFormat:@"%@.%@", bucket, domain]; - uri = [ASIS3Request stringByURLEncodingForS3Path:key]; + path = [ASIS3Request stringByURLEncodingForS3Path:key]; } if (bucket && hostBucket) { domain = bucket; - uri = [ASIS3Request stringByURLEncodingForS3Path:key]; + path = [ASIS3Request stringByURLEncodingForS3Path:key]; } NSString *kid = [ASIHTTPRequest encodeURL:[NSString stringWithFormat:@"sina,%@", sharedAccessKey ? sharedAccessKey : @""]]; NSString *expiresString = expires ? [NSString stringWithFormat:@"%.0f",[expires timeIntervalSince1970]] : - [NSString stringWithFormat:@"%.0f",[[[NSDate date] dateByAddingTimeInterval:600] timeIntervalSince1970]]; + [NSString stringWithFormat:@"%.0f",[[[NSDate date] dateByAddingTimeInterval:lifeTime] timeIntervalSince1970]]; - subResource = subResource ? [NSString stringWithFormat:@"%@%@",subResource,ip?[NSString stringWithFormat:@"&ip=%@",ip]:@""] : - (ip ? [NSString stringWithFormat:@"ip=%@",ip]:nil); + subResource = subResource ? [subResource stringByAppendingString:ip?[NSString stringWithFormat:@"&ip=%@",ip]:@""] : (ip ? [NSString stringWithFormat:@"ip=%@",ip]:nil); NSString *stringToSign = [NSString stringWithFormat:@"GET\n\n\n%@\n%@%@%@",expiresString, bucket?[NSString stringWithFormat:@"/%@",bucket]:@"", @@ -115,11 +116,14 @@ + (NSURL *)authenticatedURLWithBucket:(NSString *)bucket NSString *ssig = [[ASIHTTPRequest base64forData:[ASIS3Request HMACSHA1withKey:sharedSecretAccessKey forString:stringToSign]] substringWithRange:NSMakeRange(5, 10)]; ssig = [ASIHTTPRequest encodeURL:ssig]; - uri = [NSString stringWithFormat:@"%@?%@KID=%@&Expires=%@&ssig=%@",uri,subResource?[NSString stringWithFormat:@"%@&",subResource]:@"",kid,expiresString,ssig]; + NSString *uri = [path stringByAppendingString:[NSString stringWithFormat:@"?%@KID=%@&Expires=%@&ssig=%@",subResource?[subResource stringByAppendingString:@"&"]:@"", + kid, + expiresString, + ssig]]; + NSString *urlString = [NSString stringWithFormat:@"%@://%@%@",https?@"https":@"http",domain,uri]; NSURL *authenticatedURL = [NSURL URLWithString:urlString]; - return authenticatedURL; } From 810ccc9735d2ccc428c0481d154bfca9dba78aef Mon Sep 17 00:00:00 2001 From: Bruce Chen <662005@qq.com> Date: Thu, 14 May 2015 15:18:54 +0800 Subject: [PATCH 37/37] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7615a22..5bdde028 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ASI-SCS 本SDK为ASIHTTPRequest的一个分支,熟悉ASI的同学可以轻松上手,不熟悉的也没关系,相信看完文档您一定能够运用自如,并且能够对ASI有一个初步的了解。 -> * SCS API 的详细内容请查阅:http://open.sinastorage.com/?c=doc&a=api +> * SCS API 的详细内容请查阅:http://open.sinastorage.com/doc/api > * ASIHTTPRequest的详细内容请查阅:http://allseeing-i.com/ASIHTTPRequest/How-to-use ### SDK环境要求 @@ -411,4 +411,4 @@ NSLog(@"Max: %f, Value: %f", [myProgressIndicator maxValue],[myProgressIndicator { NSLog(@"Value: %f", [myProgressIndicator progress]); } -``` \ No newline at end of file +```