Ben Copsey

Tweak conditional compilation stuff for 2.2.1 to make it more reliable

Fix 2.2.1 problem with ASIAuthenticationDialog - no idea why I didn't catch this before
@@ -188,7 +188,12 @@ NSLock *dialogLock = nil; @@ -188,7 +188,12 @@ NSLock *dialogLock = nil;
188 188
189 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 189 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
190 { 190 {
  191 +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_0
  192 + UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:nil] autorelease];
  193 +#else
191 UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease]; 194 UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
  195 +#endif
  196 +
192 [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; 197 [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
193 UITextField *textField = [[[UITextField alloc] initWithFrame:CGRectMake(20,12,260,25)] autorelease]; 198 UITextField *textField = [[[UITextField alloc] initWithFrame:CGRectMake(20,12,260,25)] autorelease];
194 [textField setAutocapitalizationType:UITextAutocapitalizationTypeNone]; 199 [textField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
@@ -16,6 +16,12 @@ @@ -16,6 +16,12 @@
16 #endif 16 #endif
17 #import <stdio.h> 17 #import <stdio.h>
18 18
  19 +// Make targeting 2.2.1 more reliable
  20 +// See: http://www.blumtnwerx.com/blog/2009/06/cross-sdk-code-hygiene-in-xcode/
  21 +#ifndef __IPHONE_3_0
  22 + #define __IPHONE_3_0 30000
  23 +#endif
  24 +
19 25
20 typedef enum _ASINetworkErrorType { 26 typedef enum _ASINetworkErrorType {
21 ASIConnectionFailureErrorType = 1, 27 ASIConnectionFailureErrorType = 1,
@@ -602,11 +602,11 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; @@ -602,11 +602,11 @@ static NSRecursiveLock *delegateAuthenticationLock = nil;
602 } else { 602 } else {
603 603
604 #if TARGET_OS_IPHONE 604 #if TARGET_OS_IPHONE
605 - #if !defined(TARGET_IPHONE_SIMULATOR) || __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_2_2 605 + #if TARGET_IPHONE_SIMULATOR && __IPHONE_OS_VERSION_MIN_REQUIRED < IPHONE_3_0
606 - NSDictionary *proxySettings = [(NSDictionary *)CFNetworkCopySystemProxySettings() autorelease];  
607 - #else  
608 // Can't detect proxies in 2.2.1 Simulator 606 // Can't detect proxies in 2.2.1 Simulator
609 NSDictionary *proxySettings = [NSMutableDictionary dictionary]; 607 NSDictionary *proxySettings = [NSMutableDictionary dictionary];
  608 + #else
  609 + NSDictionary *proxySettings = [(NSDictionary *)CFNetworkCopySystemProxySettings() autorelease];
610 #endif 610 #endif
611 #else 611 #else
612 NSDictionary *proxySettings = [(NSDictionary *)SCDynamicStoreCopyProxies(NULL) autorelease]; 612 NSDictionary *proxySettings = [(NSDictionary *)SCDynamicStoreCopyProxies(NULL) autorelease];
@@ -2529,14 +2529,14 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; @@ -2529,14 +2529,14 @@ static NSRecursiveLock *delegateAuthenticationLock = nil;
2529 return nil; 2529 return nil;
2530 } 2530 }
2531 // Obtain the list of proxies by running the autoconfiguration script 2531 // Obtain the list of proxies by running the autoconfiguration script
2532 -#if !TARGET_OS_IPHONE || __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_2_2 2532 +#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < IPHONE_3_0
  2533 + NSArray *proxies = [(NSArray *)CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)theURL) autorelease];
  2534 +#else
2533 CFErrorRef err2 = NULL; 2535 CFErrorRef err2 = NULL;
2534 NSArray *proxies = [(NSArray *)CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)theURL, &err2) autorelease]; 2536 NSArray *proxies = [(NSArray *)CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)theURL, &err2) autorelease];
2535 if (err2) { 2537 if (err2) {
2536 return nil; 2538 return nil;
2537 } 2539 }
2538 -#else  
2539 - NSArray *proxies = [(NSArray *)CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)theURL) autorelease];  
2540 #endif 2540 #endif
2541 return proxies; 2541 return proxies;
2542 } 2542 }
This diff was suppressed by a .gitattributes entry.