You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/07/11 00:05:35 UTC

ios commit: CB-7043 - property "statusCode" of CDVHTTPURLResponse conflicts with superclass property statusCode of NSHTTPURLResponse

Repository: cordova-ios
Updated Branches:
  refs/heads/master 80a743670 -> 40b9ddf8d


CB-7043 - property "statusCode" of CDVHTTPURLResponse conflicts with superclass property statusCode of NSHTTPURLResponse


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/40b9ddf8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/40b9ddf8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/40b9ddf8

Branch: refs/heads/master
Commit: 40b9ddf8d0eed166a4ba90b00ceb23b32d5fedae
Parents: 80a7436
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Jul 10 15:05:28 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Jul 10 15:05:28 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVURLProtocol.m | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/40b9ddf8/CordovaLib/Classes/CDVURLProtocol.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVURLProtocol.m b/CordovaLib/Classes/CDVURLProtocol.m
index eeee916..feb7c99 100644
--- a/CordovaLib/Classes/CDVURLProtocol.m
+++ b/CordovaLib/Classes/CDVURLProtocol.m
@@ -27,7 +27,9 @@
 #import "CDVViewController.h"
 
 @interface CDVHTTPURLResponse : NSHTTPURLResponse
-@property (nonatomic) NSInteger statusCode;
+#ifndef __IPHONE_8_0
+                                    @property (nonatomic) NSInteger statusCode;
+#endif
 @end
 
 static CDVWhitelist* gWhitelist = nil;
@@ -205,12 +207,21 @@ static CDVViewController *viewControllerForRequest(NSURLRequest* request)
         mimeType = @"text/plain";
     }
     NSString* encodingName = [@"text/plain" isEqualToString : mimeType] ? @"UTF-8" : nil;
-    CDVHTTPURLResponse* response =
-        [[CDVHTTPURLResponse alloc] initWithURL:[[self request] URL]
-                                       MIMEType:mimeType
-                          expectedContentLength:[data length]
-                               textEncodingName:encodingName];
-    response.statusCode = statusCode;
+
+#ifdef __IPHONE_8_0
+        NSHTTPURLResponse* response = [NSHTTPURLResponse alloc];
+#else
+        CDVHTTPURLResponse* response = [CDVHTTPURLResponse alloc];
+#endif
+
+    response = [response initWithURL:[[self request] URL]
+                            MIMEType:mimeType
+               expectedContentLength:[data length]
+                    textEncodingName:encodingName];
+
+#ifndef __IPHONE_8_0
+        response.statusCode = statusCode;
+#endif
 
     [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
     if (data != nil) {