aboutsummaryrefslogtreecommitdiff
path: root/Foundation
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2015-09-08 11:43:04 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2015-09-08 11:43:04 -0400
commit7684a4bfc16eb9849ebbc8ee2e2f718f3daa96a8 (patch)
tree74f95c8025e6286562adb6eb14ecec8690b2a03c /Foundation
parent86b1431c5eb83aac2bb622778c7a880fb673df1d (diff)
Add pointers to newer classes provided by the OS
Diffstat (limited to 'Foundation')
-rw-r--r--Foundation/GTMNSDictionary+URLArguments.h4
-rw-r--r--Foundation/GTMNSString+URLArguments.h8
-rw-r--r--Foundation/GTMURLBuilder.h4
-rw-r--r--Foundation/GTMURLBuilder.m11
4 files changed, 25 insertions, 2 deletions
diff --git a/Foundation/GTMNSDictionary+URLArguments.h b/Foundation/GTMNSDictionary+URLArguments.h
index b094411..b2f0564 100644
--- a/Foundation/GTMNSDictionary+URLArguments.h
+++ b/Foundation/GTMNSDictionary+URLArguments.h
@@ -25,6 +25,10 @@
/// string of the form key1=value1&key2=value2&...&keyN=valueN.
/// Keys and values will be unescaped automatically.
/// Only the first value for a repeated key is returned.
+///
+/// NOTE: Apps targeting iOS 8 or OS X 10.10 and later should use
+/// NSURLComponents and NSURLQueryItem to create URLs with
+/// query arguments instead of using these category methods.
+ (NSDictionary *)gtm_dictionaryWithHttpArgumentsString:(NSString *)argString;
/// Gets a string representation of the dictionary in the form
diff --git a/Foundation/GTMNSString+URLArguments.h b/Foundation/GTMNSString+URLArguments.h
index d4c7e09..b3a3e3e 100644
--- a/Foundation/GTMNSString+URLArguments.h
+++ b/Foundation/GTMNSString+URLArguments.h
@@ -22,7 +22,7 @@
@interface NSString (GTMNSStringURLArgumentsAdditions)
/// Returns a string that is escaped properly to be a URL argument.
-//
+///
/// This differs from stringByAddingPercentEscapesUsingEncoding: in that it
/// will escape all the reserved characters (per RFC 3986
/// <http://www.ietf.org/rfc/rfc3986.txt>) which
@@ -30,10 +30,14 @@
///
/// This will also escape '%', so this should not be used on a string that has
/// already been escaped unless double-escaping is the desired result.
+///
+/// NOTE: Apps targeting iOS 8 or OS X 10.10 and later should use
+/// NSURLComponents and NSURLQueryItem to create properly-escaped
+/// URLs instead of using these category methods.
- (NSString*)gtm_stringByEscapingForURLArgument;
/// Returns the unescaped version of a URL argument
-//
+///
/// This has the same behavior as stringByReplacingPercentEscapesUsingEncoding:,
/// except that it will also convert '+' to space.
- (NSString*)gtm_stringByUnescapingFromURLArgument;
diff --git a/Foundation/GTMURLBuilder.h b/Foundation/GTMURLBuilder.h
index 77bf786..daa8d88 100644
--- a/Foundation/GTMURLBuilder.h
+++ b/Foundation/GTMURLBuilder.h
@@ -26,6 +26,10 @@
// [URLBuilder setValue:@"abc" forParameter:@"q"];
// NSURL *URL = [URLBuilder URL];
//
+// NOTE: Apps targeting iOS 8 or OS X 10.10 and later should use
+// NSURLComponents and NSURLQueryItem to create URLs with
+// query arguments instead of using this class.
+
#import <Foundation/Foundation.h>
#import "GTMDefines.h"
diff --git a/Foundation/GTMURLBuilder.m b/Foundation/GTMURLBuilder.m
index 4f1a419..31572e8 100644
--- a/Foundation/GTMURLBuilder.m
+++ b/Foundation/GTMURLBuilder.m
@@ -27,6 +27,17 @@
@synthesize baseURLString = baseURLString_;
+#if (!TARGET_OS_IPHONE && defined(MAC_OS_X_VERSION_10_10) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10) \
+ || (TARGET_OS_IPHONE && defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0)
+#if DEBUG
++ (void)load {
+ // Apps targeting iOS 8 and OS X 10.10 and higher should no longer use GTMURLBuilder.
+ NSLog(@"*** GTMURLBuilder is obsolete; update your app to use NSURLComponents"
+ @" queryItems property instead.");
+}
+#endif // DEBUG
+#endif // iOS 8+/OS X 10.10+
+
+ (GTMURLBuilder *)builderWithString:(NSString *)URLString {
GTMURLBuilder *URLBuilder =
[[[GTMURLBuilder alloc] initWithString:URLString] autorelease];