├── iPhoneWrapperTest.xcodeproj ├── .gitignore └── project.pbxproj ├── .gitignore ├── iPhoneWrapperTest_Prefix.pch ├── LICENSE ├── main.m ├── Classes ├── AppDelegate.h ├── VerbPicker.h ├── WrapperDelegate.h ├── AppDelegate.m ├── Controller.h ├── Wrapper.h ├── VerbPicker.m ├── Controller.m └── Wrapper.m ├── test.php ├── Info.plist ├── MainWindow.xib ├── VerbPicker.xib └── Controller.xib /iPhoneWrapperTest.xcodeproj/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode2v3 2 | *.pbxuser 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Documentation 2 | build 3 | *.pbxuser 4 | *.mode2v3 5 | *.mode1v3 6 | .DS_Store 7 | 8 | *.perspectivev3 9 | xcuserdata 10 | project.xcworkspace 11 | 12 | -------------------------------------------------------------------------------- /iPhoneWrapperTest_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'iPhoneWrapperTest' target in the 'iPhoneWrapperTest' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2009 February 21 2 | 3 | The author disclaims copyright to this source code. In place of a legal notice, here is a blessing: 4 | 5 | May you do good and not evil. 6 | May you find forgiveness for yourself and forgive others. 7 | May you share freely, never taking more than you give. 8 | -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // iPhoneWrapperTest 4 | // 5 | // Created by Adrian on 11/18/08. 6 | // Copyright akosma software 2008. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) { 12 | 13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // iPhoneWrapperTest 4 | // 5 | // Created by Adrian on 11/18/08. 6 | // Copyright akosma software 2008. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class Controller; 12 | 13 | @interface AppDelegate : NSObject 14 | 15 | @property (nonatomic, strong) IBOutlet UIWindow *window; 16 | @property (nonatomic, strong) IBOutlet Controller *viewController; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Classes/VerbPicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // VerbPicker.h 3 | // iPhoneWrapperTest 4 | // 5 | // Created by Adrian on 11/18/08. 6 | // Copyright 2008 akosma software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class Controller; 12 | 13 | @interface VerbPicker : UIViewController 14 | 15 | @property (nonatomic, strong) IBOutlet UIPickerView *picker; 16 | @property (nonatomic, strong) NSArray *verbs; 17 | @property (nonatomic, copy) NSString *chosenVerb; 18 | @property (nonatomic, assign) Controller *parent; 19 | 20 | - (IBAction)verbChosen:(id)sender; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /test.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | @class Wrapper; 12 | 13 | @protocol WrapperDelegate 14 | 15 | @required 16 | - (void)wrapper:(Wrapper *)wrapper didRetrieveData:(NSData *)data; 17 | 18 | @optional 19 | - (void)wrapperHasBadCredentials:(Wrapper *)wrapper; 20 | - (void)wrapper:(Wrapper *)wrapper didCreateResourceAtURL:(NSString *)url; 21 | - (void)wrapper:(Wrapper *)wrapper didFailWithError:(NSError *)error; 22 | - (void)wrapper:(Wrapper *)wrapper didReceiveStatusCode:(int)statusCode; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Classes/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // iPhoneWrapperTest 4 | // 5 | // Created by Adrian on 11/18/08. 6 | // Copyright akosma software 2008. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "Controller.h" 11 | 12 | @implementation AppDelegate 13 | 14 | @synthesize window = _window; 15 | @synthesize viewController = _viewController; 16 | 17 | - (void)applicationDidFinishLaunching:(UIApplication *)application 18 | { 19 | // Override point for customization after app launch 20 | self.window.rootViewController = self.viewController; 21 | [self.window makeKeyAndVisible]; 22 | } 23 | 24 | - (void)dealloc 25 | { 26 | [_viewController release]; 27 | [_window release]; 28 | [super dealloc]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Classes/Controller.h: -------------------------------------------------------------------------------- 1 | // 2 | // Controller.h 3 | // iPhoneWrapperTest 4 | // 5 | // Created by Adrian on 11/18/08. 6 | // Copyright akosma software 2008. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WrapperDelegate.h" 11 | 12 | @class Wrapper; 13 | @class VerbPicker; 14 | 15 | @interface Controller : UIViewController 16 | 17 | @property (nonatomic, strong) IBOutlet UITextField *address; 18 | @property (nonatomic, strong) IBOutlet UITextField *parameter; 19 | @property (nonatomic, strong) IBOutlet UITextView *output; 20 | @property (nonatomic, strong) IBOutlet UIButton *popUpButton; 21 | 22 | @property (nonatomic, strong) Wrapper *engine; 23 | @property (nonatomic, strong) VerbPicker *picker; 24 | 25 | - (IBAction)launch:(id)sender; 26 | - (IBAction)chooseMethod:(id)sender; 27 | - (void)pickerDone; 28 | 29 | @end 30 | 31 | -------------------------------------------------------------------------------- /Classes/Wrapper.h: -------------------------------------------------------------------------------- 1 | // 2 | // Wrapper.h 3 | // WrapperTest 4 | // 5 | // Created by Adrian on 10/18/08. 6 | // Copyright 2008 Adrian Kosmaczewski. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WrapperDelegate.h" 11 | 12 | @interface Wrapper : NSObject 13 | 14 | @property (nonatomic, strong) NSURLConnection *conn; 15 | @property (nonatomic, strong) NSMutableData *receivedData; 16 | @property (nonatomic) BOOL asynchronous; 17 | @property (nonatomic, copy) NSString *mimeType; 18 | @property (nonatomic, copy) NSString *username; 19 | @property (nonatomic, copy) NSString *password; 20 | @property (nonatomic, assign) id delegate; // Do not retain delegates! 21 | 22 | - (void)sendRequestTo:(NSURL *)url usingVerb:(NSString *)verb withParameters:(NSDictionary *)parameters; 23 | - (void)uploadData:(NSData *)data toURL:(NSURL *)url; 24 | - (void)cancelConnection; 25 | - (NSDictionary *)responseAsPropertyList; 26 | - (NSString *)responseAsText; 27 | 28 | @end 29 | 30 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSMainNibFile 28 | MainWindow 29 | 30 | 31 | -------------------------------------------------------------------------------- /Classes/VerbPicker.m: -------------------------------------------------------------------------------- 1 | // 2 | // VerbPicker.m 3 | // iPhoneWrapperTest 4 | // 5 | // Created by Adrian on 11/18/08. 6 | // Copyright 2008 akosma software. All rights reserved. 7 | // 8 | 9 | #import "VerbPicker.h" 10 | #import "Controller.h" 11 | 12 | @implementation VerbPicker 13 | 14 | @synthesize parent = _parent; 15 | @synthesize chosenVerb = _chosenVerb; 16 | @synthesize picker = _picker; 17 | @synthesize verbs = _verbs; 18 | 19 | - (id)init 20 | { 21 | if (self = [super initWithNibName:@"VerbPicker" bundle:nil]) 22 | { 23 | self.verbs = [NSArray arrayWithObjects:@"GET", @"POST", @"PUT", @"DELETE", nil]; 24 | self.chosenVerb = @"GET"; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)dealloc 30 | { 31 | [_chosenVerb release]; 32 | [_verbs release]; 33 | [_picker release]; 34 | [super dealloc]; 35 | } 36 | 37 | - (IBAction)verbChosen:(id)sender 38 | { 39 | [self.parent pickerDone]; 40 | } 41 | 42 | #pragma mark - 43 | #pragma mark UIPickerViewDelegate methods 44 | 45 | - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component 46 | { 47 | return [self.verbs objectAtIndex:row]; 48 | } 49 | 50 | - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 51 | { 52 | self.chosenVerb = [self.verbs objectAtIndex:row]; 53 | } 54 | 55 | #pragma mark - 56 | #pragma mark UIPickerViewDataSource methods 57 | 58 | - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView 59 | { 60 | return 1; 61 | } 62 | 63 | - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component 64 | { 65 | return 4; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Classes/Controller.m: -------------------------------------------------------------------------------- 1 | // 2 | // Controller.m 3 | // iPhoneWrapperTest 4 | // 5 | // Created by Adrian on 11/18/08. 6 | // Copyright akosma software 2008. All rights reserved. 7 | // 8 | 9 | #import "Controller.h" 10 | #import "Wrapper.h" 11 | #import "VerbPicker.h" 12 | 13 | @implementation Controller 14 | 15 | @synthesize address = _address; 16 | @synthesize parameter = _parameter; 17 | @synthesize output = _output; 18 | @synthesize popUpButton = _popUpButton; 19 | @synthesize engine = _engine; 20 | @synthesize picker = _picker; 21 | 22 | - (void)dealloc 23 | { 24 | [_engine release]; 25 | [_picker release]; 26 | [super dealloc]; 27 | } 28 | 29 | - (void)pickerDone 30 | { 31 | [self.picker.view removeFromSuperview]; 32 | [self.popUpButton setTitle:self.picker.chosenVerb forState:UIControlStateNormal]; 33 | [self.popUpButton setTitle:self.picker.chosenVerb forState:UIControlStateHighlighted]; 34 | } 35 | 36 | #pragma mark - 37 | #pragma mark WrapperDelegate methods 38 | 39 | - (void)wrapper:(Wrapper *)wrapper didRetrieveData:(NSData *)data 40 | { 41 | NSString *text = [self.engine responseAsText]; 42 | if (text != nil) 43 | { 44 | self.output.text = text; 45 | } 46 | [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; 47 | } 48 | 49 | - (void)wrapperHasBadCredentials:(Wrapper *)wrapper 50 | { 51 | [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; 52 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Bad credentials!" 53 | message:@"Bad credentials!" 54 | delegate:self 55 | cancelButtonTitle:@"OK" 56 | otherButtonTitles:nil]; 57 | [alert show]; 58 | [alert release]; 59 | } 60 | 61 | - (void)wrapper:(Wrapper *)wrapper didCreateResourceAtURL:(NSString *)url 62 | { 63 | [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; 64 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Resource created!" 65 | message:[NSString stringWithFormat:@"Resource created at %@!", url] 66 | delegate:self 67 | cancelButtonTitle:@"OK" 68 | otherButtonTitles:nil]; 69 | [alert show]; 70 | [alert release]; 71 | } 72 | 73 | - (void)wrapper:(Wrapper *)wrapper didFailWithError:(NSError *)error 74 | { 75 | [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; 76 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error!" 77 | message:[NSString stringWithFormat:@"Error code: %d!", [error code]] 78 | delegate:self 79 | cancelButtonTitle:@"OK" 80 | otherButtonTitles:nil]; 81 | [alert show]; 82 | [alert release]; 83 | } 84 | 85 | - (void)wrapper:(Wrapper *)wrapper didReceiveStatusCode:(int)statusCode 86 | { 87 | [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; 88 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Status code not OK!" 89 | message:[NSString stringWithFormat:@"Status code not OK: %d!", statusCode] 90 | delegate:self 91 | cancelButtonTitle:@"OK" 92 | otherButtonTitles:nil]; 93 | [alert show]; 94 | [alert release]; 95 | } 96 | 97 | #pragma mark - 98 | #pragma mark UITextFieldDelegate methods 99 | 100 | - (BOOL)textFieldShouldReturn:(UITextField *)textField 101 | { 102 | [textField resignFirstResponder]; 103 | return YES; 104 | } 105 | 106 | #pragma mark - 107 | #pragma mark IBAction methods 108 | 109 | - (IBAction)launch:(id)sender 110 | { 111 | [self.address resignFirstResponder]; 112 | [self.parameter resignFirstResponder]; 113 | 114 | NSURL *url = [NSURL URLWithString:self.address.text]; 115 | NSDictionary *parameters = nil; 116 | if ([self.parameter.text length] > 0) 117 | { 118 | NSArray *keys = [NSArray arrayWithObjects:@"parameter", nil]; 119 | NSArray *values = [NSArray arrayWithObjects:self.parameter.text, nil]; 120 | parameters = [NSDictionary dictionaryWithObjects:values forKeys:keys]; 121 | } 122 | 123 | [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; 124 | self.output.text = @""; 125 | 126 | if (self.engine == nil) 127 | { 128 | self.engine = [[[Wrapper alloc] init] autorelease]; 129 | self.engine.delegate = self; 130 | } 131 | [self.engine sendRequestTo:url 132 | usingVerb:[self.popUpButton titleForState:UIControlStateNormal] 133 | withParameters:parameters]; 134 | } 135 | 136 | - (IBAction)chooseMethod:(id)sender 137 | { 138 | [self.address resignFirstResponder]; 139 | [self.parameter resignFirstResponder]; 140 | 141 | if (self.picker == nil) 142 | { 143 | self.picker = [[[VerbPicker alloc] init] autorelease]; 144 | self.picker.parent = self; 145 | } 146 | [self.view addSubview:self.picker.view]; 147 | } 148 | 149 | @end 150 | -------------------------------------------------------------------------------- /MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 528 5 | 9F2114 6 | 672 7 | 949.41 8 | 352.00 9 | 10 | YES 11 | 12 | 13 | 14 | YES 15 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 16 | 17 | 18 | YES 19 | 20 | IBFilesOwner 21 | 22 | 23 | IBFirstResponder 24 | 25 | 26 | 27 | Controller 28 | 29 | 30 | 31 | 32 | 292 33 | {320, 480} 34 | 35 | 1 36 | MSAxIDEAA 37 | 38 | NO 39 | NO 40 | 41 | 42 | 43 | 44 | 45 | YES 46 | 47 | 48 | delegate 49 | 50 | 51 | 52 | 17 53 | 54 | 55 | 56 | viewController 57 | 58 | 59 | 60 | 18 61 | 62 | 63 | 64 | window 65 | 66 | 67 | 68 | 19 69 | 70 | 71 | 72 | 73 | YES 74 | 75 | 0 76 | 77 | YES 78 | 79 | 80 | 81 | 82 | 83 | -1 84 | 85 | 86 | RmlsZSdzIE93bmVyA 87 | 88 | 89 | 3 90 | 91 | 92 | App Delegate 93 | 94 | 95 | -2 96 | 97 | 98 | 99 | 100 | 10 101 | 102 | 103 | Controller 104 | 105 | 106 | 12 107 | 108 | 109 | 110 | 111 | 112 | 113 | YES 114 | 115 | YES 116 | -1.CustomClassName 117 | -2.CustomClassName 118 | 10.CustomClassName 119 | 10.IBEditorWindowLastContentRect 120 | 10.IBPluginDependency 121 | 12.IBEditorWindowLastContentRect 122 | 12.IBPluginDependency 123 | 3.CustomClassName 124 | 3.IBPluginDependency 125 | 126 | 127 | YES 128 | UIApplication 129 | UIResponder 130 | Controller 131 | {{452, 351}, {320, 480}} 132 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 133 | {{525, 346}, {320, 480}} 134 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 135 | AppDelegate 136 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 137 | 138 | 139 | 140 | YES 141 | 142 | YES 143 | 144 | 145 | YES 146 | 147 | 148 | 149 | 150 | YES 151 | 152 | YES 153 | 154 | 155 | YES 156 | 157 | 158 | 159 | 19 160 | 161 | 162 | 163 | YES 164 | 165 | AppDelegate 166 | NSObject 167 | 168 | YES 169 | 170 | YES 171 | viewController 172 | window 173 | 174 | 175 | YES 176 | Controller 177 | UIWindow 178 | 179 | 180 | 181 | IBProjectSource 182 | Classes/AppDelegate.h 183 | 184 | 185 | 186 | Controller 187 | UIViewController 188 | 189 | YES 190 | 191 | YES 192 | chooseMethod: 193 | launch: 194 | 195 | 196 | YES 197 | id 198 | id 199 | 200 | 201 | 202 | YES 203 | 204 | YES 205 | address 206 | output 207 | parameter 208 | popUpButton 209 | 210 | 211 | YES 212 | UITextField 213 | UITextView 214 | UITextField 215 | UIButton 216 | 217 | 218 | 219 | IBProjectSource 220 | Classes/Controller.h 221 | 222 | 223 | 224 | 225 | 0 226 | iPhoneWrapperTest.xcodeproj 227 | 3 228 | 229 | 230 | -------------------------------------------------------------------------------- /VerbPicker.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 528 5 | 9F2114 6 | 672 7 | 949.41 8 | 352.00 9 | 10 | YES 11 | 12 | 13 | 14 | YES 15 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 16 | 17 | 18 | YES 19 | 20 | IBFilesOwner 21 | 22 | 23 | IBFirstResponder 24 | 25 | 26 | 27 | 292 28 | 29 | YES 30 | 31 | 32 | 269 33 | {{0, 244}, {320, 216}} 34 | 35 | NO 36 | YES 37 | YES 38 | YES 39 | 40 | 41 | 42 | 292 43 | {{220, 333}, {80, 37}} 44 | 45 | NO 46 | NO 47 | 0 48 | 0 49 | 50 | Helvetica-Bold 51 | 1.500000e+01 52 | 16 53 | 54 | 1 55 | Choose 56 | Choose 57 | Choose 58 | Choose 59 | 60 | 1 61 | MSAxIDEAA 62 | 63 | 64 | 1 65 | MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA 66 | 67 | 68 | 69 | {320, 460} 70 | 71 | 72 | 3 73 | MSAwLjQ5MDAwMDAxAA 74 | 75 | 76 | 77 | 78 | 79 | 80 | YES 81 | 82 | 83 | view 84 | 85 | 86 | 87 | 4 88 | 89 | 90 | 91 | picker 92 | 93 | 94 | 95 | 5 96 | 97 | 98 | 99 | dataSource 100 | 101 | 102 | 103 | 6 104 | 105 | 106 | 107 | delegate 108 | 109 | 110 | 111 | 7 112 | 113 | 114 | 115 | verbChosen: 116 | 117 | 118 | 7 119 | 120 | 10 121 | 122 | 123 | 124 | 125 | YES 126 | 127 | 0 128 | 129 | YES 130 | 131 | 132 | 133 | 134 | 135 | 1 136 | 137 | 138 | YES 139 | 140 | 141 | 142 | 143 | 144 | 145 | -1 146 | 147 | 148 | RmlsZSdzIE93bmVyA 149 | 150 | 151 | -2 152 | 153 | 154 | 155 | 156 | 3 157 | 158 | 159 | 160 | 161 | 8 162 | 163 | 164 | 165 | 166 | 167 | 168 | YES 169 | 170 | YES 171 | -1.CustomClassName 172 | -2.CustomClassName 173 | 1.IBEditorWindowLastContentRect 174 | 1.IBPluginDependency 175 | 3.IBPluginDependency 176 | 8.IBPluginDependency 177 | 178 | 179 | YES 180 | VerbPicker 181 | UIResponder 182 | {{397, 356}, {320, 480}} 183 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 184 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 185 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 186 | 187 | 188 | 189 | YES 190 | 191 | YES 192 | 193 | 194 | YES 195 | 196 | 197 | 198 | 199 | YES 200 | 201 | YES 202 | 203 | 204 | YES 205 | 206 | 207 | 208 | 10 209 | 210 | 211 | 212 | YES 213 | 214 | VerbPicker 215 | UIViewController 216 | 217 | verbChosen: 218 | id 219 | 220 | 221 | picker 222 | UIPickerView 223 | 224 | 225 | IBProjectSource 226 | Classes/VerbPicker.h 227 | 228 | 229 | 230 | 231 | 0 232 | iPhoneWrapperTest.xcodeproj 233 | 3 234 | 235 | 236 | -------------------------------------------------------------------------------- /Classes/Wrapper.m: -------------------------------------------------------------------------------- 1 | // 2 | // Wrapper.m 3 | // WrapperTest 4 | // 5 | // Created by Adrian on 10/18/08. 6 | // Copyright 2008 Adrian Kosmaczewski. All rights reserved. 7 | // 8 | 9 | #import "Wrapper.h" 10 | 11 | @interface Wrapper (Private) 12 | - (void)startConnection:(NSURLRequest *)request; 13 | @end 14 | 15 | @implementation Wrapper 16 | 17 | @synthesize receivedData = _receivedData; 18 | @synthesize asynchronous = _asynchronous; 19 | @synthesize mimeType = _mimeType; 20 | @synthesize username = _username; 21 | @synthesize password = _password; 22 | @synthesize delegate = _delegate; 23 | @synthesize conn = _conn; 24 | 25 | #pragma mark - Constructor and destructor 26 | 27 | - (id)init 28 | { 29 | if(self = [super init]) 30 | { 31 | self.receivedData = [NSMutableData data]; 32 | self.conn = nil; 33 | 34 | self.asynchronous = YES; 35 | self.mimeType = @"text/html"; 36 | self.delegate = nil; 37 | self.username = @""; 38 | self.password = @""; 39 | } 40 | 41 | return self; 42 | } 43 | 44 | - (void)dealloc 45 | { 46 | _delegate = nil; 47 | [_receivedData release]; 48 | [_mimeType release]; 49 | [_username release]; 50 | [_password release]; 51 | [_conn release]; 52 | [super dealloc]; 53 | } 54 | 55 | #pragma mark - 56 | #pragma mark Public methods 57 | 58 | - (void)sendRequestTo:(NSURL *)url usingVerb:(NSString *)verb withParameters:(NSDictionary *)parameters 59 | { 60 | NSData *body = nil; 61 | NSMutableString *params = nil; 62 | NSString *contentType = @"text/html; charset=utf-8"; 63 | NSURL *finalURL = url; 64 | if (parameters != nil) 65 | { 66 | params = [[NSMutableString alloc] init]; 67 | for (id key in parameters) 68 | { 69 | NSString *encodedKey = [key stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 70 | CFStringRef value = (CFStringRef)[[parameters objectForKey:key] copy]; 71 | // Escape even the "reserved" characters for URLs 72 | // as defined in http://www.ietf.org/rfc/rfc2396.txt 73 | CFStringRef encodedValue = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, 74 | value, 75 | NULL, 76 | (CFStringRef)@";/?:@&=+$,", 77 | kCFStringEncodingUTF8); 78 | [params appendFormat:@"%@=%@&", encodedKey, encodedValue]; 79 | CFRelease(value); 80 | CFRelease(encodedValue); 81 | } 82 | [params deleteCharactersInRange:NSMakeRange([params length] - 1, 1)]; 83 | } 84 | 85 | if ([verb isEqualToString:@"POST"] || [verb isEqualToString:@"PUT"]) 86 | { 87 | contentType = @"application/x-www-form-urlencoded; charset=utf-8"; 88 | body = [params dataUsingEncoding:NSUTF8StringEncoding]; 89 | } 90 | else 91 | { 92 | if (parameters != nil) 93 | { 94 | NSString *urlWithParams = [[url absoluteString] stringByAppendingFormat:@"?%@", params]; 95 | finalURL = [NSURL URLWithString:urlWithParams]; 96 | } 97 | } 98 | 99 | NSMutableDictionary* headers = [[[NSMutableDictionary alloc] init] autorelease]; 100 | [headers setValue:contentType forKey:@"Content-Type"]; 101 | [headers setValue:self.mimeType forKey:@"Accept"]; 102 | [headers setValue:@"no-cache" forKey:@"Cache-Control"]; 103 | [headers setValue:@"no-cache" forKey:@"Pragma"]; 104 | [headers setValue:@"close" forKey:@"Connection"]; // Avoid HTTP 1.1 "keep alive" for the connection 105 | 106 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:finalURL 107 | cachePolicy:NSURLRequestUseProtocolCachePolicy 108 | timeoutInterval:60.0]; 109 | [request setHTTPMethod:verb]; 110 | [request setAllHTTPHeaderFields:headers]; 111 | if (parameters != nil) 112 | { 113 | [request setHTTPBody:body]; 114 | } 115 | [params release]; 116 | [self startConnection:request]; 117 | } 118 | 119 | - (void)uploadData:(NSData *)data toURL:(NSURL *)url 120 | { 121 | // File upload code adapted from http://www.cocoadev.com/index.pl?HTTPFileUpload 122 | // and http://www.cocoadev.com/index.pl?HTTPFileUploadSample 123 | 124 | NSString* stringBoundary = [NSString stringWithString:@"0xKhTmLbOuNdArY"]; 125 | 126 | NSMutableDictionary* headers = [[[NSMutableDictionary alloc] init] autorelease]; 127 | [headers setValue:@"no-cache" forKey:@"Cache-Control"]; 128 | [headers setValue:@"no-cache" forKey:@"Pragma"]; 129 | [headers setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", stringBoundary] forKey:@"Content-Type"]; 130 | 131 | NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url 132 | cachePolicy:NSURLRequestUseProtocolCachePolicy 133 | timeoutInterval:60.0]; 134 | [request setHTTPMethod:@"POST"]; 135 | [request setAllHTTPHeaderFields:headers]; 136 | 137 | NSMutableData* postData = [NSMutableData dataWithCapacity:[data length] + 512]; 138 | [postData appendData:[[NSString stringWithFormat:@"--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; 139 | [postData appendData:[@"Content-Disposition: form-data; name=\"image\"; filename=\"test.bin\"\r\n\r\n" 140 | dataUsingEncoding:NSUTF8StringEncoding]]; 141 | [postData appendData:data]; 142 | [postData appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; 143 | [request setHTTPBody:postData]; 144 | 145 | [self startConnection:request]; 146 | } 147 | 148 | - (void)cancelConnection 149 | { 150 | [self.conn cancel]; 151 | self.conn = nil; 152 | } 153 | 154 | - (NSDictionary *)responseAsPropertyList 155 | { 156 | NSString *errorStr = nil; 157 | NSPropertyListFormat format; 158 | NSDictionary *propertyList = [NSPropertyListSerialization propertyListFromData:self.receivedData 159 | mutabilityOption:NSPropertyListImmutable 160 | format:&format 161 | errorDescription:&errorStr]; 162 | [errorStr release]; 163 | return propertyList; 164 | } 165 | 166 | - (NSString *)responseAsText 167 | { 168 | return [[[NSString alloc] initWithData:self.receivedData 169 | encoding:NSUTF8StringEncoding] autorelease]; 170 | } 171 | 172 | #pragma mark - 173 | #pragma mark Private methods 174 | 175 | - (void)startConnection:(NSURLRequest *)request 176 | { 177 | if (self.asynchronous) 178 | { 179 | [self cancelConnection]; 180 | self.conn = [[[NSURLConnection alloc] initWithRequest:request 181 | delegate:self 182 | startImmediately:YES] autorelease]; 183 | 184 | if (!self.conn) 185 | { 186 | if ([self.delegate respondsToSelector:@selector(wrapper:didFailWithError:)]) 187 | { 188 | NSMutableDictionary* info = [NSMutableDictionary dictionaryWithObject:[request URL] forKey:NSURLErrorFailingURLStringErrorKey]; 189 | [info setObject:@"Could not open connection" forKey:NSLocalizedDescriptionKey]; 190 | NSError* error = [NSError errorWithDomain:@"Wrapper" code:1 userInfo:info]; 191 | [self.delegate wrapper:self didFailWithError:error]; 192 | } 193 | } 194 | } 195 | else 196 | { 197 | NSURLResponse* response = [[[NSURLResponse alloc] init] autorelease]; 198 | NSError* error = nil; 199 | NSData *data = [NSURLConnection sendSynchronousRequest:request 200 | returningResponse:&response 201 | error:&error]; 202 | [self.receivedData appendData:data]; 203 | } 204 | } 205 | 206 | #pragma mark - 207 | #pragma mark NSURLConnection delegate methods 208 | 209 | - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge 210 | { 211 | NSInteger count = [challenge previousFailureCount]; 212 | if (count == 0) 213 | { 214 | NSURLCredential* credential = [[NSURLCredential credentialWithUser:self.username 215 | password:self.password 216 | persistence:NSURLCredentialPersistenceNone] autorelease]; 217 | [[challenge sender] useCredential:credential 218 | forAuthenticationChallenge:challenge]; 219 | } 220 | else 221 | { 222 | [[challenge sender] cancelAuthenticationChallenge:challenge]; 223 | if ([self.delegate respondsToSelector:@selector(wrapperHasBadCredentials:)]) 224 | { 225 | [self.delegate wrapperHasBadCredentials:self]; 226 | } 227 | } 228 | } 229 | 230 | - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 231 | { 232 | NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response; 233 | int statusCode = [httpResponse statusCode]; 234 | switch (statusCode) 235 | { 236 | case 200: 237 | break; 238 | 239 | case 201: 240 | { 241 | NSString* url = [[httpResponse allHeaderFields] objectForKey:@"Location"]; 242 | if ([self.delegate respondsToSelector:@selector(wrapper:didCreateResourceAtURL:)]) 243 | { 244 | [self.delegate wrapper:self didCreateResourceAtURL:url]; 245 | } 246 | break; 247 | } 248 | 249 | // Here you could add more status code handling... for example 404 (not found), 250 | // 204 (after a PUT or a DELETE), 500 (server error), etc... with the 251 | // corresponding delegate methods called as required. 252 | 253 | default: 254 | { 255 | if ([self.delegate respondsToSelector:@selector(wrapper:didReceiveStatusCode:)]) 256 | { 257 | [self.delegate wrapper:self didReceiveStatusCode:statusCode]; 258 | } 259 | break; 260 | } 261 | } 262 | [self.receivedData setLength:0]; 263 | } 264 | 265 | - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 266 | { 267 | [self.receivedData appendData:data]; 268 | } 269 | 270 | - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error 271 | { 272 | [self cancelConnection]; 273 | if ([self.delegate respondsToSelector:@selector(wrapper:didFailWithError:)]) 274 | { 275 | [self.delegate wrapper:self didFailWithError:error]; 276 | } 277 | } 278 | 279 | - (void)connectionDidFinishLoading:(NSURLConnection *)connection 280 | { 281 | [self cancelConnection]; 282 | if ([self.delegate respondsToSelector:@selector(wrapper:didRetrieveData:)]) 283 | { 284 | [self.delegate wrapper:self didRetrieveData:self.receivedData]; 285 | } 286 | } 287 | 288 | @end 289 | -------------------------------------------------------------------------------- /iPhoneWrapperTest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AppDelegate.m */; }; 11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 14 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 15 | 2899E5220DE3E06400AC0155 /* Controller.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* Controller.xib */; }; 16 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 17 | 28D7ACF80DDB3853001CB0EB /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* Controller.m */; }; 18 | 3A0BCA990ED2DFBF004659C5 /* VerbPicker.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A0BCA980ED2DFBF004659C5 /* VerbPicker.xib */; }; 19 | 3A0BCA9D0ED2DFE4004659C5 /* VerbPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A0BCA9C0ED2DFE4004659C5 /* VerbPicker.m */; }; 20 | 3A6135EE0ED2C3D10002D5C9 /* Wrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A6135ED0ED2C3D10002D5C9 /* Wrapper.m */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 25 | 1D3623240D0F684500981E51 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 26 | 1D3623250D0F684500981E51 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | 1D6058910D05DD3D006BFB54 /* iPhoneWrapperTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iPhoneWrapperTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 29 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 30 | 2899E5210DE3E06400AC0155 /* Controller.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Controller.xib; sourceTree = ""; }; 31 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 32 | 28D7ACF60DDB3853001CB0EB /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = ""; }; 33 | 28D7ACF70DDB3853001CB0EB /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = ""; }; 34 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 35 | 32CA4F630368D1EE00C91783 /* iPhoneWrapperTest_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iPhoneWrapperTest_Prefix.pch; sourceTree = ""; }; 36 | 3A0BCA980ED2DFBF004659C5 /* VerbPicker.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VerbPicker.xib; sourceTree = ""; }; 37 | 3A0BCA9B0ED2DFE4004659C5 /* VerbPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VerbPicker.h; sourceTree = ""; }; 38 | 3A0BCA9C0ED2DFE4004659C5 /* VerbPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VerbPicker.m; sourceTree = ""; }; 39 | 3A6135EC0ED2C3D10002D5C9 /* Wrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Wrapper.h; sourceTree = ""; }; 40 | 3A6135ED0ED2C3D10002D5C9 /* Wrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Wrapper.m; sourceTree = ""; }; 41 | 3A6135FC0ED2C3F80002D5C9 /* WrapperDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WrapperDelegate.h; sourceTree = ""; }; 42 | 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 51 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 52 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | 080E96DDFE201D6D7F000001 /* Classes */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 3A6135FC0ED2C3F80002D5C9 /* WrapperDelegate.h */, 63 | 3A6135EC0ED2C3D10002D5C9 /* Wrapper.h */, 64 | 3A6135ED0ED2C3D10002D5C9 /* Wrapper.m */, 65 | 1D3623240D0F684500981E51 /* AppDelegate.h */, 66 | 1D3623250D0F684500981E51 /* AppDelegate.m */, 67 | 28D7ACF60DDB3853001CB0EB /* Controller.h */, 68 | 28D7ACF70DDB3853001CB0EB /* Controller.m */, 69 | 3A0BCA9B0ED2DFE4004659C5 /* VerbPicker.h */, 70 | 3A0BCA9C0ED2DFE4004659C5 /* VerbPicker.m */, 71 | ); 72 | path = Classes; 73 | sourceTree = ""; 74 | }; 75 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 1D6058910D05DD3D006BFB54 /* iPhoneWrapperTest.app */, 79 | ); 80 | name = Products; 81 | sourceTree = ""; 82 | }; 83 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 080E96DDFE201D6D7F000001 /* Classes */, 87 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 88 | 29B97317FDCFA39411CA2CEA /* Resources */, 89 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 90 | 19C28FACFE9D520D11CA2CBB /* Products */, 91 | ); 92 | name = CustomTemplate; 93 | sourceTree = ""; 94 | }; 95 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 32CA4F630368D1EE00C91783 /* iPhoneWrapperTest_Prefix.pch */, 99 | 29B97316FDCFA39411CA2CEA /* main.m */, 100 | ); 101 | name = "Other Sources"; 102 | sourceTree = ""; 103 | }; 104 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 2899E5210DE3E06400AC0155 /* Controller.xib */, 108 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */, 109 | 8D1107310486CEB800E47090 /* Info.plist */, 110 | 3A0BCA980ED2DFBF004659C5 /* VerbPicker.xib */, 111 | ); 112 | name = Resources; 113 | sourceTree = ""; 114 | }; 115 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 119 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 120 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 121 | ); 122 | name = Frameworks; 123 | sourceTree = ""; 124 | }; 125 | /* End PBXGroup section */ 126 | 127 | /* Begin PBXNativeTarget section */ 128 | 1D6058900D05DD3D006BFB54 /* iPhoneWrapperTest */ = { 129 | isa = PBXNativeTarget; 130 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iPhoneWrapperTest" */; 131 | buildPhases = ( 132 | 1D60588D0D05DD3D006BFB54 /* Resources */, 133 | 1D60588E0D05DD3D006BFB54 /* Sources */, 134 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = iPhoneWrapperTest; 141 | productName = iPhoneWrapperTest; 142 | productReference = 1D6058910D05DD3D006BFB54 /* iPhoneWrapperTest.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastUpgradeCheck = 0420; 152 | }; 153 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iPhoneWrapperTest" */; 154 | compatibilityVersion = "Xcode 3.2"; 155 | developmentRegion = English; 156 | hasScannedForEncodings = 1; 157 | knownRegions = ( 158 | en, 159 | ); 160 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 161 | projectDirPath = ""; 162 | projectRoot = ""; 163 | targets = ( 164 | 1D6058900D05DD3D006BFB54 /* iPhoneWrapperTest */, 165 | ); 166 | }; 167 | /* End PBXProject section */ 168 | 169 | /* Begin PBXResourcesBuildPhase section */ 170 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 171 | isa = PBXResourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 175 | 2899E5220DE3E06400AC0155 /* Controller.xib in Resources */, 176 | 3A0BCA990ED2DFBF004659C5 /* VerbPicker.xib in Resources */, 177 | ); 178 | runOnlyForDeploymentPostprocessing = 0; 179 | }; 180 | /* End PBXResourcesBuildPhase section */ 181 | 182 | /* Begin PBXSourcesBuildPhase section */ 183 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 184 | isa = PBXSourcesBuildPhase; 185 | buildActionMask = 2147483647; 186 | files = ( 187 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 188 | 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */, 189 | 28D7ACF80DDB3853001CB0EB /* Controller.m in Sources */, 190 | 3A6135EE0ED2C3D10002D5C9 /* Wrapper.m in Sources */, 191 | 3A0BCA9D0ED2DFE4004659C5 /* VerbPicker.m in Sources */, 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | }; 195 | /* End PBXSourcesBuildPhase section */ 196 | 197 | /* Begin XCBuildConfiguration section */ 198 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 199 | isa = XCBuildConfiguration; 200 | buildSettings = { 201 | ALWAYS_SEARCH_USER_PATHS = NO; 202 | COPY_PHASE_STRIP = NO; 203 | GCC_DYNAMIC_NO_PIC = NO; 204 | GCC_OPTIMIZATION_LEVEL = 0; 205 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 206 | GCC_PREFIX_HEADER = iPhoneWrapperTest_Prefix.pch; 207 | INFOPLIST_FILE = Info.plist; 208 | PRODUCT_NAME = iPhoneWrapperTest; 209 | }; 210 | name = Debug; 211 | }; 212 | 1D6058950D05DD3E006BFB54 /* Release */ = { 213 | isa = XCBuildConfiguration; 214 | buildSettings = { 215 | ALWAYS_SEARCH_USER_PATHS = NO; 216 | COPY_PHASE_STRIP = YES; 217 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 218 | GCC_PREFIX_HEADER = iPhoneWrapperTest_Prefix.pch; 219 | INFOPLIST_FILE = Info.plist; 220 | PRODUCT_NAME = iPhoneWrapperTest; 221 | }; 222 | name = Release; 223 | }; 224 | C01FCF4F08A954540054247B /* Debug */ = { 225 | isa = XCBuildConfiguration; 226 | buildSettings = { 227 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 228 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 229 | GCC_C_LANGUAGE_STANDARD = c99; 230 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 231 | GCC_WARN_UNUSED_VARIABLE = YES; 232 | ONLY_ACTIVE_ARCH = YES; 233 | SDKROOT = iphoneos; 234 | }; 235 | name = Debug; 236 | }; 237 | C01FCF5008A954540054247B /* Release */ = { 238 | isa = XCBuildConfiguration; 239 | buildSettings = { 240 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 241 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 242 | GCC_C_LANGUAGE_STANDARD = c99; 243 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 244 | GCC_WARN_UNUSED_VARIABLE = YES; 245 | SDKROOT = iphoneos; 246 | }; 247 | name = Release; 248 | }; 249 | /* End XCBuildConfiguration section */ 250 | 251 | /* Begin XCConfigurationList section */ 252 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iPhoneWrapperTest" */ = { 253 | isa = XCConfigurationList; 254 | buildConfigurations = ( 255 | 1D6058940D05DD3E006BFB54 /* Debug */, 256 | 1D6058950D05DD3E006BFB54 /* Release */, 257 | ); 258 | defaultConfigurationIsVisible = 0; 259 | defaultConfigurationName = Debug; 260 | }; 261 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iPhoneWrapperTest" */ = { 262 | isa = XCConfigurationList; 263 | buildConfigurations = ( 264 | C01FCF4F08A954540054247B /* Debug */, 265 | C01FCF5008A954540054247B /* Release */, 266 | ); 267 | defaultConfigurationIsVisible = 0; 268 | defaultConfigurationName = Debug; 269 | }; 270 | /* End XCConfigurationList section */ 271 | }; 272 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 273 | } 274 | -------------------------------------------------------------------------------- /Controller.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 528 5 | 11D50b 6 | 1938 7 | 1138.32 8 | 568.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 933 12 | 13 | 14 | YES 15 | IBUILabel 16 | IBUITextView 17 | IBUIButton 18 | IBUIView 19 | IBUITextField 20 | IBProxyObject 21 | 22 | 23 | YES 24 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 25 | 26 | 27 | PluginDependencyRecalculationVersion 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 274 43 | 44 | YES 45 | 46 | 47 | 274 48 | {{0, 86}, {320, 374}} 49 | 50 | 51 | 52 | 53 | 3 54 | MC45ODE3NTE4AA 55 | 56 | NO 57 | YES 58 | YES 59 | IBCocoaTouchFramework 60 | NO 61 | NO 62 | NO 63 | NO 64 | NO 65 | 66 | 67 | IBCocoaTouchFramework 68 | 69 | 70 | 1 71 | 17 72 | 73 | 74 | Helvetica 75 | 17 76 | 16 77 | 78 | 79 | 80 | 81 | 292 82 | {{5, 8}, {150, 31}} 83 | 84 | 85 | 86 | NO 87 | NO 88 | IBCocoaTouchFramework 89 | 0 90 | http://localhost:8888/test.php 91 | 3 92 | 93 | 3 94 | MAA 95 | 96 | 2 97 | 98 | 99 | 17 100 | 101 | IBCocoaTouchFramework 102 | 103 | 104 | 1 105 | 12 106 | 107 | 108 | Helvetica 109 | 12 110 | 16 111 | 112 | 113 | 114 | 115 | 292 116 | {{243, 4}, {72, 37}} 117 | 118 | 119 | 120 | NO 121 | NO 122 | IBCocoaTouchFramework 123 | 0 124 | 0 125 | 1 126 | Send 127 | Send 128 | Send 129 | Send 130 | 131 | 1 132 | MSAxIDEAA 133 | 134 | 135 | 1 136 | MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA 137 | 138 | 139 | 3 140 | MAA 141 | 142 | 143 | Helvetica-Bold 144 | Helvetica 145 | 2 146 | 15 147 | 148 | 149 | Helvetica-Bold 150 | 15 151 | 16 152 | 153 | 154 | 155 | 156 | 292 157 | {{5, 52}, {64, 21}} 158 | 159 | 160 | 161 | NO 162 | YES 163 | NO 164 | IBCocoaTouchFramework 165 | parameter 166 | 167 | 1 168 | MCAwIDAAA 169 | 170 | 171 | 1 172 | 10 173 | 174 | Helvetica 175 | Helvetica 176 | 0 177 | 12 178 | 179 | 180 | 181 | 182 | 183 | 292 184 | {{77, 47}, {238, 31}} 185 | 186 | 187 | 188 | NO 189 | NO 190 | IBCocoaTouchFramework 191 | 0 192 | 193 | 3 194 | 195 | 3 196 | MAA 197 | 198 | 199 | 17 200 | 201 | IBCocoaTouchFramework 202 | 203 | 204 | 205 | 206 | 207 | 208 | 292 209 | {{163, 4}, {72, 37}} 210 | 211 | 212 | 213 | NO 214 | NO 215 | IBCocoaTouchFramework 216 | 0 217 | 0 218 | 1 219 | GET 220 | GET 221 | GET 222 | GET 223 | 224 | 225 | 1 226 | MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA 227 | 228 | 229 | 230 | 231 | 232 | 233 | {{0, 20}, {320, 460}} 234 | 235 | 236 | 237 | 238 | 3 239 | MC43ODQ2NzE1NQA 240 | 241 | NO 242 | 243 | IBCocoaTouchFramework 244 | 245 | 246 | 247 | 248 | YES 249 | 250 | 251 | view 252 | 253 | 254 | 255 | 16 256 | 257 | 258 | 259 | address 260 | 261 | 262 | 263 | 19 264 | 265 | 266 | 267 | parameter 268 | 269 | 270 | 271 | 20 272 | 273 | 274 | 275 | output 276 | 277 | 278 | 279 | 21 280 | 281 | 282 | 283 | popUpButton 284 | 285 | 286 | 287 | 22 288 | 289 | 290 | 291 | delegate 292 | 293 | 294 | 295 | 23 296 | 297 | 298 | 299 | launch: 300 | 301 | 302 | 7 303 | 304 | 17 305 | 306 | 307 | 308 | delegate 309 | 310 | 311 | 312 | 24 313 | 314 | 315 | 316 | chooseMethod: 317 | 318 | 319 | 7 320 | 321 | 18 322 | 323 | 324 | 325 | 326 | YES 327 | 328 | 0 329 | 330 | YES 331 | 332 | 333 | 334 | 335 | 336 | -1 337 | 338 | 339 | File's Owner 340 | 341 | 342 | -2 343 | 344 | 345 | 346 | 347 | 6 348 | 349 | 350 | YES 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 9 362 | 363 | 364 | 365 | 366 | 10 367 | 368 | 369 | 370 | 371 | 11 372 | 373 | 374 | 375 | 376 | 12 377 | 378 | 379 | 380 | 381 | 13 382 | 383 | 384 | 385 | 386 | 15 387 | 388 | 389 | 390 | 391 | 392 | 393 | YES 394 | 395 | YES 396 | -1.CustomClassName 397 | -1.IBPluginDependency 398 | -2.CustomClassName 399 | -2.IBPluginDependency 400 | 10.IBPluginDependency 401 | 11.IBPluginDependency 402 | 12.IBPluginDependency 403 | 13.IBPluginDependency 404 | 15.IBPluginDependency 405 | 6.IBPluginDependency 406 | 9.IBPluginDependency 407 | 408 | 409 | YES 410 | Controller 411 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 412 | UIResponder 413 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 414 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 415 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 416 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 417 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 418 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 419 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 420 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 421 | 422 | 423 | 424 | YES 425 | 426 | 427 | 428 | 429 | 430 | YES 431 | 432 | 433 | 434 | 435 | 24 436 | 437 | 438 | 439 | YES 440 | 441 | Controller 442 | UIViewController 443 | 444 | YES 445 | 446 | YES 447 | chooseMethod: 448 | launch: 449 | 450 | 451 | YES 452 | id 453 | id 454 | 455 | 456 | 457 | YES 458 | 459 | YES 460 | chooseMethod: 461 | launch: 462 | 463 | 464 | YES 465 | 466 | chooseMethod: 467 | id 468 | 469 | 470 | launch: 471 | id 472 | 473 | 474 | 475 | 476 | YES 477 | 478 | YES 479 | address 480 | output 481 | parameter 482 | popUpButton 483 | 484 | 485 | YES 486 | UITextField 487 | UITextView 488 | UITextField 489 | UIButton 490 | 491 | 492 | 493 | YES 494 | 495 | YES 496 | address 497 | output 498 | parameter 499 | popUpButton 500 | 501 | 502 | YES 503 | 504 | address 505 | UITextField 506 | 507 | 508 | output 509 | UITextView 510 | 511 | 512 | parameter 513 | UITextField 514 | 515 | 516 | popUpButton 517 | UIButton 518 | 519 | 520 | 521 | 522 | IBProjectSource 523 | ./Classes/Controller.h 524 | 525 | 526 | 527 | 528 | 0 529 | IBCocoaTouchFramework 530 | 531 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 532 | 533 | 534 | 535 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 536 | 537 | 538 | YES 539 | 3 540 | 933 541 | 542 | 543 | --------------------------------------------------------------------------------