├── Classes ├── SSLocationManager │ ├── Helpers │ │ ├── MulticastDelegate.h │ │ ├── MulticastDelegate.m │ │ ├── NSObject+Helpers.h │ │ ├── NSObject+Helpers.m │ │ ├── NSString+Helpers.h │ │ ├── NSString+Helpers.m │ │ ├── UIHelpers.h │ │ └── UIHelpers.m │ ├── SBJSON │ │ ├── JSON.h │ │ ├── NSObject+SBJSON.h │ │ ├── NSObject+SBJSON.m │ │ ├── NSString+SBJSON.h │ │ ├── NSString+SBJSON.m │ │ ├── SBJSON.h │ │ ├── SBJSON.m │ │ ├── SBJsonBase.h │ │ ├── SBJsonBase.m │ │ ├── SBJsonParser.h │ │ ├── SBJsonParser.m │ │ ├── SBJsonWriter.h │ │ └── SBJsonWriter.m │ ├── SSLocationManager │ │ ├── SSLocationManager.h │ │ ├── SSLocationManager.m │ │ ├── YahooPlaceData.h │ │ ├── YahooPlaceData.m │ │ ├── YahooPlaceFinder.h │ │ └── YahooPlaceFinder.m │ └── SSWebRequest │ │ ├── SSWebRequest.h │ │ ├── SSWebRequest.m │ │ ├── SSWebRequestDelegate.h │ │ ├── SSWebRequestParams.h │ │ └── SSWebRequestParams.m ├── SSLocationManagerAppDelegate.h ├── SSLocationManagerAppDelegate.m ├── SSLocationManagerViewController.h └── SSLocationManagerViewController.m ├── LICENSE.txt ├── MainWindow.xib ├── README.md ├── SSLocationManager-Info.plist ├── SSLocationManager.xcodeproj ├── ardalahmet.mode1v3 ├── ardalahmet.pbxuser └── project.pbxproj ├── SSLocationManagerViewController.xib ├── SSLocationManager_Prefix.pch └── main.m /Classes/SSLocationManager/Helpers/MulticastDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class MulticastDelegateEnumerator; 4 | 5 | struct MulticastDelegateListNode { 6 | id delegate; 7 | struct MulticastDelegateListNode *prev; 8 | struct MulticastDelegateListNode *next; 9 | NSUInteger retainCount; 10 | }; 11 | typedef struct MulticastDelegateListNode MulticastDelegateListNode; 12 | 13 | 14 | @interface MulticastDelegate : NSObject 15 | { 16 | MulticastDelegateListNode *delegateList; 17 | } 18 | 19 | - (void)addDelegate:(id)delegate; 20 | - (void)removeDelegate:(id)delegate; 21 | 22 | - (void)removeAllDelegates; 23 | 24 | - (NSUInteger)count; 25 | 26 | - (MulticastDelegateEnumerator *)delegateEnumerator; 27 | 28 | @end 29 | 30 | @interface MulticastDelegateEnumerator: NSObject 31 | { 32 | NSUInteger numDelegates; 33 | NSUInteger currentDelegateIndex; 34 | MulticastDelegateListNode **delegates; 35 | } 36 | 37 | - (id) nextDelegate; 38 | - (id) nextDelegateForSelector:(SEL)selector; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/Helpers/MulticastDelegate.m: -------------------------------------------------------------------------------- 1 | #import "MulticastDelegate.h" 2 | 3 | /** 4 | * How does this class work? 5 | * 6 | * In theory, this class is very straight-forward. 7 | * It provides a way for multiple delegates to be called. 8 | * So any delegate method call to this class will get forwarded to each delegate in the list. 9 | * 10 | * In practice it's fairly easy as well, but there are two small complications. 11 | * 12 | * Complication 1: 13 | * A class must not retain its delegate. 14 | * That is, if you call [client setDelegate:self], "client" should NOT be retaining "self". 15 | * This means we should avoid storing all the delegates in an NSArray, 16 | * or any other such class that retains its objects. 17 | * 18 | * Complication 2: 19 | * A delegate must be allowed to add/remove itself at any time. 20 | * This includes removing itself in the middle of a delegate callback without any unintended complications. 21 | * 22 | * We solve these complications by using a simple linked list. 23 | **/ 24 | 25 | @interface MulticastDelegateEnumerator (PrivateAPI) 26 | 27 | - (id)initWithDelegateList:(MulticastDelegateListNode *)delegateList; 28 | 29 | @end 30 | 31 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 32 | #pragma mark - 33 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 34 | 35 | static void MulticastDelegateListNodeRetain(MulticastDelegateListNode *node) 36 | { 37 | node->retainCount++; 38 | } 39 | 40 | static void MulticastDelegateListNodeRelease(MulticastDelegateListNode *node) 41 | { 42 | node->retainCount--; 43 | 44 | if(node->retainCount == 0) 45 | { 46 | free(node); 47 | } 48 | } 49 | 50 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 51 | #pragma mark - 52 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 53 | 54 | @implementation MulticastDelegate 55 | 56 | - (id)init 57 | { 58 | if((self = [super init])) 59 | { 60 | delegateList = NULL; 61 | } 62 | return self; 63 | } 64 | 65 | - (void)addDelegate:(id)delegate 66 | { 67 | if(delegate == nil) return; 68 | 69 | MulticastDelegateListNode *node = malloc(sizeof(MulticastDelegateListNode)); 70 | 71 | node->delegate = delegate; 72 | node->retainCount = 1; 73 | 74 | // Remember: The delegateList is a linked list of MulticastDelegateListNode objects. 75 | // Each node object is allocated and placed in the list. 76 | // It is not deallocated until it is later removed from the linked list. 77 | 78 | if(delegateList != NULL) 79 | { 80 | node->prev = NULL; 81 | node->next = delegateList; 82 | node->next->prev = node; 83 | } 84 | else 85 | { 86 | node->prev = NULL; 87 | node->next = NULL; 88 | } 89 | 90 | delegateList = node; 91 | } 92 | 93 | - (void)removeDelegate:(id)delegate 94 | { 95 | if(delegate == nil) return; 96 | 97 | MulticastDelegateListNode *node = delegateList; 98 | while(node != NULL) 99 | { 100 | if(delegate == node->delegate) 101 | { 102 | // Remove the node from the list. 103 | // This is done by editing the pointers of the node's neighbors to skip it. 104 | // 105 | // In other words: 106 | // node->prev->next = node->next 107 | // node->next->prev = node->prev 108 | // 109 | // We also want to properly update our delegateList pointer, 110 | // which always points to the "first" element in the list. (Most recently added.) 111 | 112 | if(node->prev != NULL) 113 | node->prev->next = node->next; 114 | else 115 | delegateList = node->next; 116 | 117 | if(node->next != NULL) 118 | node->next->prev = node->prev; 119 | 120 | node->prev = NULL; 121 | node->next = NULL; 122 | 123 | node->delegate = nil; 124 | MulticastDelegateListNodeRelease(node); 125 | 126 | break; 127 | } 128 | else 129 | { 130 | node = node->next; 131 | } 132 | } 133 | } 134 | 135 | - (void)removeAllDelegates 136 | { 137 | MulticastDelegateListNode *node = delegateList; 138 | 139 | while(node != NULL) 140 | { 141 | MulticastDelegateListNode *next = node->next; 142 | 143 | node->prev = NULL; 144 | node->next = NULL; 145 | 146 | node->delegate = nil; 147 | MulticastDelegateListNodeRelease(node); 148 | 149 | node = next; 150 | } 151 | 152 | delegateList = NULL; 153 | } 154 | 155 | - (NSUInteger)count 156 | { 157 | NSUInteger count = 0; 158 | 159 | MulticastDelegateListNode *node; 160 | for(node = delegateList; node != NULL; node = node->next) 161 | { 162 | count++; 163 | } 164 | 165 | return count; 166 | } 167 | 168 | - (MulticastDelegateEnumerator *)delegateEnumerator 169 | { 170 | return [[[MulticastDelegateEnumerator alloc] initWithDelegateList:delegateList] autorelease]; 171 | } 172 | 173 | /** 174 | * Forwarding fast path. 175 | * Available in 10.5+ (Not properly declared in NSObject until 10.6) 176 | **/ 177 | - (id)forwardingTargetForSelector:(SEL)aSelector 178 | { 179 | // We can take advantage of this if we only have one delegate (a common case), 180 | // or simply one delegate that responds to this selector. 181 | 182 | MulticastDelegateListNode *foundNode = NULL; 183 | 184 | MulticastDelegateListNode *node = delegateList; 185 | while(node != NULL) 186 | { 187 | if([node->delegate respondsToSelector:aSelector]) 188 | { 189 | if(foundNode) 190 | { 191 | // There are multiple delegates for this selector. 192 | // We can't take advantage of the forwarding fast path. 193 | return nil; 194 | } 195 | 196 | foundNode = node; 197 | } 198 | 199 | node = node->next; 200 | } 201 | 202 | if(foundNode) 203 | { 204 | return foundNode->delegate; 205 | } 206 | 207 | return nil; 208 | } 209 | 210 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 211 | { 212 | MulticastDelegateListNode *node; 213 | for(node = delegateList; node != NULL; node = node->next) 214 | { 215 | NSMethodSignature *result = [node->delegate methodSignatureForSelector:aSelector]; 216 | 217 | if(result != nil) 218 | { 219 | return result; 220 | } 221 | } 222 | 223 | // This causes a crash... 224 | // return [super methodSignatureForSelector:aSelector]; 225 | 226 | // This also causes a crash... 227 | // return nil; 228 | 229 | return [[self class] instanceMethodSignatureForSelector:@selector(doNothing)]; 230 | } 231 | 232 | - (void)forwardInvocation:(NSInvocation *)anInvocation 233 | { 234 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 235 | 236 | // Here are the rules: 237 | // 1. If a delegate is added during this method, it should NOT be invoked. 238 | // 2. If a delegate is removed during this method that has not already been invoked, it should NOT be invoked. 239 | 240 | MulticastDelegateListNode *node = delegateList; 241 | 242 | // First we loop through the linked list so we can: 243 | // - Get a count of the number of delegates 244 | // - Get a reference to the last delegate in the list 245 | // 246 | // Recall that new delegates are added to the beginning of the linked list. 247 | // The last delegate in the list is the first delegate that was added, so it will be the first that's invoked. 248 | // We're going to be moving backwards through the linked list as we invoke the delegates. 249 | 250 | NSUInteger nodeCount = 0; 251 | 252 | if(node != NULL) 253 | { 254 | nodeCount++; 255 | 256 | while(node->next != NULL) 257 | { 258 | nodeCount++; 259 | node = node->next; 260 | } 261 | 262 | // Note: The node variable is now pointing to the last node in the list. 263 | } 264 | 265 | // We're now going to create an array of all the nodes. 266 | // This gives us a quick and easy snapshot of the current list, 267 | // which will allow delegates to be added/removed from the list while we're enumerating it, 268 | // all without bothering us, and without violating any of the rules listed above. 269 | // 270 | // Note: We're creating an array of pointers. 271 | // Each pointer points to the dynamically allocated struct. 272 | // If we copied the struct, we might violate rule number two. 273 | // So we also retain each node, to prevent it from disappearing while we're enumerating the list. 274 | 275 | MulticastDelegateListNode *nodes[nodeCount]; 276 | 277 | NSUInteger i; 278 | for(i = 0; i < nodeCount; i++) 279 | { 280 | nodes[i] = node; 281 | MulticastDelegateListNodeRetain(node); 282 | 283 | node = node->prev; 284 | } 285 | 286 | // We now have an array of all the nodes that we're going to possibly invoke. 287 | // Instead of using the prev/next pointers, we're going to simply enumerate this array. 288 | // This allows us to pass rule number one. 289 | // If a delegate is removed while we're enumerating, its delegate pointer will be set to nil. 290 | // This allows us to pass rule number two. 291 | 292 | for(i = 0; i < nodeCount; i++) 293 | { 294 | if([nodes[i]->delegate respondsToSelector:[anInvocation selector]]) 295 | { 296 | [anInvocation invokeWithTarget:nodes[i]->delegate]; 297 | } 298 | 299 | MulticastDelegateListNodeRelease(nodes[i]); 300 | } 301 | 302 | [pool release]; 303 | } 304 | 305 | - (void)doesNotRecognizeSelector:(SEL)aSelector 306 | { 307 | // Prevent NSInvalidArgumentException 308 | } 309 | 310 | - (void)doNothing {} 311 | 312 | - (void)dealloc 313 | { 314 | [self removeAllDelegates]; 315 | [super dealloc]; 316 | } 317 | 318 | @end 319 | 320 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 321 | #pragma mark - 322 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 323 | 324 | @implementation MulticastDelegateEnumerator 325 | 326 | - (id)initWithDelegateList:(MulticastDelegateListNode *)delegateList 327 | { 328 | if((self = [super init])) 329 | { 330 | numDelegates = 0; 331 | currentDelegateIndex = 0; 332 | 333 | // Here are the rules: 334 | // 1. If a delegate is added during this method, it should NOT be invoked. 335 | // 2. If a delegate is removed during this method that has not already been invoked, it should NOT be invoked. 336 | 337 | MulticastDelegateListNode *node = delegateList; 338 | 339 | // First we loop through the linked list so we can: 340 | // - Get a count of the number of delegates 341 | // - Get a reference to the last delegate in the list 342 | // 343 | // Recall that new delegates are added to the beginning of the linked list. 344 | // The last delegate in the list is the first delegate that was added, so it will be the first that's invoked. 345 | // We're going to be moving backwards through the linked list as we invoke the delegates. 346 | 347 | if(node != NULL) 348 | { 349 | numDelegates++; 350 | 351 | while(node->next != NULL) 352 | { 353 | numDelegates++; 354 | node = node->next; 355 | } 356 | 357 | // Note: The node variable is now pointing to the last node in the list. 358 | } 359 | 360 | // We're now going to create an array of all the nodes. 361 | // This gives us a quick and easy snapshot of the current list, 362 | // which will allow delegates to be added/removed from the list while we're enumerating it, 363 | // all without bothering us, and without violating any of the rules listed above. 364 | // 365 | // Note: We're creating an array of pointers. 366 | // Each pointer points to the dynamically allocated struct. 367 | // If we copied the struct, we might violate rule number two. 368 | // So we also retain each node, to prevent it from disappearing while we're enumerating the list. 369 | 370 | size_t ptrSize = sizeof(node); 371 | 372 | delegates = malloc(ptrSize * numDelegates); 373 | 374 | // Remember that delegates is a pointer to an array of pointers. 375 | // It's going to look something like this in memory: 376 | // 377 | // delegates ---> |ptr1|ptr2|ptr3|...| 378 | // 379 | // So delegates points to ptr1. 380 | // And due to pointer arithmetic, delegates+1 points to ptr2. 381 | 382 | NSUInteger i; 383 | for(i = 0; i < numDelegates; i++) 384 | { 385 | memcpy(delegates + i, &node, ptrSize); 386 | MulticastDelegateListNodeRetain(node); 387 | 388 | node = node->prev; 389 | } 390 | } 391 | return self; 392 | } 393 | 394 | - (id)nextDelegate 395 | { 396 | if(currentDelegateIndex < numDelegates) 397 | { 398 | MulticastDelegateListNode *node = *(delegates + currentDelegateIndex); 399 | 400 | currentDelegateIndex++; 401 | return node->delegate; 402 | } 403 | 404 | return nil; 405 | } 406 | 407 | - (id)nextDelegateForSelector:(SEL)selector 408 | { 409 | while(currentDelegateIndex < numDelegates) 410 | { 411 | MulticastDelegateListNode *node = *(delegates + currentDelegateIndex); 412 | 413 | if([node->delegate respondsToSelector:selector]) 414 | { 415 | currentDelegateIndex++; 416 | return node->delegate; 417 | } 418 | else 419 | { 420 | currentDelegateIndex++; 421 | } 422 | } 423 | 424 | return nil; 425 | } 426 | 427 | - (void)dealloc 428 | { 429 | NSUInteger i; 430 | for(i = 0; i < numDelegates; i++) 431 | { 432 | MulticastDelegateListNodeRetain(*(delegates + 1)); 433 | } 434 | 435 | free(delegates); 436 | 437 | [super dealloc]; 438 | } 439 | 440 | 441 | @end 442 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/Helpers/NSObject+Helpers.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Helpers.h 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 2/27/11. 6 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject(Helpers) 12 | 13 | - (BOOL) isNotKindOfClass:(Class)aClass; 14 | - (BOOL) isNotNilAndOfType:(Class)aClass; 15 | - (BOOL) isNilOrNotOfType:(Class)aClass; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/Helpers/NSObject+Helpers.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Helpers.m 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 2/27/11. 6 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import "NSObject+Helpers.h" 10 | 11 | @implementation NSObject(Helpers) 12 | 13 | - (BOOL) isNotKindOfClass:(Class)aClass 14 | { 15 | return ![self isKindOfClass:aClass]; 16 | } 17 | 18 | - (BOOL) isNotNilAndOfType:(Class)aClass 19 | { 20 | return (self != nil) && [self isKindOfClass:aClass]; 21 | } 22 | 23 | - (BOOL) isNilOrNotOfType:(Class)aClass 24 | { 25 | return (self == nil) || [self isNotKindOfClass:aClass]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/Helpers/NSString+Helpers.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Helpers.h 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 1/6/11. 6 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString(Helpers) 12 | - (BOOL) notEqualToString:(NSString *)string; 13 | - (BOOL) containsString:(NSString *)string; 14 | @end 15 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/Helpers/NSString+Helpers.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Helpers.m 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 1/6/11. 6 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import "NSString+Helpers.h" 10 | 11 | @implementation NSString(Helpers) 12 | 13 | - (BOOL) notEqualToString:(NSString *)string 14 | { 15 | return ![self isEqualToString:string]; 16 | } 17 | 18 | - (BOOL) containsString:(NSString *)string 19 | { 20 | if (string == nil) { 21 | return NO; 22 | } 23 | 24 | return ([self rangeOfString:string].location != NSNotFound); 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/Helpers/UIHelpers.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIHelpers.h 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 6/25/10. 6 | // Copyright 2010 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIHelpers: NSObject 12 | { 13 | } 14 | 15 | + (void) showAlertWithTitle:(NSString *)title; 16 | + (void) showAlertWithTitle:(NSString *)title msg:(NSString *)msg; 17 | + (void) showAlertWithTitle:(NSString *)title msg:(NSString *)msg buttonTitle:(NSString *)btnTitle; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/Helpers/UIHelpers.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIHelpers.m 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 6/25/10. 6 | // Copyright 2010 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import "UIHelpers.h" 10 | 11 | @implementation UIHelpers 12 | 13 | #pragma mark - 14 | #pragma mark UIAlertView Helper Methods 15 | 16 | + (void) showAlertWithTitle:(NSString *)title msg:(NSString *)msg buttonTitle:(NSString *)btnTitle 17 | { 18 | UIAlertView *av = [[UIAlertView alloc] initWithTitle:title 19 | message:msg 20 | delegate:nil 21 | cancelButtonTitle:btnTitle 22 | otherButtonTitles:nil]; 23 | [av show]; 24 | [av release]; 25 | } 26 | 27 | + (void) showAlertWithTitle:(NSString *)title 28 | { 29 | [UIHelpers showAlertWithTitle:title msg:nil buttonTitle:@"OK"]; 30 | } 31 | 32 | + (void) showAlertWithTitle:(NSString *)title msg:(NSString *)msg 33 | { 34 | [UIHelpers showAlertWithTitle:title msg:msg buttonTitle:@"OK"]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/JSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | @mainpage A strict JSON parser and generator for Objective-C 32 | 33 | JSON (JavaScript Object Notation) is a lightweight data-interchange 34 | format. This framework provides two apis for parsing and generating 35 | JSON. One standard object-based and a higher level api consisting of 36 | categories added to existing Objective-C classes. 37 | 38 | Learn more on the http://code.google.com/p/json-framework project site. 39 | 40 | This framework does its best to be as strict as possible, both in what it 41 | accepts and what it generates. For example, it does not support trailing commas 42 | in arrays or objects. Nor does it support embedded comments, or 43 | anything else not in the JSON specification. This is considered a feature. 44 | 45 | */ 46 | 47 | #import "SBJSON.h" 48 | #import "NSObject+SBJSON.h" 49 | #import "NSString+SBJSON.h" 50 | 51 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/NSObject+SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | 33 | /** 34 | @brief Adds JSON generation to Foundation classes 35 | 36 | This is a category on NSObject that adds methods for returning JSON representations 37 | of standard objects to the objects themselves. This means you can call the 38 | -JSONRepresentation method on an NSArray object and it'll do what you want. 39 | */ 40 | @interface NSObject (NSObject_SBJSON) 41 | 42 | /** 43 | @brief Returns a string containing the receiver encoded as a JSON fragment. 44 | 45 | This method is added as a category on NSObject but is only actually 46 | supported for the following objects: 47 | @li NSDictionary 48 | @li NSArray 49 | @li NSString 50 | @li NSNumber (also used for booleans) 51 | @li NSNull 52 | 53 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 54 | */ 55 | - (NSString *)JSONFragment; 56 | 57 | /** 58 | @brief Returns a string containing the receiver encoded in JSON. 59 | 60 | This method is added as a category on NSObject but is only actually 61 | supported for the following objects: 62 | @li NSDictionary 63 | @li NSArray 64 | */ 65 | - (NSString *)JSONRepresentation; 66 | 67 | @end 68 | 69 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/NSObject+SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "NSObject+SBJSON.h" 31 | #import "SBJsonWriter.h" 32 | 33 | @implementation NSObject (NSObject_SBJSON) 34 | 35 | - (NSString *)JSONFragment { 36 | SBJsonWriter *jsonWriter = [SBJsonWriter new]; 37 | NSString *json = [jsonWriter stringWithFragment:self]; 38 | if (!json) 39 | NSLog(@"-JSONFragment failed. Error trace is: %@", [jsonWriter errorTrace]); 40 | [jsonWriter release]; 41 | return json; 42 | } 43 | 44 | - (NSString *)JSONRepresentation { 45 | SBJsonWriter *jsonWriter = [SBJsonWriter new]; 46 | NSString *json = [jsonWriter stringWithObject:self]; 47 | if (!json) 48 | NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]); 49 | [jsonWriter release]; 50 | return json; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/NSString+SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | /** 33 | @brief Adds JSON parsing methods to NSString 34 | 35 | This is a category on NSString that adds methods for parsing the target string. 36 | */ 37 | @interface NSString (NSString_SBJSON) 38 | 39 | 40 | /** 41 | @brief Returns the object represented in the receiver, or nil on error. 42 | 43 | Returns a a scalar object represented by the string's JSON fragment representation. 44 | 45 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 46 | */ 47 | - (id)JSONFragmentValue; 48 | 49 | /** 50 | @brief Returns the NSDictionary or NSArray represented by the current string's JSON representation. 51 | 52 | Returns the dictionary or array represented in the receiver, or nil on error. 53 | 54 | Returns the NSDictionary or NSArray represented by the current string's JSON representation. 55 | */ 56 | - (id)JSONValue; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/NSString+SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "NSString+SBJSON.h" 31 | #import "SBJsonParser.h" 32 | 33 | @implementation NSString (NSString_SBJSON) 34 | 35 | - (id)JSONFragmentValue 36 | { 37 | SBJsonParser *jsonParser = [SBJsonParser new]; 38 | id repr = [jsonParser fragmentWithString:self]; 39 | if (!repr) 40 | NSLog(@"-JSONFragmentValue failed. Error trace is: %@", [jsonParser errorTrace]); 41 | [jsonParser release]; 42 | return repr; 43 | } 44 | 45 | - (id)JSONValue 46 | { 47 | SBJsonParser *jsonParser = [SBJsonParser new]; 48 | id repr = [jsonParser objectWithString:self]; 49 | if (!repr) 50 | NSLog(@"-JSONValue failed. Error trace is: %@", [jsonParser errorTrace]); 51 | [jsonParser release]; 52 | return repr; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | #import "SBJsonParser.h" 32 | #import "SBJsonWriter.h" 33 | 34 | /** 35 | @brief Facade for SBJsonWriter/SBJsonParser. 36 | 37 | Requests are forwarded to instances of SBJsonWriter and SBJsonParser. 38 | */ 39 | @interface SBJSON : SBJsonBase { 40 | 41 | @private 42 | SBJsonParser *jsonParser; 43 | SBJsonWriter *jsonWriter; 44 | } 45 | 46 | 47 | /// Return the fragment represented by the given string 48 | - (id)fragmentWithString:(NSString*)jsonrep 49 | error:(NSError**)error; 50 | 51 | /// Return the object represented by the given string 52 | - (id)objectWithString:(NSString*)jsonrep 53 | error:(NSError**)error; 54 | 55 | /// Parse the string and return the represented object (or scalar) 56 | - (id)objectWithString:(id)value 57 | allowScalar:(BOOL)x 58 | error:(NSError**)error; 59 | 60 | 61 | /// Return JSON representation of an array or dictionary 62 | - (NSString*)stringWithObject:(id)value 63 | error:(NSError**)error; 64 | 65 | /// Return JSON representation of any legal JSON value 66 | - (NSString*)stringWithFragment:(id)value 67 | error:(NSError**)error; 68 | 69 | /// Return JSON representation (or fragment) for the given object 70 | - (NSString*)stringWithObject:(id)value 71 | allowScalar:(BOOL)x 72 | error:(NSError**)error; 73 | 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "SBJSON.h" 31 | 32 | @implementation SBJSON 33 | 34 | - (id)init { 35 | self = [super init]; 36 | if (self) { 37 | jsonWriter = [SBJsonWriter new]; 38 | jsonParser = [SBJsonParser new]; 39 | [self setMaxDepth:512]; 40 | 41 | } 42 | return self; 43 | } 44 | 45 | - (void)dealloc { 46 | [jsonWriter release]; 47 | [jsonParser release]; 48 | [super dealloc]; 49 | } 50 | 51 | #pragma mark Writer 52 | 53 | 54 | - (NSString *)stringWithObject:(id)obj { 55 | NSString *repr = [jsonWriter stringWithObject:obj]; 56 | if (repr) 57 | return repr; 58 | 59 | [errorTrace release]; 60 | errorTrace = [[jsonWriter errorTrace] mutableCopy]; 61 | return nil; 62 | } 63 | 64 | /** 65 | Returns a string containing JSON representation of the passed in value, or nil on error. 66 | If nil is returned and @p error is not NULL, @p *error can be interrogated to find the cause of the error. 67 | 68 | @param value any instance that can be represented as a JSON fragment 69 | @param allowScalar wether to return json fragments for scalar objects 70 | @param error used to return an error by reference (pass NULL if this is not desired) 71 | 72 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 73 | */ 74 | - (NSString*)stringWithObject:(id)value allowScalar:(BOOL)allowScalar error:(NSError**)error { 75 | 76 | NSString *json = allowScalar ? [jsonWriter stringWithFragment:value] : [jsonWriter stringWithObject:value]; 77 | if (json) 78 | return json; 79 | 80 | [errorTrace release]; 81 | errorTrace = [[jsonWriter errorTrace] mutableCopy]; 82 | 83 | if (error) 84 | *error = [errorTrace lastObject]; 85 | return nil; 86 | } 87 | 88 | /** 89 | Returns a string containing JSON representation of the passed in value, or nil on error. 90 | If nil is returned and @p error is not NULL, @p error can be interrogated to find the cause of the error. 91 | 92 | @param value any instance that can be represented as a JSON fragment 93 | @param error used to return an error by reference (pass NULL if this is not desired) 94 | 95 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 96 | */ 97 | - (NSString*)stringWithFragment:(id)value error:(NSError**)error { 98 | return [self stringWithObject:value 99 | allowScalar:YES 100 | error:error]; 101 | } 102 | 103 | /** 104 | Returns a string containing JSON representation of the passed in value, or nil on error. 105 | If nil is returned and @p error is not NULL, @p error can be interrogated to find the cause of the error. 106 | 107 | @param value a NSDictionary or NSArray instance 108 | @param error used to return an error by reference (pass NULL if this is not desired) 109 | */ 110 | - (NSString*)stringWithObject:(id)value error:(NSError**)error { 111 | return [self stringWithObject:value 112 | allowScalar:NO 113 | error:error]; 114 | } 115 | 116 | #pragma mark Parsing 117 | 118 | - (id)objectWithString:(NSString *)repr { 119 | id obj = [jsonParser objectWithString:repr]; 120 | if (obj) 121 | return obj; 122 | 123 | [errorTrace release]; 124 | errorTrace = [[jsonParser errorTrace] mutableCopy]; 125 | 126 | return nil; 127 | } 128 | 129 | /** 130 | Returns the object represented by the passed-in string or nil on error. The returned object can be 131 | a string, number, boolean, null, array or dictionary. 132 | 133 | @param value the json string to parse 134 | @param allowScalar whether to return objects for JSON fragments 135 | @param error used to return an error by reference (pass NULL if this is not desired) 136 | 137 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 138 | */ 139 | - (id)objectWithString:(id)value allowScalar:(BOOL)allowScalar error:(NSError**)error { 140 | 141 | id obj = allowScalar ? [jsonParser fragmentWithString:value] : [jsonParser objectWithString:value]; 142 | if (obj) 143 | return obj; 144 | 145 | [errorTrace release]; 146 | errorTrace = [[jsonParser errorTrace] mutableCopy]; 147 | 148 | if (error) 149 | *error = [errorTrace lastObject]; 150 | return nil; 151 | } 152 | 153 | /** 154 | Returns the object represented by the passed-in string or nil on error. The returned object can be 155 | a string, number, boolean, null, array or dictionary. 156 | 157 | @param repr the json string to parse 158 | @param error used to return an error by reference (pass NULL if this is not desired) 159 | 160 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 161 | */ 162 | - (id)fragmentWithString:(NSString*)repr error:(NSError**)error { 163 | return [self objectWithString:repr 164 | allowScalar:YES 165 | error:error]; 166 | } 167 | 168 | /** 169 | Returns the object represented by the passed-in string or nil on error. The returned object 170 | will be either a dictionary or an array. 171 | 172 | @param repr the json string to parse 173 | @param error used to return an error by reference (pass NULL if this is not desired) 174 | */ 175 | - (id)objectWithString:(NSString*)repr error:(NSError**)error { 176 | return [self objectWithString:repr 177 | allowScalar:NO 178 | error:error]; 179 | } 180 | 181 | 182 | 183 | #pragma mark Properties - parsing 184 | 185 | - (NSUInteger)maxDepth { 186 | return jsonParser.maxDepth; 187 | } 188 | 189 | - (void)setMaxDepth:(NSUInteger)d { 190 | jsonWriter.maxDepth = jsonParser.maxDepth = d; 191 | } 192 | 193 | 194 | #pragma mark Properties - writing 195 | 196 | - (BOOL)humanReadable { 197 | return jsonWriter.humanReadable; 198 | } 199 | 200 | - (void)setHumanReadable:(BOOL)x { 201 | jsonWriter.humanReadable = x; 202 | } 203 | 204 | - (BOOL)sortKeys { 205 | return jsonWriter.sortKeys; 206 | } 207 | 208 | - (void)setSortKeys:(BOOL)x { 209 | jsonWriter.sortKeys = x; 210 | } 211 | 212 | @end 213 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/SBJsonBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | extern NSString * SBJSONErrorDomain; 33 | 34 | 35 | enum { 36 | EUNSUPPORTED = 1, 37 | EPARSENUM, 38 | EPARSE, 39 | EFRAGMENT, 40 | ECTRL, 41 | EUNICODE, 42 | EDEPTH, 43 | EESCAPE, 44 | ETRAILCOMMA, 45 | ETRAILGARBAGE, 46 | EEOF, 47 | EINPUT 48 | }; 49 | 50 | /** 51 | @brief Common base class for parsing & writing. 52 | 53 | This class contains the common error-handling code and option between the parser/writer. 54 | */ 55 | @interface SBJsonBase : NSObject { 56 | NSMutableArray *errorTrace; 57 | 58 | @protected 59 | NSUInteger depth, maxDepth; 60 | } 61 | 62 | /** 63 | @brief The maximum recursing depth. 64 | 65 | Defaults to 512. If the input is nested deeper than this the input will be deemed to be 66 | malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can 67 | turn off this security feature by setting the maxDepth value to 0. 68 | */ 69 | @property NSUInteger maxDepth; 70 | 71 | /** 72 | @brief Return an error trace, or nil if there was no errors. 73 | 74 | Note that this method returns the trace of the last method that failed. 75 | You need to check the return value of the call you're making to figure out 76 | if the call actually failed, before you know call this method. 77 | */ 78 | @property(copy,readonly) NSArray* errorTrace; 79 | 80 | /// @internal for use in subclasses to add errors to the stack trace 81 | - (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str; 82 | 83 | /// @internal for use in subclasess to clear the error before a new parsing attempt 84 | - (void)clearErrorTrace; 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/SBJsonBase.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "SBJsonBase.h" 31 | NSString * SBJSONErrorDomain = @"org.brautaset.JSON.ErrorDomain"; 32 | 33 | 34 | @implementation SBJsonBase 35 | 36 | @synthesize errorTrace; 37 | @synthesize maxDepth; 38 | 39 | - (id)init { 40 | self = [super init]; 41 | if (self) 42 | self.maxDepth = 512; 43 | return self; 44 | } 45 | 46 | - (void)dealloc { 47 | [errorTrace release]; 48 | [super dealloc]; 49 | } 50 | 51 | - (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str { 52 | NSDictionary *userInfo; 53 | if (!errorTrace) { 54 | errorTrace = [NSMutableArray new]; 55 | userInfo = [NSDictionary dictionaryWithObject:str forKey:NSLocalizedDescriptionKey]; 56 | 57 | } else { 58 | userInfo = [NSDictionary dictionaryWithObjectsAndKeys: 59 | str, NSLocalizedDescriptionKey, 60 | [errorTrace lastObject], NSUnderlyingErrorKey, 61 | nil]; 62 | } 63 | 64 | NSError *error = [NSError errorWithDomain:SBJSONErrorDomain code:code userInfo:userInfo]; 65 | 66 | [self willChangeValueForKey:@"errorTrace"]; 67 | [errorTrace addObject:error]; 68 | [self didChangeValueForKey:@"errorTrace"]; 69 | } 70 | 71 | - (void)clearErrorTrace { 72 | [self willChangeValueForKey:@"errorTrace"]; 73 | [errorTrace release]; 74 | errorTrace = nil; 75 | [self didChangeValueForKey:@"errorTrace"]; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/SBJsonParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | #import "SBJsonBase.h" 32 | 33 | /** 34 | @brief Options for the parser class. 35 | 36 | This exists so the SBJSON facade can implement the options in the parser without having to re-declare them. 37 | */ 38 | @protocol SBJsonParser 39 | 40 | /** 41 | @brief Return the object represented by the given string. 42 | 43 | Returns the object represented by the passed-in string or nil on error. The returned object can be 44 | a string, number, boolean, null, array or dictionary. 45 | 46 | @param repr the json string to parse 47 | */ 48 | - (id)objectWithString:(NSString *)repr; 49 | 50 | @end 51 | 52 | 53 | /** 54 | @brief The JSON parser class. 55 | 56 | JSON is mapped to Objective-C types in the following way: 57 | 58 | @li Null -> NSNull 59 | @li String -> NSMutableString 60 | @li Array -> NSMutableArray 61 | @li Object -> NSMutableDictionary 62 | @li Boolean -> NSNumber (initialised with -initWithBool:) 63 | @li Number -> NSDecimalNumber 64 | 65 | Since Objective-C doesn't have a dedicated class for boolean values, these turns into NSNumber 66 | instances. These are initialised with the -initWithBool: method, and 67 | round-trip back to JSON properly. (They won't silently suddenly become 0 or 1; they'll be 68 | represented as 'true' and 'false' again.) 69 | 70 | JSON numbers turn into NSDecimalNumber instances, 71 | as we can thus avoid any loss of precision. (JSON allows ridiculously large numbers.) 72 | 73 | */ 74 | @interface SBJsonParser : SBJsonBase { 75 | 76 | @private 77 | const char *c; 78 | } 79 | 80 | @end 81 | 82 | // don't use - exists for backwards compatibility with 2.1.x only. Will be removed in 2.3. 83 | @interface SBJsonParser (Private) 84 | - (id)fragmentWithString:(id)repr; 85 | @end 86 | 87 | 88 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/SBJsonParser.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "SBJsonParser.h" 31 | 32 | @interface SBJsonParser () 33 | 34 | - (BOOL)scanValue:(NSObject **)o; 35 | 36 | - (BOOL)scanRestOfArray:(NSMutableArray **)o; 37 | - (BOOL)scanRestOfDictionary:(NSMutableDictionary **)o; 38 | - (BOOL)scanRestOfNull:(NSNull **)o; 39 | - (BOOL)scanRestOfFalse:(NSNumber **)o; 40 | - (BOOL)scanRestOfTrue:(NSNumber **)o; 41 | - (BOOL)scanRestOfString:(NSMutableString **)o; 42 | 43 | // Cannot manage without looking at the first digit 44 | - (BOOL)scanNumber:(NSNumber **)o; 45 | 46 | - (BOOL)scanHexQuad:(unichar *)x; 47 | - (BOOL)scanUnicodeChar:(unichar *)x; 48 | 49 | - (BOOL)scanIsAtEnd; 50 | 51 | @end 52 | 53 | #define skipWhitespace(c) while (isspace(*c)) c++ 54 | #define skipDigits(c) while (isdigit(*c)) c++ 55 | 56 | 57 | @implementation SBJsonParser 58 | 59 | static char ctrl[0x22]; 60 | 61 | 62 | + (void)initialize { 63 | ctrl[0] = '\"'; 64 | ctrl[1] = '\\'; 65 | for (int i = 1; i < 0x20; i++) 66 | ctrl[i+1] = i; 67 | ctrl[0x21] = 0; 68 | } 69 | 70 | /** 71 | @deprecated This exists in order to provide fragment support in older APIs in one more version. 72 | It should be removed in the next major version. 73 | */ 74 | - (id)fragmentWithString:(id)repr { 75 | [self clearErrorTrace]; 76 | 77 | if (!repr) { 78 | [self addErrorWithCode:EINPUT description:@"Input was 'nil'"]; 79 | return nil; 80 | } 81 | 82 | depth = 0; 83 | c = [repr UTF8String]; 84 | 85 | id o; 86 | if (![self scanValue:&o]) { 87 | return nil; 88 | } 89 | 90 | // We found some valid JSON. But did it also contain something else? 91 | if (![self scanIsAtEnd]) { 92 | [self addErrorWithCode:ETRAILGARBAGE description:@"Garbage after JSON"]; 93 | return nil; 94 | } 95 | 96 | NSAssert1(o, @"Should have a valid object from %@", repr); 97 | return o; 98 | } 99 | 100 | - (id)objectWithString:(NSString *)repr { 101 | 102 | id o = [self fragmentWithString:repr]; 103 | if (!o) 104 | return nil; 105 | 106 | // Check that the object we've found is a valid JSON container. 107 | if (![o isKindOfClass:[NSDictionary class]] && ![o isKindOfClass:[NSArray class]]) { 108 | [self addErrorWithCode:EFRAGMENT description:@"Valid fragment, but not JSON"]; 109 | return nil; 110 | } 111 | 112 | return o; 113 | } 114 | 115 | /* 116 | In contrast to the public methods, it is an error to omit the error parameter here. 117 | */ 118 | - (BOOL)scanValue:(NSObject **)o 119 | { 120 | skipWhitespace(c); 121 | 122 | switch (*c++) { 123 | case '{': 124 | return [self scanRestOfDictionary:(NSMutableDictionary **)o]; 125 | break; 126 | case '[': 127 | return [self scanRestOfArray:(NSMutableArray **)o]; 128 | break; 129 | case '"': 130 | return [self scanRestOfString:(NSMutableString **)o]; 131 | break; 132 | case 'f': 133 | return [self scanRestOfFalse:(NSNumber **)o]; 134 | break; 135 | case 't': 136 | return [self scanRestOfTrue:(NSNumber **)o]; 137 | break; 138 | case 'n': 139 | return [self scanRestOfNull:(NSNull **)o]; 140 | break; 141 | case '-': 142 | case '0'...'9': 143 | c--; // cannot verify number correctly without the first character 144 | return [self scanNumber:(NSNumber **)o]; 145 | break; 146 | case '+': 147 | [self addErrorWithCode:EPARSENUM description: @"Leading + disallowed in number"]; 148 | return NO; 149 | break; 150 | case 0x0: 151 | [self addErrorWithCode:EEOF description:@"Unexpected end of string"]; 152 | return NO; 153 | break; 154 | default: 155 | [self addErrorWithCode:EPARSE description: @"Unrecognised leading character"]; 156 | return NO; 157 | break; 158 | } 159 | 160 | NSAssert(0, @"Should never get here"); 161 | return NO; 162 | } 163 | 164 | - (BOOL)scanRestOfTrue:(NSNumber **)o 165 | { 166 | if (!strncmp(c, "rue", 3)) { 167 | c += 3; 168 | *o = [NSNumber numberWithBool:YES]; 169 | return YES; 170 | } 171 | [self addErrorWithCode:EPARSE description:@"Expected 'true'"]; 172 | return NO; 173 | } 174 | 175 | - (BOOL)scanRestOfFalse:(NSNumber **)o 176 | { 177 | if (!strncmp(c, "alse", 4)) { 178 | c += 4; 179 | *o = [NSNumber numberWithBool:NO]; 180 | return YES; 181 | } 182 | [self addErrorWithCode:EPARSE description: @"Expected 'false'"]; 183 | return NO; 184 | } 185 | 186 | - (BOOL)scanRestOfNull:(NSNull **)o { 187 | if (!strncmp(c, "ull", 3)) { 188 | c += 3; 189 | *o = [NSNull null]; 190 | return YES; 191 | } 192 | [self addErrorWithCode:EPARSE description: @"Expected 'null'"]; 193 | return NO; 194 | } 195 | 196 | - (BOOL)scanRestOfArray:(NSMutableArray **)o { 197 | if (maxDepth && ++depth > maxDepth) { 198 | [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; 199 | return NO; 200 | } 201 | 202 | *o = [NSMutableArray arrayWithCapacity:8]; 203 | 204 | for (; *c ;) { 205 | id v; 206 | 207 | skipWhitespace(c); 208 | if (*c == ']' && c++) { 209 | depth--; 210 | return YES; 211 | } 212 | 213 | if (![self scanValue:&v]) { 214 | [self addErrorWithCode:EPARSE description:@"Expected value while parsing array"]; 215 | return NO; 216 | } 217 | 218 | [*o addObject:v]; 219 | 220 | skipWhitespace(c); 221 | if (*c == ',' && c++) { 222 | skipWhitespace(c); 223 | if (*c == ']') { 224 | [self addErrorWithCode:ETRAILCOMMA description: @"Trailing comma disallowed in array"]; 225 | return NO; 226 | } 227 | } 228 | } 229 | 230 | [self addErrorWithCode:EEOF description: @"End of input while parsing array"]; 231 | return NO; 232 | } 233 | 234 | - (BOOL)scanRestOfDictionary:(NSMutableDictionary **)o 235 | { 236 | if (maxDepth && ++depth > maxDepth) { 237 | [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; 238 | return NO; 239 | } 240 | 241 | *o = [NSMutableDictionary dictionaryWithCapacity:7]; 242 | 243 | for (; *c ;) { 244 | id k, v; 245 | 246 | skipWhitespace(c); 247 | if (*c == '}' && c++) { 248 | depth--; 249 | return YES; 250 | } 251 | 252 | if (!(*c == '\"' && c++ && [self scanRestOfString:&k])) { 253 | [self addErrorWithCode:EPARSE description: @"Object key string expected"]; 254 | return NO; 255 | } 256 | 257 | skipWhitespace(c); 258 | if (*c != ':') { 259 | [self addErrorWithCode:EPARSE description: @"Expected ':' separating key and value"]; 260 | return NO; 261 | } 262 | 263 | c++; 264 | if (![self scanValue:&v]) { 265 | NSString *string = [NSString stringWithFormat:@"Object value expected for key: %@", k]; 266 | [self addErrorWithCode:EPARSE description: string]; 267 | return NO; 268 | } 269 | 270 | [*o setObject:v forKey:k]; 271 | 272 | skipWhitespace(c); 273 | if (*c == ',' && c++) { 274 | skipWhitespace(c); 275 | if (*c == '}') { 276 | [self addErrorWithCode:ETRAILCOMMA description: @"Trailing comma disallowed in object"]; 277 | return NO; 278 | } 279 | } 280 | } 281 | 282 | [self addErrorWithCode:EEOF description: @"End of input while parsing object"]; 283 | return NO; 284 | } 285 | 286 | - (BOOL)scanRestOfString:(NSMutableString **)o 287 | { 288 | *o = [NSMutableString stringWithCapacity:16]; 289 | do { 290 | // First see if there's a portion we can grab in one go. 291 | // Doing this caused a massive speedup on the long string. 292 | size_t len = strcspn(c, ctrl); 293 | if (len) { 294 | // check for 295 | id t = [[NSString alloc] initWithBytesNoCopy:(char*)c 296 | length:len 297 | encoding:NSUTF8StringEncoding 298 | freeWhenDone:NO]; 299 | if (t) { 300 | [*o appendString:t]; 301 | [t release]; 302 | c += len; 303 | } 304 | } 305 | 306 | if (*c == '"') { 307 | c++; 308 | return YES; 309 | 310 | } else if (*c == '\\') { 311 | unichar uc = *++c; 312 | switch (uc) { 313 | case '\\': 314 | case '/': 315 | case '"': 316 | break; 317 | 318 | case 'b': uc = '\b'; break; 319 | case 'n': uc = '\n'; break; 320 | case 'r': uc = '\r'; break; 321 | case 't': uc = '\t'; break; 322 | case 'f': uc = '\f'; break; 323 | 324 | case 'u': 325 | c++; 326 | if (![self scanUnicodeChar:&uc]) { 327 | [self addErrorWithCode:EUNICODE description: @"Broken unicode character"]; 328 | return NO; 329 | } 330 | c--; // hack. 331 | break; 332 | default: 333 | [self addErrorWithCode:EESCAPE description: [NSString stringWithFormat:@"Illegal escape sequence '0x%x'", uc]]; 334 | return NO; 335 | break; 336 | } 337 | CFStringAppendCharacters((CFMutableStringRef)*o, &uc, 1); 338 | c++; 339 | 340 | } else if (*c < 0x20) { 341 | [self addErrorWithCode:ECTRL description: [NSString stringWithFormat:@"Unescaped control character '0x%x'", *c]]; 342 | return NO; 343 | 344 | } else { 345 | NSLog(@"should not be able to get here"); 346 | } 347 | } while (*c); 348 | 349 | [self addErrorWithCode:EEOF description:@"Unexpected EOF while parsing string"]; 350 | return NO; 351 | } 352 | 353 | - (BOOL)scanUnicodeChar:(unichar *)x 354 | { 355 | unichar hi, lo; 356 | 357 | if (![self scanHexQuad:&hi]) { 358 | [self addErrorWithCode:EUNICODE description: @"Missing hex quad"]; 359 | return NO; 360 | } 361 | 362 | if (hi >= 0xd800) { // high surrogate char? 363 | if (hi < 0xdc00) { // yes - expect a low char 364 | 365 | if (!(*c == '\\' && ++c && *c == 'u' && ++c && [self scanHexQuad:&lo])) { 366 | [self addErrorWithCode:EUNICODE description: @"Missing low character in surrogate pair"]; 367 | return NO; 368 | } 369 | 370 | if (lo < 0xdc00 || lo >= 0xdfff) { 371 | [self addErrorWithCode:EUNICODE description:@"Invalid low surrogate char"]; 372 | return NO; 373 | } 374 | 375 | hi = (hi - 0xd800) * 0x400 + (lo - 0xdc00) + 0x10000; 376 | 377 | } else if (hi < 0xe000) { 378 | [self addErrorWithCode:EUNICODE description:@"Invalid high character in surrogate pair"]; 379 | return NO; 380 | } 381 | } 382 | 383 | *x = hi; 384 | return YES; 385 | } 386 | 387 | - (BOOL)scanHexQuad:(unichar *)x 388 | { 389 | *x = 0; 390 | for (int i = 0; i < 4; i++) { 391 | unichar uc = *c; 392 | c++; 393 | int d = (uc >= '0' && uc <= '9') 394 | ? uc - '0' : (uc >= 'a' && uc <= 'f') 395 | ? (uc - 'a' + 10) : (uc >= 'A' && uc <= 'F') 396 | ? (uc - 'A' + 10) : -1; 397 | if (d == -1) { 398 | [self addErrorWithCode:EUNICODE description:@"Missing hex digit in quad"]; 399 | return NO; 400 | } 401 | *x *= 16; 402 | *x += d; 403 | } 404 | return YES; 405 | } 406 | 407 | - (BOOL)scanNumber:(NSNumber **)o 408 | { 409 | const char *ns = c; 410 | 411 | // The logic to test for validity of the number formatting is relicensed 412 | // from JSON::XS with permission from its author Marc Lehmann. 413 | // (Available at the CPAN: http://search.cpan.org/dist/JSON-XS/ .) 414 | 415 | if ('-' == *c) 416 | c++; 417 | 418 | if ('0' == *c && c++) { 419 | if (isdigit(*c)) { 420 | [self addErrorWithCode:EPARSENUM description: @"Leading 0 disallowed in number"]; 421 | return NO; 422 | } 423 | 424 | } else if (!isdigit(*c) && c != ns) { 425 | [self addErrorWithCode:EPARSENUM description: @"No digits after initial minus"]; 426 | return NO; 427 | 428 | } else { 429 | skipDigits(c); 430 | } 431 | 432 | // Fractional part 433 | if ('.' == *c && c++) { 434 | 435 | if (!isdigit(*c)) { 436 | [self addErrorWithCode:EPARSENUM description: @"No digits after decimal point"]; 437 | return NO; 438 | } 439 | skipDigits(c); 440 | } 441 | 442 | // Exponential part 443 | if ('e' == *c || 'E' == *c) { 444 | c++; 445 | 446 | if ('-' == *c || '+' == *c) 447 | c++; 448 | 449 | if (!isdigit(*c)) { 450 | [self addErrorWithCode:EPARSENUM description: @"No digits after exponent"]; 451 | return NO; 452 | } 453 | skipDigits(c); 454 | } 455 | 456 | id str = [[NSString alloc] initWithBytesNoCopy:(char*)ns 457 | length:c - ns 458 | encoding:NSUTF8StringEncoding 459 | freeWhenDone:NO]; 460 | [str autorelease]; 461 | if (str && (*o = [NSDecimalNumber decimalNumberWithString:str])) 462 | return YES; 463 | 464 | [self addErrorWithCode:EPARSENUM description: @"Failed creating decimal instance"]; 465 | return NO; 466 | } 467 | 468 | - (BOOL)scanIsAtEnd 469 | { 470 | skipWhitespace(c); 471 | return !*c; 472 | } 473 | 474 | 475 | @end 476 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/SBJsonWriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | #import "SBJsonBase.h" 32 | 33 | /** 34 | @brief Options for the writer class. 35 | 36 | This exists so the SBJSON facade can implement the options in the writer without having to re-declare them. 37 | */ 38 | @protocol SBJsonWriter 39 | 40 | /** 41 | @brief Whether we are generating human-readable (multiline) JSON. 42 | 43 | Set whether or not to generate human-readable JSON. The default is NO, which produces 44 | JSON without any whitespace. (Except inside strings.) If set to YES, generates human-readable 45 | JSON with linebreaks after each array value and dictionary key/value pair, indented two 46 | spaces per nesting level. 47 | */ 48 | @property BOOL humanReadable; 49 | 50 | /** 51 | @brief Whether or not to sort the dictionary keys in the output. 52 | 53 | If this is set to YES, the dictionary keys in the JSON output will be in sorted order. 54 | (This is useful if you need to compare two structures, for example.) The default is NO. 55 | */ 56 | @property BOOL sortKeys; 57 | 58 | /** 59 | @brief Return JSON representation (or fragment) for the given object. 60 | 61 | Returns a string containing JSON representation of the passed in value, or nil on error. 62 | If nil is returned and @p error is not NULL, @p *error can be interrogated to find the cause of the error. 63 | 64 | @param value any instance that can be represented as a JSON fragment 65 | 66 | */ 67 | - (NSString*)stringWithObject:(id)value; 68 | 69 | @end 70 | 71 | 72 | /** 73 | @brief The JSON writer class. 74 | 75 | Objective-C types are mapped to JSON types in the following way: 76 | 77 | @li NSNull -> Null 78 | @li NSString -> String 79 | @li NSArray -> Array 80 | @li NSDictionary -> Object 81 | @li NSNumber (-initWithBool:) -> Boolean 82 | @li NSNumber -> Number 83 | 84 | In JSON the keys of an object must be strings. NSDictionary keys need 85 | not be, but attempting to convert an NSDictionary with non-string keys 86 | into JSON will throw an exception. 87 | 88 | NSNumber instances created with the +initWithBool: method are 89 | converted into the JSON boolean "true" and "false" values, and vice 90 | versa. Any other NSNumber instances are converted to a JSON number the 91 | way you would expect. 92 | 93 | */ 94 | @interface SBJsonWriter : SBJsonBase { 95 | 96 | @private 97 | BOOL sortKeys, humanReadable; 98 | } 99 | 100 | @end 101 | 102 | // don't use - exists for backwards compatibility. Will be removed in 2.3. 103 | @interface SBJsonWriter (Private) 104 | - (NSString*)stringWithFragment:(id)value; 105 | @end 106 | 107 | /** 108 | @brief Allows generation of JSON for otherwise unsupported classes. 109 | 110 | If you have a custom class that you want to create a JSON representation for you can implement 111 | this method in your class. It should return a representation of your object defined 112 | in terms of objects that can be translated into JSON. For example, a Person 113 | object might implement it like this: 114 | 115 | @code 116 | - (id)jsonProxyObject { 117 | return [NSDictionary dictionaryWithObjectsAndKeys: 118 | name, @"name", 119 | phone, @"phone", 120 | email, @"email", 121 | nil]; 122 | } 123 | @endcode 124 | 125 | */ 126 | @interface NSObject (SBProxyForJson) 127 | - (id)proxyForJson; 128 | @end 129 | 130 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SBJSON/SBJsonWriter.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "SBJsonWriter.h" 31 | 32 | @interface SBJsonWriter () 33 | 34 | - (BOOL)appendValue:(id)fragment into:(NSMutableString*)json; 35 | - (BOOL)appendArray:(NSArray*)fragment into:(NSMutableString*)json; 36 | - (BOOL)appendDictionary:(NSDictionary*)fragment into:(NSMutableString*)json; 37 | - (BOOL)appendString:(NSString*)fragment into:(NSMutableString*)json; 38 | 39 | - (NSString*)indent; 40 | 41 | @end 42 | 43 | @implementation SBJsonWriter 44 | 45 | static NSMutableCharacterSet *kEscapeChars; 46 | 47 | + (void)initialize { 48 | kEscapeChars = [[NSMutableCharacterSet characterSetWithRange: NSMakeRange(0,32)] retain]; 49 | [kEscapeChars addCharactersInString: @"\"\\"]; 50 | } 51 | 52 | 53 | @synthesize sortKeys; 54 | @synthesize humanReadable; 55 | 56 | /** 57 | @deprecated This exists in order to provide fragment support in older APIs in one more version. 58 | It should be removed in the next major version. 59 | */ 60 | - (NSString*)stringWithFragment:(id)value { 61 | [self clearErrorTrace]; 62 | depth = 0; 63 | NSMutableString *json = [NSMutableString stringWithCapacity:128]; 64 | 65 | if ([self appendValue:value into:json]) 66 | return json; 67 | 68 | return nil; 69 | } 70 | 71 | 72 | - (NSString*)stringWithObject:(id)value { 73 | 74 | if ([value isKindOfClass:[NSDictionary class]] || [value isKindOfClass:[NSArray class]]) { 75 | return [self stringWithFragment:value]; 76 | } 77 | 78 | if ([value respondsToSelector:@selector(proxyForJson)]) { 79 | NSString *tmp = [self stringWithObject:[value proxyForJson]]; 80 | if (tmp) 81 | return tmp; 82 | } 83 | 84 | 85 | [self clearErrorTrace]; 86 | [self addErrorWithCode:EFRAGMENT description:@"Not valid type for JSON"]; 87 | return nil; 88 | } 89 | 90 | 91 | - (NSString*)indent { 92 | return [@"\n" stringByPaddingToLength:1 + 2 * depth withString:@" " startingAtIndex:0]; 93 | } 94 | 95 | - (BOOL)appendValue:(id)fragment into:(NSMutableString*)json { 96 | if ([fragment isKindOfClass:[NSDictionary class]]) { 97 | if (![self appendDictionary:fragment into:json]) 98 | return NO; 99 | 100 | } else if ([fragment isKindOfClass:[NSArray class]]) { 101 | if (![self appendArray:fragment into:json]) 102 | return NO; 103 | 104 | } else if ([fragment isKindOfClass:[NSString class]]) { 105 | if (![self appendString:fragment into:json]) 106 | return NO; 107 | 108 | } else if ([fragment isKindOfClass:[NSNumber class]]) { 109 | if ('c' == *[fragment objCType]) 110 | [json appendString:[fragment boolValue] ? @"true" : @"false"]; 111 | else 112 | [json appendString:[fragment stringValue]]; 113 | 114 | } else if ([fragment isKindOfClass:[NSNull class]]) { 115 | [json appendString:@"null"]; 116 | } else if ([fragment respondsToSelector:@selector(proxyForJson)]) { 117 | [self appendValue:[fragment proxyForJson] into:json]; 118 | 119 | } else { 120 | [self addErrorWithCode:EUNSUPPORTED description:[NSString stringWithFormat:@"JSON serialisation not supported for %@", [fragment class]]]; 121 | return NO; 122 | } 123 | return YES; 124 | } 125 | 126 | - (BOOL)appendArray:(NSArray*)fragment into:(NSMutableString*)json { 127 | if (maxDepth && ++depth > maxDepth) { 128 | [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; 129 | return NO; 130 | } 131 | [json appendString:@"["]; 132 | 133 | BOOL addComma = NO; 134 | for (id value in fragment) { 135 | if (addComma) 136 | [json appendString:@","]; 137 | else 138 | addComma = YES; 139 | 140 | if ([self humanReadable]) 141 | [json appendString:[self indent]]; 142 | 143 | if (![self appendValue:value into:json]) { 144 | return NO; 145 | } 146 | } 147 | 148 | depth--; 149 | if ([self humanReadable] && [fragment count]) 150 | [json appendString:[self indent]]; 151 | [json appendString:@"]"]; 152 | return YES; 153 | } 154 | 155 | - (BOOL)appendDictionary:(NSDictionary*)fragment into:(NSMutableString*)json { 156 | if (maxDepth && ++depth > maxDepth) { 157 | [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; 158 | return NO; 159 | } 160 | [json appendString:@"{"]; 161 | 162 | NSString *colon = [self humanReadable] ? @" : " : @":"; 163 | BOOL addComma = NO; 164 | NSArray *keys = [fragment allKeys]; 165 | if (self.sortKeys) 166 | keys = [keys sortedArrayUsingSelector:@selector(compare:)]; 167 | 168 | for (id value in keys) { 169 | if (addComma) 170 | [json appendString:@","]; 171 | else 172 | addComma = YES; 173 | 174 | if ([self humanReadable]) 175 | [json appendString:[self indent]]; 176 | 177 | if (![value isKindOfClass:[NSString class]]) { 178 | [self addErrorWithCode:EUNSUPPORTED description: @"JSON object key must be string"]; 179 | return NO; 180 | } 181 | 182 | if (![self appendString:value into:json]) 183 | return NO; 184 | 185 | [json appendString:colon]; 186 | if (![self appendValue:[fragment objectForKey:value] into:json]) { 187 | [self addErrorWithCode:EUNSUPPORTED description:[NSString stringWithFormat:@"Unsupported value for key %@ in object", value]]; 188 | return NO; 189 | } 190 | } 191 | 192 | depth--; 193 | if ([self humanReadable] && [fragment count]) 194 | [json appendString:[self indent]]; 195 | [json appendString:@"}"]; 196 | return YES; 197 | } 198 | 199 | - (BOOL)appendString:(NSString*)fragment into:(NSMutableString*)json { 200 | 201 | [json appendString:@"\""]; 202 | 203 | NSRange esc = [fragment rangeOfCharacterFromSet:kEscapeChars]; 204 | if ( !esc.length ) { 205 | // No special chars -- can just add the raw string: 206 | [json appendString:fragment]; 207 | 208 | } else { 209 | NSUInteger length = [fragment length]; 210 | for (NSUInteger i = 0; i < length; i++) { 211 | unichar uc = [fragment characterAtIndex:i]; 212 | switch (uc) { 213 | case '"': [json appendString:@"\\\""]; break; 214 | case '\\': [json appendString:@"\\\\"]; break; 215 | case '\t': [json appendString:@"\\t"]; break; 216 | case '\n': [json appendString:@"\\n"]; break; 217 | case '\r': [json appendString:@"\\r"]; break; 218 | case '\b': [json appendString:@"\\b"]; break; 219 | case '\f': [json appendString:@"\\f"]; break; 220 | default: 221 | if (uc < 0x20) { 222 | [json appendFormat:@"\\u%04x", uc]; 223 | } else { 224 | CFStringAppendCharacters((CFMutableStringRef)json, &uc, 1); 225 | } 226 | break; 227 | 228 | } 229 | } 230 | } 231 | 232 | [json appendString:@"\""]; 233 | return YES; 234 | } 235 | 236 | 237 | @end 238 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSLocationManager/SSLocationManager.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // SSLocationManager.h 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 2/27/11. 23 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import 27 | #import 28 | #import "MulticastDelegate.h" 29 | #import "YahooPlaceFinder.h" 30 | 31 | @class YahooPlaceData; 32 | @protocol SSLocationManagerDelegate; 33 | 34 | @interface SSLocationManager: NSObject 35 | { 36 | YahooPlaceFinder *_placeFinder; 37 | CLLocationManager *_coreLocationManager; 38 | YahooPlaceData *currentLocation; 39 | CLLocationCoordinate2D currentCoordinate; 40 | 41 | MulticastDelegate *_multicastDelegate; 42 | 43 | BOOL _updateInProgress; 44 | } 45 | 46 | @property (nonatomic, retain) YahooPlaceData *currentLocation; 47 | @property (nonatomic, readonly) CLLocationCoordinate2D currentCoordinate; 48 | 49 | - (void) addDelegate:(id)delegate; 50 | - (void) removeDelegate:(id)delegate; 51 | + (id) sharedManager; 52 | - (void) startUpdatingCurrentLocation; 53 | 54 | @end 55 | 56 | @protocol SSLocationManagerDelegate 57 | @required 58 | - (void) ssLocationManager:(SSLocationManager *)locManager updatedCurrentLocation:(YahooPlaceData *)_currentLocation; 59 | - (void) ssLocationManager:(SSLocationManager *)locManager didFailWithError:(NSError *)error; 60 | @end 61 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSLocationManager/SSLocationManager.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // SSLocationManager.m 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 2/27/11. 23 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import "SSLocationManager.h" 27 | 28 | @implementation SSLocationManager 29 | 30 | @synthesize currentLocation, currentCoordinate; 31 | 32 | - (void) addDelegate:(id)delegate 33 | { 34 | [_multicastDelegate addDelegate:delegate]; 35 | } 36 | 37 | - (void) removeDelegate:(id)delegate 38 | { 39 | [_multicastDelegate removeDelegate:delegate]; 40 | } 41 | 42 | - (void) startUpdatingCurrentLocation 43 | { 44 | if (_updateInProgress) { 45 | NSLog(@"SSLocationManager::startUpdatingCurrentLocation - cannot start a new update, one is already in progress"); 46 | return; 47 | } 48 | 49 | NSLog(@"SSLocationManager::startUpdatingCurrentLocation - starting location update"); 50 | _updateInProgress = YES; 51 | [_coreLocationManager startUpdatingLocation]; 52 | } 53 | 54 | 55 | #pragma mark - 56 | #pragma mark Singleton Methods 57 | 58 | - (id) init 59 | { 60 | if (!(self = [super init])) { 61 | return self; 62 | } 63 | 64 | _updateInProgress = NO; 65 | currentLocation = nil; 66 | currentCoordinate = CLLocationCoordinate2DMake(0.0f, 0.0f); 67 | 68 | _multicastDelegate = [[MulticastDelegate alloc] init]; 69 | _placeFinder = [[YahooPlaceFinder alloc] initWithDelegate:self]; 70 | _coreLocationManager = [[CLLocationManager alloc] init]; 71 | [_coreLocationManager setDelegate:self]; 72 | 73 | return self; 74 | } 75 | 76 | + (id) sharedManager 77 | { 78 | static SSLocationManager *sharedManager = nil; 79 | @synchronized (self) { 80 | if (sharedManager == nil) { 81 | sharedManager = [[SSLocationManager alloc] init]; 82 | } 83 | } 84 | return sharedManager; 85 | } 86 | 87 | 88 | #pragma mark - 89 | #pragma mark CLLocationManagerDelegate Methods 90 | 91 | - (void) locationManager:(CLLocationManager *)manager 92 | didUpdateToLocation:(CLLocation *)newLocation 93 | fromLocation:(CLLocation *)oldLocation 94 | { 95 | // 96 | // skip cached location 97 | // 98 | NSTimeInterval interval = [newLocation.timestamp timeIntervalSinceNow]; 99 | if (abs(interval) > 2.0f) { 100 | NSLog(@"SSLocationManager::locationManager:didUpdateToLocation:fromLocation - cached location, skipping..."); 101 | return; 102 | } 103 | 104 | NSLog(@"SSLocationManager::locationManager:didUpdateToLocation:fromLocation - new location: %.02f %.02f%", 105 | newLocation.coordinate.latitude, newLocation.coordinate.longitude); 106 | 107 | // 108 | // device updated location, now start fetching data about the location using Yahoo Places API 109 | // 110 | [manager stopUpdatingLocation]; 111 | [_placeFinder startUpdatingPlaceDataForCoordinate:newLocation.coordinate]; 112 | currentCoordinate = newLocation.coordinate; 113 | } 114 | 115 | - (void) locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error 116 | { 117 | NSLog(@"SSLocationManager::locationManager:didFailWithError - location manager failed with error: %@", [error description]); 118 | [manager stopUpdatingLocation]; 119 | [_multicastDelegate ssLocationManager:self didFailWithError:error]; 120 | _updateInProgress = NO; 121 | currentCoordinate = CLLocationCoordinate2DMake(0.0f, 0.0f); 122 | } 123 | 124 | 125 | #pragma mark - 126 | #pragma mark YahooPlaceFinderDelegate Methods 127 | 128 | - (void) placeFinder:(YahooPlaceFinder *)placeFinder didUpdatePlaceData:(YahooPlaceData *)placeData 129 | { 130 | NSLog(@"SSLocationManager::placeFinder:didUpdatePlaceData - YahooPlaceFinder request finished"); 131 | self.currentLocation = placeData; 132 | [_multicastDelegate ssLocationManager:self updatedCurrentLocation:placeData]; 133 | _updateInProgress = NO; 134 | } 135 | 136 | - (void) placeFinder:(YahooPlaceFinder *)placeFinder didFail:(NSError *)error 137 | { 138 | NSLog(@"SSLocationManager::placeFinder:didFail - YahooPlaceFinder request failed"); 139 | [_multicastDelegate ssLocationManager:self didFailWithError:error]; 140 | _updateInProgress = NO; 141 | } 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSLocationManager/YahooPlaceData.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // YahooPlaceData.h 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 2/22/11. 23 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import 27 | 28 | @interface YahooPlaceData: NSObject 29 | { 30 | NSNumber *quality; 31 | NSNumber *latitude; 32 | NSNumber *longitude; 33 | NSNumber *radius; 34 | NSString *name; 35 | NSString *line1; 36 | NSString *line2; 37 | NSString *line3; 38 | NSString *line4; 39 | NSString *house; 40 | NSString *street; 41 | NSString *xstreet; 42 | NSString *unittype; 43 | NSString *unit; 44 | NSString *postal; 45 | NSString *neighborhood; 46 | NSString *city; 47 | NSString *county; 48 | NSString *state; 49 | NSString *country; 50 | NSString *countrycode; 51 | NSString *statecode; 52 | NSString *countycode; 53 | NSString *hash; 54 | NSNumber *woeid; 55 | NSNumber *woetype; 56 | NSString *uzip; 57 | } 58 | 59 | @property (nonatomic, retain) NSNumber *quality; 60 | @property (nonatomic, retain) NSNumber *latitude; 61 | @property (nonatomic, retain) NSNumber *longitude; 62 | @property (nonatomic, retain) NSNumber *radius; 63 | @property (nonatomic, retain) NSString *name; 64 | @property (nonatomic, retain) NSString *line1; 65 | @property (nonatomic, retain) NSString *line2; 66 | @property (nonatomic, retain) NSString *line3; 67 | @property (nonatomic, retain) NSString *line4; 68 | @property (nonatomic, retain) NSString *house; 69 | @property (nonatomic, retain) NSString *street; 70 | @property (nonatomic, retain) NSString *xstreet; 71 | @property (nonatomic, retain) NSString *unittype; 72 | @property (nonatomic, retain) NSString *unit; 73 | @property (nonatomic, retain) NSString *postal; 74 | @property (nonatomic, retain) NSString *neighborhood; 75 | @property (nonatomic, retain) NSString *city; 76 | @property (nonatomic, retain) NSString *county; 77 | @property (nonatomic, retain) NSString *state; 78 | @property (nonatomic, retain) NSString *country; 79 | @property (nonatomic, retain) NSString *countrycode; 80 | @property (nonatomic, retain) NSString *statecode; 81 | @property (nonatomic, retain) NSString *countycode; 82 | @property (nonatomic, retain) NSString *hash; 83 | @property (nonatomic, retain) NSNumber *woeid; 84 | @property (nonatomic, retain) NSNumber *woetype; 85 | @property (nonatomic, retain) NSString *uzip; 86 | 87 | - (id) initWithJsonDictionary:(NSDictionary *)json; 88 | - (NSString *) toString; 89 | + (id) placeData; 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSLocationManager/YahooPlaceData.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // YahooPlaceData.m 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 2/22/11. 23 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import "YahooPlaceData.h" 27 | 28 | @implementation YahooPlaceData 29 | 30 | @synthesize quality; 31 | @synthesize latitude; 32 | @synthesize longitude; 33 | @synthesize radius; 34 | @synthesize name; 35 | @synthesize line1; 36 | @synthesize line2; 37 | @synthesize line3; 38 | @synthesize line4; 39 | @synthesize house; 40 | @synthesize street; 41 | @synthesize xstreet; 42 | @synthesize unittype; 43 | @synthesize unit; 44 | @synthesize postal; 45 | @synthesize neighborhood; 46 | @synthesize city; 47 | @synthesize county; 48 | @synthesize state; 49 | @synthesize country; 50 | @synthesize countrycode; 51 | @synthesize statecode; 52 | @synthesize countycode; 53 | @synthesize hash; 54 | @synthesize woeid; 55 | @synthesize woetype; 56 | @synthesize uzip; 57 | 58 | - (id) initWithJsonDictionary:(NSDictionary *)json 59 | { 60 | if (!(self = [super init])) { 61 | return self; 62 | } 63 | 64 | if (json == nil) { 65 | return self; 66 | } 67 | 68 | // 69 | // set all properties using KVC 70 | // 71 | for (NSString *key in [json allKeys]) { 72 | @try { 73 | [self setValue:[json objectForKey:key] forKey:key]; 74 | } 75 | @catch (NSException *e) { } 76 | } 77 | 78 | return self; 79 | } 80 | 81 | - (void) dealloc 82 | { 83 | [self.quality release]; 84 | [self.latitude release]; 85 | [self.longitude release]; 86 | [self.radius release]; 87 | [self.name release]; 88 | [self.line1 release]; 89 | [self.line2 release]; 90 | [self.line3 release]; 91 | [self.line4 release]; 92 | [self.house release]; 93 | [self.street release]; 94 | [self.xstreet release]; 95 | [self.unittype release]; 96 | [self.unit release]; 97 | [self.postal release]; 98 | [self.neighborhood release]; 99 | [self.city release]; 100 | [self.county release]; 101 | [self.state release]; 102 | [self.country release]; 103 | [self.countrycode release]; 104 | [self.statecode release]; 105 | [self.countycode release]; 106 | [self.hash release]; 107 | [self.woeid release]; 108 | [self.woetype release]; 109 | [self.uzip release]; 110 | [super dealloc]; 111 | } 112 | 113 | - (NSString *) toString 114 | { 115 | NSString *s = [NSString stringWithFormat: 116 | @"[quality]\n%d\n\n" 117 | @"[latitude]\n%.6f\n\n" 118 | @"[longitude]\n%.6f\n\n" 119 | @"[radius]\n%d\n\n" 120 | @"[name]\n%@\n\n" 121 | @"[line1]\n%@\n\n" 122 | @"[line2]\n%@\n\n" 123 | @"[line3]\n%@\n\n" 124 | @"[line4]\n%@\n\n" 125 | @"[house]\n%@\n\n" 126 | @"[street]\n%@\n\n" 127 | @"[xstreet]\n%@\n\n" 128 | @"[unittype]\n%@\n\n" 129 | @"[unit]\n%@\n\n" 130 | @"[postal]\n%@\n\n" 131 | @"[neighborhood]\n%@\n\n" 132 | @"[city]\n%@\n\n" 133 | @"[county]\n%@\n\n" 134 | @"[state]\n%@\n\n" 135 | @"[country]\n%@\n\n" 136 | @"[countrycode]\n%@\n\n" 137 | @"[statecode]\n%@\n\n" 138 | @"[countycode]\n%@\n\n" 139 | @"[hash]\n%@\n\n" 140 | @"[woeid]\n%d\n\n" 141 | @"[woetype]\n%d\n\n" 142 | @"[uzip]\n%@\n\n", 143 | [quality intValue], 144 | [latitude floatValue], 145 | [longitude floatValue], 146 | [radius intValue], 147 | name, 148 | line1, 149 | line2, 150 | line3, 151 | line4, 152 | house, 153 | street, 154 | xstreet, 155 | unittype, 156 | unit, 157 | postal, 158 | neighborhood, 159 | city, 160 | county, 161 | state, 162 | country, 163 | countrycode, 164 | statecode, 165 | countycode, 166 | hash, 167 | [woeid intValue], 168 | [woetype intValue], 169 | uzip]; 170 | return s; 171 | } 172 | 173 | + (id) placeData 174 | { 175 | return [[[YahooPlaceData alloc] init] autorelease]; 176 | } 177 | 178 | @end 179 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSLocationManager/YahooPlaceFinder.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // YahooPlaceFinderHelper.h 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 2/22/11. 23 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import 27 | #import 28 | #import "SSWebRequestDelegate.h" 29 | #import "YahooPlaceData.h" 30 | 31 | typedef enum YahooPlaceFinderStatus_ 32 | { 33 | kYahooPlaceFinderStatus_NotStarted, 34 | kYahooPlaceFinderStatus_Updating, 35 | kYahooPlaceFinderStatus_Finished, 36 | kYahooPlaceFinderStatus_Failed 37 | } YahooPlaceFinderStatus; 38 | 39 | @protocol YahooPlaceFinderDelegate; 40 | 41 | @interface YahooPlaceFinder: NSObject 42 | { 43 | YahooPlaceFinderStatus status; 44 | id delegate; 45 | } 46 | 47 | @property (nonatomic, assign) YahooPlaceFinderStatus status; 48 | @property (nonatomic, assign) id delegate; 49 | 50 | + (id) placeFinderWithDelegate:(id)_delegate; 51 | - (id) initWithDelegate:(id)_delegate; 52 | - (void) startUpdatingPlaceDataForLatitude:(CLLocationDegrees)latitude andLongitude:(CLLocationDegrees)longitude; 53 | - (void) startUpdatingPlaceDataForCoordinate:(CLLocationCoordinate2D)coordinate; 54 | 55 | @end 56 | 57 | 58 | @protocol YahooPlaceFinderDelegate 59 | @optional 60 | - (void) placeFinder:(YahooPlaceFinder *)placeFinder didUpdatePlaceData:(YahooPlaceData *)placeData; 61 | - (void) placeFinder:(YahooPlaceFinder *)placeFinder didFail:(NSError *)error; 62 | @end 63 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSLocationManager/YahooPlaceFinder.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // YahooPlaceFinderHelper.m 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 2/22/11. 23 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import "YahooPlaceFinder.h" 27 | #import "YahooPlaceData.h" 28 | #import "JSON.h" 29 | #import "SSWebRequest.h" 30 | #import "NSObject+Helpers.h" 31 | 32 | /* 33 | * REF: http://developer.yahoo.com/geo/placefinder/ 34 | * REF: http://developer.yahoo.com/geo/placefinder/guide/requests.html#base-uri 35 | * EXAMPLE REQUEST: http://where.yahooapis.com/geocode?location=37.42,-122.12&flags=J&gflags=R&appid=zHgnBS4m 36 | */ 37 | 38 | static NSString *const kYahooPlacesApiEndPoint = @"http://where.yahooapis.com/geocode"; 39 | static NSString *const kYahooPlacesApiAppId = @"zHgnBS4m"; // create one for your app at: https://developer.apps.yahoo.com/dashboard/createKey.html 40 | 41 | @implementation YahooPlaceFinder 42 | 43 | @synthesize delegate, status; 44 | 45 | + (id) placeFinderWithDelegate:(id)_delegate 46 | { 47 | return [[[YahooPlaceFinder alloc] initWithDelegate:_delegate] autorelease]; 48 | } 49 | 50 | - (id) init 51 | { 52 | return [self initWithDelegate:nil]; 53 | } 54 | 55 | - (id) initWithDelegate:(id)_delegate 56 | { 57 | if (!(self = [super init])) { 58 | return self; 59 | } 60 | 61 | self.status = kYahooPlaceFinderStatus_NotStarted; 62 | self.delegate = _delegate; 63 | return self; 64 | } 65 | 66 | - (void) dealloc 67 | { 68 | [super dealloc]; 69 | } 70 | 71 | 72 | #pragma mark - 73 | #pragma mark Place Finder Methods 74 | 75 | - (void) startUpdatingPlaceDataForLatitude:(CLLocationDegrees)latitude andLongitude:(CLLocationDegrees)longitude 76 | { 77 | if (self.status == kYahooPlaceFinderStatus_Updating) { 78 | NSLog(@"this YahooPlaceFinder instance is already updating, can't start another update."); 79 | return; 80 | } 81 | 82 | // 83 | // prepare querystring 84 | // 85 | NSString *locationToken = [NSString stringWithFormat:@"%.06f,%.06f", latitude, longitude]; 86 | SSWebRequestParams *params = [[SSWebRequestParams alloc] init]; 87 | [params addKey:@"location" withValue:locationToken]; 88 | [params addKey:@"flags" withValue:@"J"]; // response format: json 89 | [params addKey:@"gflags" withValue:@"R"]; // reverse-geo-lookup 90 | [params addKey:@"appid" withValue:kYahooPlacesApiAppId]; 91 | NSString *queryString = [params getPostDataStringEncoded]; 92 | [params release]; 93 | 94 | // 95 | // start request 96 | // 97 | NSString *url = [NSString stringWithFormat:@"%@?%@", kYahooPlacesApiEndPoint, queryString]; 98 | SSWebRequest *request = [SSWebRequest requestWithDelegate:self]; 99 | [request startWithUrl:url]; 100 | 101 | NSLog(@"starting yahoo places api request with url: %@", url); 102 | 103 | self.status = kYahooPlaceFinderStatus_Updating; 104 | } 105 | 106 | - (void) startUpdatingPlaceDataForCoordinate:(CLLocationCoordinate2D)coordinate 107 | { 108 | [self startUpdatingPlaceDataForLatitude:coordinate.latitude andLongitude:coordinate.longitude]; 109 | } 110 | 111 | 112 | #pragma mark - 113 | #pragma mark SSWebRequestDelegate Methods 114 | 115 | - (void) updateFailed 116 | { 117 | self.status = kYahooPlaceFinderStatus_Failed; 118 | if ((self.delegate != nil) && [self.delegate respondsToSelector:@selector(placeFinder:didFail:)]) { 119 | [self.delegate placeFinder:self didFail:nil]; 120 | } 121 | } 122 | 123 | - (void) SSWebRequest:(SSWebRequest *)request didFinish:(NSString *)responseString 124 | { 125 | id result = [responseString JSONValue]; 126 | if ([result isNilOrNotOfType:[NSDictionary class]]) { 127 | [self updateFailed]; return; 128 | } 129 | 130 | id resultSet = [result objectForKey:@"ResultSet"]; 131 | if ([resultSet isNilOrNotOfType:[NSDictionary class]]) { 132 | [self updateFailed]; return; 133 | } 134 | 135 | id results = [resultSet objectForKey:@"Results"]; 136 | if ([results isNilOrNotOfType:[NSArray class]] || ([results count] < 1)) { 137 | [self updateFailed]; return; 138 | } 139 | 140 | id rawPlaceData = [results objectAtIndex:0]; 141 | self.status = kYahooPlaceFinderStatus_Finished; 142 | 143 | if ((self.delegate != nil) && [self.delegate respondsToSelector:@selector(placeFinder:didUpdatePlaceData:)]) { 144 | YahooPlaceData *place = nil; 145 | @try { 146 | place = [[[YahooPlaceData alloc] initWithJsonDictionary:rawPlaceData] autorelease]; 147 | } 148 | @catch (NSException *e) { 149 | [self updateFailed]; return; 150 | } 151 | 152 | [self.delegate placeFinder:self didUpdatePlaceData:place]; 153 | } 154 | } 155 | 156 | - (void) SSWebRequest:(SSWebRequest *)request didFailWithError:(NSError *)error 157 | { 158 | NSLog(@"yahoo place finder request failed with error: %@", (error ? [error description] : @"")); 159 | 160 | self.status = kYahooPlaceFinderStatus_Failed; 161 | if ((self.delegate != nil) && [self.delegate respondsToSelector:@selector(placeFinder:didFail:)]) { 162 | [self.delegate placeFinder:self didFail:error]; 163 | } 164 | } 165 | 166 | @end 167 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSWebRequest/SSWebRequest.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // SSWebRequest.h 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 1/6/11. 23 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import 27 | #import "SSWebRequestDelegate.h" 28 | #import "SSWebRequestParams.h" 29 | 30 | typedef enum SSWebRequestStatus_ 31 | { 32 | kSSWebRequestStatusUnset, 33 | kSSWebRequestStatusUnstarted, 34 | kSSWebRequestStatusLoading, 35 | kSSWebRequestStatusFinished, 36 | kSSWebRequestStatusCancelled, 37 | kSSWebRequestStatusFailed 38 | } SSWebRequestStatus; 39 | 40 | @interface SSWebRequest: NSObject 41 | { 42 | NSURLConnection *_connection; 43 | NSMutableURLRequest *_request; 44 | NSMutableData *_responseData; 45 | id delegate; 46 | NSObject *userData; 47 | 48 | SSWebRequestStatus status; 49 | NSUInteger timeout; 50 | 51 | /** Called on the delegate when the request completes successfully. */ 52 | // this method would be something like this (return value is not used): 53 | // - (id) someRequest:(SSWebRequest *)request didFinish:(NSString *)responseString; 54 | SEL didFinishSelector; 55 | /** Called on the delegate when the request fails. */ 56 | // and this one would be something like this (return value is again not used): 57 | // - (id) someRequest:(SSWebRequest *)request didFailWithError:(NSError *)error; 58 | SEL didFailSelector; 59 | } 60 | 61 | @property (nonatomic, readonly) SSWebRequestStatus status; 62 | @property (nonatomic, assign) NSUInteger timeout; 63 | @property (nonatomic, retain) NSObject *userData; 64 | @property (nonatomic, assign) SEL didFinishSelector; 65 | @property (nonatomic, assign) SEL didFailSelector; 66 | 67 | + (SSWebRequest *) requestWithDelegate:(id)deleg; 68 | 69 | + (SSWebRequest *) requestWithDelegate:(id)deleg 70 | didFinishSelector:(SEL)_didFinishSelector 71 | didFailSelector:(SEL)_didFailSelector; 72 | 73 | - (void) startWithUrl:(NSString *)url 74 | andHttpMethod:(NSString *)httpMethod 75 | andPostData:(NSString *)postData 76 | andHttpHeaders:(NSDictionary *)headers; 77 | 78 | - (void) startWithUrl:(NSString *)url 79 | andHttpMethod:(NSString *)httpMethod 80 | andPostData:(NSString *)postData; 81 | 82 | - (void) startWithUrl:(NSString *)url 83 | andPostData:(NSString *)postData; 84 | 85 | - (void) startWithUrl:(NSString *)url 86 | andHttpMethod:(NSString *)httpMethod; 87 | 88 | - (void) startWithUrl:(NSString *)url; 89 | 90 | - (void) cancel; 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSWebRequest/SSWebRequest.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // SSWebRequest.m 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 1/6/11. 23 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import "SSWebRequest.h" 27 | #import "NSString+Helpers.h" 28 | 29 | #define kSSWebRequestDefaultTimeout 40 30 | #define kSSWebRequestErrorDomain @"com.sslabs.sswebrequest" 31 | 32 | enum SSWebRequestErrorCodes { 33 | kSSWebRequestErrorCodeCannotCreateRequest = 100, 34 | kSSWebRequestErrorCodeCannotCreateConnection 35 | }; 36 | 37 | @implementation SSWebRequest 38 | 39 | @synthesize status, timeout, userData, didFinishSelector, didFailSelector; 40 | 41 | - (void) startWithUrl:(NSString *)url 42 | andHttpMethod:(NSString *)httpMethod 43 | andPostData:(NSString *)postData 44 | andHttpHeaders:(NSDictionary *)headers 45 | { 46 | if (self.status != kSSWebRequestStatusUnstarted) { 47 | NSLog(@"HTTP request already running or the request is not usable anymore"); 48 | return; 49 | } 50 | 51 | NSTimeInterval timeoutInterval = (self.timeout != 0) ? self.timeout : kSSWebRequestDefaultTimeout; 52 | _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] 53 | cachePolicy:NSURLRequestUseProtocolCachePolicy 54 | timeoutInterval:timeoutInterval]; 55 | if (_request == nil) { 56 | status = kSSWebRequestStatusFailed; 57 | NSError *err = [NSError errorWithDomain:kSSWebRequestErrorDomain 58 | code:kSSWebRequestErrorCodeCannotCreateRequest 59 | userInfo:nil]; 60 | [delegate SSWebRequest:self didFailWithError:err]; 61 | return; 62 | } 63 | 64 | // 65 | // set http method and set post data if any 66 | // 67 | [_request setHTTPMethod:httpMethod]; 68 | if (postData != nil) { 69 | [_request setHTTPBody:[postData dataUsingEncoding:NSUTF8StringEncoding]]; 70 | // timeout interval is being reset after setting post body, we should re-assign it here (~?) 71 | [_request setTimeoutInterval:timeoutInterval]; 72 | } 73 | 74 | // 75 | // append http headers if any 76 | // 77 | if (headers != nil) { 78 | NSArray *keys = [headers allKeys]; 79 | for (NSString *key in keys) { 80 | [_request addValue:[headers objectForKey:key] forHTTPHeaderField:key]; 81 | } 82 | } 83 | 84 | _responseData = [[NSMutableData alloc] initWithLength:0]; 85 | status = kSSWebRequestStatusLoading; 86 | 87 | NSLog(@"starting connection %@", url); 88 | 89 | // 90 | // create the connection 91 | // 92 | _connection = [NSURLConnection connectionWithRequest:_request delegate:self]; 93 | if (_connection == nil) { 94 | [_responseData release]; 95 | _responseData = nil; 96 | _request = nil; 97 | status = kSSWebRequestStatusFailed; 98 | 99 | NSError *err = [NSError errorWithDomain:kSSWebRequestErrorDomain 100 | code:kSSWebRequestErrorCodeCannotCreateConnection 101 | userInfo:nil]; 102 | [delegate SSWebRequest:self didFailWithError:err]; 103 | } 104 | } 105 | 106 | - (void) startWithUrl:(NSString *)url 107 | andHttpMethod:(NSString *)httpMethod 108 | andPostData:(NSString *)postData 109 | { 110 | [self startWithUrl:url andHttpMethod:httpMethod andPostData:postData andHttpHeaders:nil]; 111 | } 112 | 113 | - (void) startWithUrl:(NSString *)url 114 | andPostData:(NSString *)postData 115 | { 116 | [self startWithUrl:url andHttpMethod:@"POST" andPostData:postData andHttpHeaders:nil]; 117 | } 118 | 119 | - (void) startWithUrl:(NSString *)url 120 | andHttpMethod:(NSString *)httpMethod 121 | { 122 | [self startWithUrl:url andHttpMethod:httpMethod andPostData:nil andHttpHeaders:nil]; 123 | } 124 | 125 | - (void) startWithUrl:(NSString *)url 126 | { 127 | [self startWithUrl:url andHttpMethod:@"GET" andPostData:nil andHttpHeaders:nil]; 128 | } 129 | 130 | - (void) cancel 131 | { 132 | if (_connection == nil) { 133 | NSLog(@"cannot cancel, uninitialized connection."); 134 | return; 135 | } 136 | 137 | [_connection cancel]; 138 | status = kSSWebRequestStatusCancelled; 139 | if (delegate && [delegate respondsToSelector:@selector(SSWebRequestCancelled:)]) { 140 | [delegate SSWebRequestCancelled:self]; 141 | } 142 | } 143 | 144 | 145 | #pragma mark - 146 | #pragma mark NSURLConnection Delegate Methods 147 | 148 | - (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 149 | { 150 | [_responseData setLength:0]; 151 | } 152 | 153 | - (void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 154 | { 155 | [_responseData appendData:data]; 156 | } 157 | 158 | - (void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error 159 | { 160 | status = kSSWebRequestStatusFailed; 161 | if (_responseData != nil) { 162 | [_responseData release]; 163 | _responseData = nil; 164 | } 165 | 166 | NSLog(@"SSWebRequest::connection:didFailWithError - %@", [error description]); 167 | 168 | // 169 | // notify delegate 170 | // 171 | if (delegate == nil) { 172 | return; 173 | } 174 | if (didFailSelector != nil) { 175 | if ([delegate respondsToSelector:didFailSelector]) { 176 | [delegate performSelector:didFailSelector withObject:self withObject:error]; 177 | } 178 | didFinishSelector = didFailSelector = nil; 179 | } 180 | else if ([delegate respondsToSelector:@selector(SSWebRequest:didFailWithError:)]) { 181 | [delegate SSWebRequest:self didFailWithError:error]; 182 | } 183 | } 184 | 185 | - (void) connectionDidFinishLoading:(NSURLConnection *)connection 186 | { 187 | NSString *responseStr = [[[NSString alloc] initWithData:_responseData 188 | encoding:NSUTF8StringEncoding] autorelease]; 189 | [_responseData release]; 190 | _responseData = nil; 191 | status = kSSWebRequestStatusFinished; 192 | 193 | // 194 | // notify delegate 195 | // 196 | NSLog(@"SSWebRequest::connectionDidFinishLoading - received response: %@", responseStr); 197 | if (delegate == nil) { 198 | return; 199 | } 200 | if (didFinishSelector != nil) { 201 | if ([delegate respondsToSelector:didFinishSelector]) { 202 | [delegate performSelector:didFinishSelector withObject:self withObject:responseStr]; 203 | } 204 | didFinishSelector = didFailSelector = nil; 205 | } 206 | else if ([delegate respondsToSelector:@selector(SSWebRequest:didFinish:)]) { 207 | [delegate SSWebRequest:self didFinish:responseStr]; 208 | } 209 | } 210 | 211 | 212 | #pragma mark - 213 | #pragma mark Construction/Destruction Methods 214 | 215 | - (id) initWithDelegate:(id)deleg 216 | { 217 | if (!(self = [super init])) { 218 | return self; 219 | } 220 | 221 | _connection = nil; 222 | _request = nil; 223 | _responseData = nil; 224 | userData = nil; 225 | delegate = deleg; 226 | status = kSSWebRequestStatusUnstarted; 227 | timeout = 0; 228 | didFinishSelector = nil; 229 | didFailSelector = nil; 230 | return self; 231 | } 232 | 233 | + (SSWebRequest *) requestWithDelegate:(id)deleg 234 | { 235 | return [[[SSWebRequest alloc] initWithDelegate:deleg] autorelease]; 236 | } 237 | 238 | + (SSWebRequest *) requestWithDelegate:(id)deleg 239 | didFinishSelector:(SEL)_didFinishSelector 240 | didFailSelector:(SEL)_didFailSelector 241 | { 242 | SSWebRequest *req = [[SSWebRequest alloc] initWithDelegate:deleg]; 243 | req.didFinishSelector = _didFinishSelector; 244 | req.didFailSelector = _didFailSelector; 245 | return [req autorelease]; 246 | } 247 | 248 | - (void) dealloc 249 | { 250 | [_responseData release]; 251 | [userData release]; 252 | [super dealloc]; 253 | } 254 | 255 | @end 256 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSWebRequest/SSWebRequestDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // SSWebRequestDelegate.h 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 6/18/10. 23 | // Copyright 2010 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import 27 | 28 | @class SSWebRequest; 29 | 30 | @protocol SSWebRequestDelegate 31 | 32 | @required 33 | - (void) SSWebRequest:(SSWebRequest *)request didFinish:(NSString *)responseString; 34 | - (void) SSWebRequest:(SSWebRequest *)request didFailWithError:(NSError *)error; 35 | 36 | @optional 37 | - (void) SSWebRequestCancelled:(SSWebRequest *)request; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSWebRequest/SSWebRequestParams.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // SSWebRequestParams.h 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 6/17/10. 23 | // Copyright 2010 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import 27 | 28 | @interface SSWebRequestParams : NSObject 29 | { 30 | NSMutableArray *paramsArr; 31 | } 32 | 33 | - (void) addKey:(NSString *)key withValue:(NSObject *)value; 34 | - (NSString *) getPostDataString; 35 | - (NSString *) getPostDataStringEncoded; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Classes/SSLocationManager/SSWebRequest/SSWebRequestParams.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2011 Ahmet Ardal 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | // 19 | // SSWebRequestParams.m 20 | // SSLocationManager 21 | // 22 | // Created by Ahmet Ardal on 6/17/10. 23 | // Copyright 2010 SpinningSphere Labs. All rights reserved. 24 | // 25 | 26 | #import "SSWebRequestParams.h" 27 | 28 | @implementation SSWebRequestParams 29 | 30 | - (void) addKey:(NSString *)key withValue:(NSObject *)value 31 | { 32 | [paramsArr addObject:[NSDictionary dictionaryWithObjectsAndKeys:value, key, nil]]; 33 | } 34 | 35 | - (NSString *) getPostDataString 36 | { 37 | NSMutableArray *pairs = [[NSMutableArray alloc] init]; 38 | for (NSDictionary *param in paramsArr) { 39 | NSString *key = [[param allKeys] objectAtIndex:0]; 40 | NSString *value = [[param allValues] objectAtIndex:0]; 41 | [pairs addObject:[NSString stringWithFormat:@"%@=%@", key, value]]; 42 | } 43 | NSString *postDataStr = [pairs componentsJoinedByString:@"&"]; 44 | [pairs release]; 45 | 46 | return postDataStr; 47 | } 48 | 49 | - (NSString *) getPostDataStringEncoded 50 | { 51 | return [[self getPostDataString] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 52 | } 53 | 54 | 55 | #pragma mark - 56 | #pragma mark Construction/Destruction Methods 57 | 58 | - (id) init 59 | { 60 | if (self = [super init]) { 61 | paramsArr = [[NSMutableArray alloc] init]; 62 | } 63 | return self; 64 | } 65 | 66 | - (void) dealloc 67 | { 68 | [paramsArr release]; 69 | [super dealloc]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Classes/SSLocationManagerAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSLocationManagerAppDelegate.h 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 5/24/11. 6 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class SSLocationManagerViewController; 12 | 13 | @interface SSLocationManagerAppDelegate : NSObject { 14 | UIWindow *window; 15 | SSLocationManagerViewController *viewController; 16 | } 17 | 18 | @property (nonatomic, retain) IBOutlet UIWindow *window; 19 | @property (nonatomic, retain) IBOutlet SSLocationManagerViewController *viewController; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /Classes/SSLocationManagerAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSLocationManagerAppDelegate.m 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 5/24/11. 6 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import "SSLocationManagerAppDelegate.h" 10 | #import "SSLocationManagerViewController.h" 11 | 12 | @implementation SSLocationManagerAppDelegate 13 | 14 | @synthesize window; 15 | @synthesize viewController; 16 | 17 | 18 | #pragma mark - 19 | #pragma mark Application lifecycle 20 | 21 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 22 | 23 | // Override point for customization after application launch. 24 | 25 | // Add the view controller's view to the window and display. 26 | [self.window addSubview:viewController.view]; 27 | [self.window makeKeyAndVisible]; 28 | 29 | return YES; 30 | } 31 | 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application { 34 | /* 35 | Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 36 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 37 | */ 38 | } 39 | 40 | 41 | - (void)applicationDidEnterBackground:(UIApplication *)application { 42 | /* 43 | Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 44 | If your application supports background execution, called instead of applicationWillTerminate: when the user quits. 45 | */ 46 | } 47 | 48 | 49 | - (void)applicationWillEnterForeground:(UIApplication *)application { 50 | /* 51 | Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. 52 | */ 53 | } 54 | 55 | 56 | - (void)applicationDidBecomeActive:(UIApplication *)application { 57 | /* 58 | Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 59 | */ 60 | } 61 | 62 | 63 | - (void)applicationWillTerminate:(UIApplication *)application { 64 | /* 65 | Called when the application is about to terminate. 66 | See also applicationDidEnterBackground:. 67 | */ 68 | } 69 | 70 | 71 | #pragma mark - 72 | #pragma mark Memory management 73 | 74 | - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { 75 | /* 76 | Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. 77 | */ 78 | } 79 | 80 | 81 | - (void)dealloc { 82 | [viewController release]; 83 | [window release]; 84 | [super dealloc]; 85 | } 86 | 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Classes/SSLocationManagerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSLocationManagerViewController.h 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 5/24/11. 6 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SSLocationManager.h" 11 | 12 | @interface SSLocationManagerViewController: UIViewController 13 | { 14 | BOOL _updatingLocation; 15 | UITextView *textView; 16 | UIButton *button; 17 | } 18 | 19 | @property (nonatomic, retain) IBOutlet UITextView *textView; 20 | @property (nonatomic, retain) IBOutlet UIButton *button; 21 | 22 | - (IBAction) buttonTapped:(id)sender; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Classes/SSLocationManagerViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSLocationManagerViewController.m 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 5/24/11. 6 | // Copyright 2011 SpinningSphere Labs. All rights reserved. 7 | // 8 | 9 | #import "SSLocationManagerViewController.h" 10 | #import "UIHelpers.h" 11 | 12 | @implementation SSLocationManagerViewController 13 | 14 | @synthesize textView, button; 15 | 16 | - (void) initialize 17 | { 18 | _updatingLocation = NO; 19 | [[SSLocationManager sharedManager] addDelegate:self]; 20 | } 21 | 22 | - (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 23 | { 24 | if (!(self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 25 | return self; 26 | } 27 | 28 | [self initialize]; 29 | return self; 30 | } 31 | 32 | - (void) awakeFromNib 33 | { 34 | [super awakeFromNib]; 35 | [self initialize]; 36 | } 37 | 38 | - (void) startLocationUpdate 39 | { 40 | if (_updatingLocation) { 41 | return; 42 | } 43 | 44 | _updatingLocation = YES; 45 | self.textView.text = @""; 46 | [self.button setTitle:@"updating location..." forState:UIControlStateNormal]; 47 | [self.button setEnabled:NO]; 48 | [[SSLocationManager sharedManager] startUpdatingCurrentLocation]; 49 | } 50 | 51 | - (IBAction) buttonTapped:(id)sender 52 | { 53 | [self startLocationUpdate]; 54 | } 55 | 56 | - (void) viewDidLoad 57 | { 58 | [super viewDidLoad]; 59 | [self startLocationUpdate]; 60 | } 61 | 62 | - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 63 | { 64 | return UIInterfaceOrientationIsPortrait(interfaceOrientation); 65 | } 66 | 67 | - (void) didReceiveMemoryWarning 68 | { 69 | [super didReceiveMemoryWarning]; 70 | } 71 | 72 | - (void) viewDidUnload 73 | { 74 | [super viewDidUnload]; 75 | } 76 | 77 | - (void) dealloc 78 | { 79 | [self.textView release]; 80 | [self.button release]; 81 | [super dealloc]; 82 | } 83 | 84 | 85 | #pragma mark - 86 | #pragma mark SSLocationManagerDelegate Methods 87 | 88 | - (void) ssLocationManager:(SSLocationManager *)locManager updatedCurrentLocation:(YahooPlaceData *)_currentLocation 89 | { 90 | _updatingLocation = NO; 91 | [self.button setTitle:@"find my location" forState:UIControlStateNormal]; 92 | [self.button setEnabled:YES]; 93 | 94 | self.textView.text = [_currentLocation toString]; 95 | } 96 | 97 | - (void) ssLocationManager:(SSLocationManager *)locManager didFailWithError:(NSError *)error 98 | { 99 | _updatingLocation = NO; 100 | [self.button setTitle:@"find my location" forState:UIControlStateNormal]; 101 | [self.button setEnabled:YES]; 102 | 103 | [UIHelpers showAlertWithTitle:@"Location update failed. Could not get location info."]; 104 | self.textView.text = @"location update failed..."; 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10D571 6 | 786 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 112 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBCocoaTouchFramework 42 | 43 | 44 | SSLocationManagerViewController 45 | 46 | 47 | 1 48 | 49 | IBCocoaTouchFramework 50 | NO 51 | 52 | 53 | 54 | 292 55 | {320, 480} 56 | 57 | 1 58 | MSAxIDEAA 59 | 60 | NO 61 | NO 62 | 63 | IBCocoaTouchFramework 64 | YES 65 | 66 | 67 | 68 | 69 | YES 70 | 71 | 72 | delegate 73 | 74 | 75 | 76 | 4 77 | 78 | 79 | 80 | viewController 81 | 82 | 83 | 84 | 11 85 | 86 | 87 | 88 | window 89 | 90 | 91 | 92 | 14 93 | 94 | 95 | 96 | 97 | YES 98 | 99 | 0 100 | 101 | 102 | 103 | 104 | 105 | -1 106 | 107 | 108 | File's Owner 109 | 110 | 111 | 3 112 | 113 | 114 | SSLocationManager App Delegate 115 | 116 | 117 | -2 118 | 119 | 120 | 121 | 122 | 10 123 | 124 | 125 | 126 | 127 | 12 128 | 129 | 130 | 131 | 132 | 133 | 134 | YES 135 | 136 | YES 137 | -1.CustomClassName 138 | -2.CustomClassName 139 | 10.CustomClassName 140 | 10.IBEditorWindowLastContentRect 141 | 10.IBPluginDependency 142 | 12.IBEditorWindowLastContentRect 143 | 12.IBPluginDependency 144 | 3.CustomClassName 145 | 3.IBPluginDependency 146 | 147 | 148 | YES 149 | UIApplication 150 | UIResponder 151 | SSLocationManagerViewController 152 | {{234, 376}, {320, 480}} 153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 154 | {{525, 346}, {320, 480}} 155 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 156 | SSLocationManagerAppDelegate 157 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 158 | 159 | 160 | 161 | YES 162 | 163 | 164 | YES 165 | 166 | 167 | 168 | 169 | YES 170 | 171 | 172 | YES 173 | 174 | 175 | 176 | 15 177 | 178 | 179 | 180 | YES 181 | 182 | UIWindow 183 | UIView 184 | 185 | IBUserSource 186 | 187 | 188 | 189 | 190 | SSLocationManagerAppDelegate 191 | NSObject 192 | 193 | YES 194 | 195 | YES 196 | viewController 197 | window 198 | 199 | 200 | YES 201 | SSLocationManagerViewController 202 | UIWindow 203 | 204 | 205 | 206 | YES 207 | 208 | YES 209 | viewController 210 | window 211 | 212 | 213 | YES 214 | 215 | viewController 216 | SSLocationManagerViewController 217 | 218 | 219 | window 220 | UIWindow 221 | 222 | 223 | 224 | 225 | IBProjectSource 226 | Classes/SSLocationManagerAppDelegate.h 227 | 228 | 229 | 230 | SSLocationManagerAppDelegate 231 | NSObject 232 | 233 | IBUserSource 234 | 235 | 236 | 237 | 238 | SSLocationManagerViewController 239 | UIViewController 240 | 241 | IBProjectSource 242 | Classes/SSLocationManagerViewController.h 243 | 244 | 245 | 246 | 247 | YES 248 | 249 | NSObject 250 | 251 | IBFrameworkSource 252 | Foundation.framework/Headers/NSError.h 253 | 254 | 255 | 256 | NSObject 257 | 258 | IBFrameworkSource 259 | Foundation.framework/Headers/NSFileManager.h 260 | 261 | 262 | 263 | NSObject 264 | 265 | IBFrameworkSource 266 | Foundation.framework/Headers/NSKeyValueCoding.h 267 | 268 | 269 | 270 | NSObject 271 | 272 | IBFrameworkSource 273 | Foundation.framework/Headers/NSKeyValueObserving.h 274 | 275 | 276 | 277 | NSObject 278 | 279 | IBFrameworkSource 280 | Foundation.framework/Headers/NSKeyedArchiver.h 281 | 282 | 283 | 284 | NSObject 285 | 286 | IBFrameworkSource 287 | Foundation.framework/Headers/NSObject.h 288 | 289 | 290 | 291 | NSObject 292 | 293 | IBFrameworkSource 294 | Foundation.framework/Headers/NSRunLoop.h 295 | 296 | 297 | 298 | NSObject 299 | 300 | IBFrameworkSource 301 | Foundation.framework/Headers/NSThread.h 302 | 303 | 304 | 305 | NSObject 306 | 307 | IBFrameworkSource 308 | Foundation.framework/Headers/NSURL.h 309 | 310 | 311 | 312 | NSObject 313 | 314 | IBFrameworkSource 315 | Foundation.framework/Headers/NSURLConnection.h 316 | 317 | 318 | 319 | NSObject 320 | 321 | IBFrameworkSource 322 | UIKit.framework/Headers/UIAccessibility.h 323 | 324 | 325 | 326 | NSObject 327 | 328 | IBFrameworkSource 329 | UIKit.framework/Headers/UINibLoading.h 330 | 331 | 332 | 333 | NSObject 334 | 335 | IBFrameworkSource 336 | UIKit.framework/Headers/UIResponder.h 337 | 338 | 339 | 340 | UIApplication 341 | UIResponder 342 | 343 | IBFrameworkSource 344 | UIKit.framework/Headers/UIApplication.h 345 | 346 | 347 | 348 | UIResponder 349 | NSObject 350 | 351 | 352 | 353 | UISearchBar 354 | UIView 355 | 356 | IBFrameworkSource 357 | UIKit.framework/Headers/UISearchBar.h 358 | 359 | 360 | 361 | UISearchDisplayController 362 | NSObject 363 | 364 | IBFrameworkSource 365 | UIKit.framework/Headers/UISearchDisplayController.h 366 | 367 | 368 | 369 | UIView 370 | 371 | IBFrameworkSource 372 | UIKit.framework/Headers/UITextField.h 373 | 374 | 375 | 376 | UIView 377 | UIResponder 378 | 379 | IBFrameworkSource 380 | UIKit.framework/Headers/UIView.h 381 | 382 | 383 | 384 | UIViewController 385 | 386 | IBFrameworkSource 387 | UIKit.framework/Headers/UINavigationController.h 388 | 389 | 390 | 391 | UIViewController 392 | 393 | IBFrameworkSource 394 | UIKit.framework/Headers/UIPopoverController.h 395 | 396 | 397 | 398 | UIViewController 399 | 400 | IBFrameworkSource 401 | UIKit.framework/Headers/UISplitViewController.h 402 | 403 | 404 | 405 | UIViewController 406 | 407 | IBFrameworkSource 408 | UIKit.framework/Headers/UITabBarController.h 409 | 410 | 411 | 412 | UIViewController 413 | UIResponder 414 | 415 | IBFrameworkSource 416 | UIKit.framework/Headers/UIViewController.h 417 | 418 | 419 | 420 | UIWindow 421 | UIView 422 | 423 | IBFrameworkSource 424 | UIKit.framework/Headers/UIWindow.h 425 | 426 | 427 | 428 | 429 | 0 430 | IBCocoaTouchFramework 431 | 432 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 433 | 434 | 435 | 436 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 437 | 438 | 439 | YES 440 | SSLocationManager.xcodeproj 441 | 3 442 | 112 443 | 444 | 445 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SSLocationManager is a compact obj-c library written for iOS for obtaining detailed location information using CoreLocation and Yahoo! PlaceFinder API. 2 | 3 | To find out more here on how to use it: 4 | http://www.ardalahmet.com/2011/05/27/sslocationmanager/ 5 | 6 | For any questions and suggestions contact me at: 7 | http://twitter.com/ardalahmet 8 | or 9 | ardalahmet(at)gmail.com 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"). 12 | See LICENSE.txt or visit http://www.apache.org/licenses/LICENSE-2.0 for more information. 13 | 14 | 15 | SSLocationManager Diagram: 16 | 17 | ![SSLocationManager Diagram](http://farm8.staticflickr.com/7173/6838085971_d89756f387_z.jpg) 18 | 19 | 20 | SSLocationManager Demo App Screenshot: 21 | 22 | ![SSLocationManager Demo App Screenshot](http://farm8.staticflickr.com/7148/6838087679_2080990744_z.jpg) 23 | -------------------------------------------------------------------------------- /SSLocationManager-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 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 | -------------------------------------------------------------------------------- /SSLocationManager.xcodeproj/ardalahmet.pbxuser: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | 1D3623240D0F684500981E51 /* SSLocationManagerAppDelegate.h */ = { 4 | uiCtxt = { 5 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 6 | sepNavSelRange = "{0, 0}"; 7 | sepNavVisRange = "{0, 540}"; 8 | }; 9 | }; 10 | 1D3623250D0F684500981E51 /* SSLocationManagerAppDelegate.m */ = { 11 | uiCtxt = { 12 | sepNavIntBoundsRect = "{{0, 0}, {2523, 1476}}"; 13 | sepNavSelRange = "{42, 17}"; 14 | sepNavVisRange = "{0, 1933}"; 15 | }; 16 | }; 17 | 1D6058900D05DD3D006BFB54 /* SSLocationManager */ = { 18 | activeExec = 0; 19 | executables = ( 20 | 592F0BB2138BE993002A3967 /* SSLocationManager */, 21 | ); 22 | }; 23 | 28D7ACF60DDB3853001CB0EB /* SSLocationManagerViewController.h */ = { 24 | uiCtxt = { 25 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 26 | sepNavSelRange = "{557, 0}"; 27 | sepNavVisRange = "{0, 557}"; 28 | }; 29 | }; 30 | 28D7ACF70DDB3853001CB0EB /* SSLocationManagerViewController.m */ = { 31 | uiCtxt = { 32 | sepNavFolds = "{\n c = (\n {\n r = \"{511, 149}\";\n s = 0;\n },\n {\n r = \"{686, 50}\";\n s = 0;\n },\n {\n r = \"{1107, 33}\";\n s = 0;\n },\n {\n r = \"{1165, 58}\";\n s = 0;\n },\n {\n r = \"{1320, 68}\";\n s = 0;\n },\n {\n r = \"{1425, 38}\";\n s = 0;\n },\n {\n r = \"{1490, 28}\";\n s = 0;\n },\n {\n r = \"{1539, 78}\";\n s = 0;\n },\n {\n r = \"{1802, 196}\";\n s = 0;\n },\n {\n r = \"{2095, 289}\";\n s = 0;\n }\n );\n r = \"{0, 2392}\";\n s = 0;\n}"; 33 | sepNavIntBoundsRect = "{{0, 0}, {1510, 1260}}"; 34 | sepNavSelRange = "{803, 65}"; 35 | sepNavVisRange = "{285, 1026}"; 36 | }; 37 | }; 38 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 39 | activeBuildConfigurationName = Debug; 40 | activeExecutable = 592F0BB2138BE993002A3967 /* SSLocationManager */; 41 | activeSDKPreference = iphoneos4.2; 42 | activeTarget = 1D6058900D05DD3D006BFB54 /* SSLocationManager */; 43 | addToTargets = ( 44 | 1D6058900D05DD3D006BFB54 /* SSLocationManager */, 45 | ); 46 | codeSenseManager = 592F0BC4138BE9B3002A3967 /* Code sense */; 47 | executables = ( 48 | 592F0BB2138BE993002A3967 /* SSLocationManager */, 49 | ); 50 | perUserDictionary = { 51 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { 52 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 53 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 54 | PBXFileTableDataSourceColumnWidthsKey = ( 55 | 20, 56 | 1332, 57 | 20, 58 | 48, 59 | 43, 60 | 43, 61 | 20, 62 | ); 63 | PBXFileTableDataSourceColumnsKey = ( 64 | PBXFileDataSource_FiletypeID, 65 | PBXFileDataSource_Filename_ColumnID, 66 | PBXFileDataSource_Built_ColumnID, 67 | PBXFileDataSource_ObjectSize_ColumnID, 68 | PBXFileDataSource_Errors_ColumnID, 69 | PBXFileDataSource_Warnings_ColumnID, 70 | PBXFileDataSource_Target_ColumnID, 71 | ); 72 | }; 73 | PBXPerProjectTemplateStateSaveDate = 331560410; 74 | PBXWorkspaceStateSaveDate = 331560410; 75 | }; 76 | perUserProjectItems = { 77 | 598954D113C336C000DDE56D /* PBXTextBookmark */ = 598954D113C336C000DDE56D /* PBXTextBookmark */; 78 | 598954D213C336C000DDE56D /* PBXTextBookmark */ = 598954D213C336C000DDE56D /* PBXTextBookmark */; 79 | 598954D313C336C000DDE56D /* PBXTextBookmark */ = 598954D313C336C000DDE56D /* PBXTextBookmark */; 80 | 598954D413C336C000DDE56D /* PBXTextBookmark */ = 598954D413C336C000DDE56D /* PBXTextBookmark */; 81 | 598954D513C336C000DDE56D /* PBXTextBookmark */ = 598954D513C336C000DDE56D /* PBXTextBookmark */; 82 | 598954D613C336C000DDE56D /* PBXTextBookmark */ = 598954D613C336C000DDE56D /* PBXTextBookmark */; 83 | 598954D713C336C000DDE56D /* PBXTextBookmark */ = 598954D713C336C000DDE56D /* PBXTextBookmark */; 84 | 598954D813C336C000DDE56D /* PBXTextBookmark */ = 598954D813C336C000DDE56D /* PBXTextBookmark */; 85 | 598954D913C336C000DDE56D /* PBXTextBookmark */ = 598954D913C336C000DDE56D /* PBXTextBookmark */; 86 | 598954DA13C336C000DDE56D /* PBXTextBookmark */ = 598954DA13C336C000DDE56D /* PBXTextBookmark */; 87 | 598954DB13C336C000DDE56D /* PBXTextBookmark */ = 598954DB13C336C000DDE56D /* PBXTextBookmark */; 88 | 598954ED13C3381700DDE56D /* PBXTextBookmark */ = 598954ED13C3381700DDE56D /* PBXTextBookmark */; 89 | 5990E1DA138F812F006B993C /* PBXTextBookmark */ = 5990E1DA138F812F006B993C /* PBXTextBookmark */; 90 | 5990E1DB138F812F006B993C /* PBXTextBookmark */ = 5990E1DB138F812F006B993C /* PBXTextBookmark */; 91 | 5990E1DC138F812F006B993C /* PBXTextBookmark */ = 5990E1DC138F812F006B993C /* PBXTextBookmark */; 92 | 5990E1DD138F812F006B993C /* PBXTextBookmark */ = 5990E1DD138F812F006B993C /* PBXTextBookmark */; 93 | 5990E1DE138F812F006B993C /* PBXTextBookmark */ = 5990E1DE138F812F006B993C /* PBXTextBookmark */; 94 | 5990E1DF138F812F006B993C /* PBXTextBookmark */ = 5990E1DF138F812F006B993C /* PBXTextBookmark */; 95 | 5990E1E0138F812F006B993C /* PBXTextBookmark */ = 5990E1E0138F812F006B993C /* PBXTextBookmark */; 96 | 5990E212138FBC0E006B993C /* PBXTextBookmark */ = 5990E212138FBC0E006B993C /* PBXTextBookmark */; 97 | 5990E213138FBC0E006B993C /* PBXTextBookmark */ = 5990E213138FBC0E006B993C /* PBXTextBookmark */; 98 | 59D1255D138D164800D9EFC5 /* PBXTextBookmark */ = 59D1255D138D164800D9EFC5 /* PBXTextBookmark */; 99 | 59D125A3138D1FE900D9EFC5 /* PBXTextBookmark */ = 59D125A3138D1FE900D9EFC5 /* PBXTextBookmark */; 100 | 59D125D9138D293000D9EFC5 /* PBXTextBookmark */ = 59D125D9138D293000D9EFC5 /* PBXTextBookmark */; 101 | 59D125E2138D293000D9EFC5 /* PBXTextBookmark */ = 59D125E2138D293000D9EFC5 /* PBXTextBookmark */; 102 | 59D125FE138D29BC00D9EFC5 /* PlistBookmark */ = 59D125FE138D29BC00D9EFC5 /* PlistBookmark */; 103 | }; 104 | sourceControlManager = 592F0BC3138BE9B3002A3967 /* Source Control */; 105 | userBuildSettings = { 106 | }; 107 | }; 108 | 592F0BB2138BE993002A3967 /* SSLocationManager */ = { 109 | isa = PBXExecutable; 110 | activeArgIndices = ( 111 | ); 112 | argumentStrings = ( 113 | ); 114 | autoAttachOnCrash = 1; 115 | breakpointsEnabled = 0; 116 | configStateDict = { 117 | }; 118 | customDataFormattersEnabled = 1; 119 | dataTipCustomDataFormattersEnabled = 1; 120 | dataTipShowTypeColumn = 1; 121 | dataTipSortType = 0; 122 | debuggerPlugin = GDBDebugging; 123 | disassemblyDisplayState = 0; 124 | dylibVariantSuffix = ""; 125 | enableDebugStr = 1; 126 | environmentEntries = ( 127 | ); 128 | executableSystemSymbolLevel = 0; 129 | executableUserSymbolLevel = 0; 130 | libgmallocEnabled = 0; 131 | name = SSLocationManager; 132 | savedGlobals = { 133 | }; 134 | showTypeColumn = 0; 135 | sourceDirectories = ( 136 | ); 137 | }; 138 | 592F0BC3138BE9B3002A3967 /* Source Control */ = { 139 | isa = PBXSourceControlManager; 140 | fallbackIsa = XCSourceControlManager; 141 | isSCMEnabled = 0; 142 | scmConfiguration = { 143 | repositoryNamesForRoots = { 144 | "" = ""; 145 | }; 146 | }; 147 | }; 148 | 592F0BC4138BE9B3002A3967 /* Code sense */ = { 149 | isa = PBXCodeSenseManager; 150 | indexTemplatePath = ""; 151 | }; 152 | 592F0BDB138BECD4002A3967 /* NSObject+Helpers.h */ = { 153 | uiCtxt = { 154 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 155 | sepNavSelRange = "{350, 0}"; 156 | sepNavVisRange = "{0, 350}"; 157 | }; 158 | }; 159 | 592F0BDC138BECD4002A3967 /* NSObject+Helpers.m */ = { 160 | uiCtxt = { 161 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 162 | sepNavSelRange = "{519, 0}"; 163 | sepNavVisRange = "{0, 519}"; 164 | }; 165 | }; 166 | 592F0BF8138BED4A002A3967 /* MulticastDelegate.h */ = { 167 | uiCtxt = { 168 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 169 | sepNavSelRange = "{260, 0}"; 170 | sepNavVisRange = "{0, 804}"; 171 | }; 172 | }; 173 | 592F0BF9138BED4A002A3967 /* MulticastDelegate.m */ = { 174 | uiCtxt = { 175 | sepNavIntBoundsRect = "{{0, 0}, {1510, 7596}}"; 176 | sepNavSelRange = "{406, 0}"; 177 | sepNavVisRange = "{0, 1830}"; 178 | }; 179 | }; 180 | 592F0C19138BEF48002A3967 /* UIHelpers.h */ = { 181 | uiCtxt = { 182 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 183 | sepNavSelRange = "{458, 0}"; 184 | sepNavVisRange = "{0, 458}"; 185 | }; 186 | }; 187 | 592F0C1A138BEF48002A3967 /* UIHelpers.m */ = { 188 | uiCtxt = { 189 | sepNavFolds = "{\n c = (\n {\n r = \"{370, 356}\";\n s = 0;\n },\n {\n r = \"{779, 71}\";\n s = 0;\n },\n {\n r = \"{923, 71}\";\n s = 0;\n }\n );\n r = \"{0, 1005}\";\n s = 0;\n}"; 190 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 191 | sepNavSelRange = "{510, 0}"; 192 | sepNavVisRange = "{0, 510}"; 193 | }; 194 | }; 195 | 592F0C29138BF0E8002A3967 /* NSString+Helpers.h */ = { 196 | uiCtxt = { 197 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 198 | sepNavSelRange = "{327, 0}"; 199 | sepNavVisRange = "{0, 327}"; 200 | }; 201 | }; 202 | 592F0C2A138BF0E8002A3967 /* NSString+Helpers.m */ = { 203 | uiCtxt = { 204 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 205 | sepNavSelRange = "{508, 0}"; 206 | sepNavVisRange = "{0, 508}"; 207 | }; 208 | }; 209 | 598954D113C336C000DDE56D /* PBXTextBookmark */ = { 210 | isa = PBXTextBookmark; 211 | fRef = 59D125F4138D298E00D9EFC5 /* SSWebRequest.m */; 212 | name = "SSWebRequest.m: 16"; 213 | rLen = 0; 214 | rLoc = 568; 215 | rType = 0; 216 | vrLen = 1630; 217 | vrLoc = 0; 218 | }; 219 | 598954D213C336C000DDE56D /* PBXTextBookmark */ = { 220 | isa = PBXTextBookmark; 221 | fRef = 59D125F5138D298E00D9EFC5 /* SSWebRequestDelegate.h */; 222 | name = "SSWebRequestDelegate.h: 15"; 223 | rLen = 0; 224 | rLoc = 569; 225 | rType = 0; 226 | vrLen = 1095; 227 | vrLoc = 0; 228 | }; 229 | 598954D313C336C000DDE56D /* PBXTextBookmark */ = { 230 | isa = PBXTextBookmark; 231 | fRef = 59D125F6138D298E00D9EFC5 /* SSWebRequestParams.h */; 232 | name = "SSWebRequestParams.h: 15"; 233 | rLen = 0; 234 | rLoc = 569; 235 | rType = 0; 236 | vrLen = 1018; 237 | vrLoc = 0; 238 | }; 239 | 598954D413C336C000DDE56D /* PBXTextBookmark */ = { 240 | isa = PBXTextBookmark; 241 | fRef = 59D125F7138D298E00D9EFC5 /* SSWebRequestParams.m */; 242 | name = "SSWebRequestParams.m: 15"; 243 | rLen = 0; 244 | rLoc = 569; 245 | rType = 0; 246 | vrLen = 1581; 247 | vrLoc = 0; 248 | }; 249 | 598954D513C336C000DDE56D /* PBXTextBookmark */ = { 250 | isa = PBXTextBookmark; 251 | fRef = 59D125E9138D298500D9EFC5 /* SSLocationManager.h */; 252 | name = "SSLocationManager.h: 2"; 253 | rLen = 0; 254 | rLoc = 1; 255 | rType = 0; 256 | vrLen = 1554; 257 | vrLoc = 0; 258 | }; 259 | 598954D613C336C000DDE56D /* PBXTextBookmark */ = { 260 | isa = PBXTextBookmark; 261 | fRef = 59D125EA138D298500D9EFC5 /* SSLocationManager.m */; 262 | name = "SSLocationManager.m: 2"; 263 | rLen = 0; 264 | rLoc = 1; 265 | rType = 0; 266 | vrLen = 2156; 267 | vrLoc = 0; 268 | }; 269 | 598954D713C336C000DDE56D /* PBXTextBookmark */ = { 270 | isa = PBXTextBookmark; 271 | fRef = 59D125EB138D298500D9EFC5 /* YahooPlaceData.h */; 272 | name = "YahooPlaceData.h: 2"; 273 | rLen = 0; 274 | rLoc = 2; 275 | rType = 0; 276 | vrLen = 1370; 277 | vrLoc = 0; 278 | }; 279 | 598954D813C336C000DDE56D /* PBXTextBookmark */ = { 280 | isa = PBXTextBookmark; 281 | fRef = 59D125EC138D298500D9EFC5 /* YahooPlaceData.m */; 282 | name = "YahooPlaceData.m: 15"; 283 | rLen = 0; 284 | rLoc = 569; 285 | rType = 0; 286 | vrLen = 1311; 287 | vrLoc = 0; 288 | }; 289 | 598954D913C336C000DDE56D /* PBXTextBookmark */ = { 290 | isa = PBXTextBookmark; 291 | fRef = 59D125ED138D298500D9EFC5 /* YahooPlaceFinder.h */; 292 | name = "YahooPlaceFinder.h: 15"; 293 | rLen = 0; 294 | rLoc = 569; 295 | rType = 0; 296 | vrLen = 1695; 297 | vrLoc = 0; 298 | }; 299 | 598954DA13C336C000DDE56D /* PBXTextBookmark */ = { 300 | isa = PBXTextBookmark; 301 | fRef = 59D125F3138D298E00D9EFC5 /* SSWebRequest.h */; 302 | name = "SSWebRequest.h: 16"; 303 | rLen = 0; 304 | rLoc = 568; 305 | rType = 0; 306 | vrLen = 1458; 307 | vrLoc = 0; 308 | }; 309 | 598954DB13C336C000DDE56D /* PBXTextBookmark */ = { 310 | isa = PBXTextBookmark; 311 | fRef = 59D125EE138D298500D9EFC5 /* YahooPlaceFinder.m */; 312 | name = "YahooPlaceFinder.m: 15"; 313 | rLen = 0; 314 | rLoc = 569; 315 | rType = 0; 316 | vrLen = 1616; 317 | vrLoc = 0; 318 | }; 319 | 598954ED13C3381700DDE56D /* PBXTextBookmark */ = { 320 | isa = PBXTextBookmark; 321 | fRef = 59D125EE138D298500D9EFC5 /* YahooPlaceFinder.m */; 322 | name = "YahooPlaceFinder.m: 122"; 323 | rLen = 0; 324 | rLoc = 3763; 325 | rType = 0; 326 | vrLen = 1921; 327 | vrLoc = 0; 328 | }; 329 | 5990E1DA138F812F006B993C /* PBXTextBookmark */ = { 330 | isa = PBXTextBookmark; 331 | fRef = 592F0C29138BF0E8002A3967 /* NSString+Helpers.h */; 332 | name = "NSString+Helpers.h: 15"; 333 | rLen = 0; 334 | rLoc = 327; 335 | rType = 0; 336 | vrLen = 327; 337 | vrLoc = 0; 338 | }; 339 | 5990E1DB138F812F006B993C /* PBXTextBookmark */ = { 340 | isa = PBXTextBookmark; 341 | fRef = 592F0C2A138BF0E8002A3967 /* NSString+Helpers.m */; 342 | name = "NSString+Helpers.m: 28"; 343 | rLen = 0; 344 | rLoc = 508; 345 | rType = 0; 346 | vrLen = 508; 347 | vrLoc = 0; 348 | }; 349 | 5990E1DC138F812F006B993C /* PBXTextBookmark */ = { 350 | isa = PBXTextBookmark; 351 | fRef = 592F0C19138BEF48002A3967 /* UIHelpers.h */; 352 | name = "UIHelpers.h: 20"; 353 | rLen = 0; 354 | rLoc = 458; 355 | rType = 0; 356 | vrLen = 458; 357 | vrLoc = 0; 358 | }; 359 | 5990E1DD138F812F006B993C /* PBXTextBookmark */ = { 360 | isa = PBXTextBookmark; 361 | fRef = 592F0C1A138BEF48002A3967 /* UIHelpers.m */; 362 | name = "UIHelpers.m: 38"; 363 | rLen = 0; 364 | rLoc = 1005; 365 | rType = 0; 366 | vrLen = 1005; 367 | vrLoc = 0; 368 | }; 369 | 5990E1DE138F812F006B993C /* PBXTextBookmark */ = { 370 | isa = PBXTextBookmark; 371 | fRef = 592F0BF8138BED4A002A3967 /* MulticastDelegate.h */; 372 | name = "MulticastDelegate.h: 11"; 373 | rLen = 0; 374 | rLoc = 260; 375 | rType = 0; 376 | vrLen = 804; 377 | vrLoc = 0; 378 | }; 379 | 5990E1DF138F812F006B993C /* PBXTextBookmark */ = { 380 | isa = PBXTextBookmark; 381 | fRef = 592F0BDB138BECD4002A3967 /* NSObject+Helpers.h */; 382 | name = "NSObject+Helpers.h: 18"; 383 | rLen = 0; 384 | rLoc = 350; 385 | rType = 0; 386 | vrLen = 350; 387 | vrLoc = 0; 388 | }; 389 | 5990E1E0138F812F006B993C /* PBXTextBookmark */ = { 390 | isa = PBXTextBookmark; 391 | fRef = 592F0BDC138BECD4002A3967 /* NSObject+Helpers.m */; 392 | name = "NSObject+Helpers.m: 29"; 393 | rLen = 0; 394 | rLoc = 519; 395 | rType = 0; 396 | vrLen = 519; 397 | vrLoc = 0; 398 | }; 399 | 5990E212138FBC0E006B993C /* PBXTextBookmark */ = { 400 | isa = PBXTextBookmark; 401 | fRef = 28D7ACF60DDB3853001CB0EB /* SSLocationManagerViewController.h */; 402 | name = "SSLocationManagerViewController.h: 25"; 403 | rLen = 0; 404 | rLoc = 557; 405 | rType = 0; 406 | vrLen = 557; 407 | vrLoc = 0; 408 | }; 409 | 5990E213138FBC0E006B993C /* PBXTextBookmark */ = { 410 | isa = PBXTextBookmark; 411 | fRef = 28D7ACF70DDB3853001CB0EB /* SSLocationManagerViewController.m */; 412 | name = "SSLocationManagerViewController.m: 48"; 413 | rLen = 65; 414 | rLoc = 1000; 415 | rType = 0; 416 | vrLen = 1715; 417 | vrLoc = 285; 418 | }; 419 | 59D1255D138D164800D9EFC5 /* PBXTextBookmark */ = { 420 | isa = PBXTextBookmark; 421 | fRef = 59D1255E138D164800D9EFC5 /* NSURLConnection.h */; 422 | name = "NSURLConnection.h: 217"; 423 | rLen = 23; 424 | rLoc = 10067; 425 | rType = 0; 426 | vrLen = 3067; 427 | vrLoc = 10093; 428 | }; 429 | 59D1255E138D164800D9EFC5 /* NSURLConnection.h */ = { 430 | isa = PBXFileReference; 431 | lastKnownFileType = sourcecode.c.h; 432 | name = NSURLConnection.h; 433 | path = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLConnection.h; 434 | sourceTree = ""; 435 | }; 436 | 59D125A3138D1FE900D9EFC5 /* PBXTextBookmark */ = { 437 | isa = PBXTextBookmark; 438 | fRef = 1D3623250D0F684500981E51 /* SSLocationManagerAppDelegate.m */; 439 | name = "SSLocationManagerAppDelegate.m: 3"; 440 | rLen = 17; 441 | rLoc = 42; 442 | rType = 0; 443 | vrLen = 1933; 444 | vrLoc = 0; 445 | }; 446 | 59D125D9138D293000D9EFC5 /* PBXTextBookmark */ = { 447 | isa = PBXTextBookmark; 448 | fRef = 1D3623240D0F684500981E51 /* SSLocationManagerAppDelegate.h */; 449 | name = "SSLocationManagerAppDelegate.h: 1"; 450 | rLen = 0; 451 | rLoc = 0; 452 | rType = 0; 453 | vrLen = 540; 454 | vrLoc = 0; 455 | }; 456 | 59D125E2138D293000D9EFC5 /* PBXTextBookmark */ = { 457 | isa = PBXTextBookmark; 458 | fRef = 592F0BF9138BED4A002A3967 /* MulticastDelegate.m */; 459 | name = "MulticastDelegate.m: 13"; 460 | rLen = 0; 461 | rLoc = 406; 462 | rType = 0; 463 | vrLen = 1830; 464 | vrLoc = 0; 465 | }; 466 | 59D125E9138D298500D9EFC5 /* SSLocationManager.h */ = { 467 | uiCtxt = { 468 | sepNavIntBoundsRect = "{{0, 0}, {1510, 1170}}"; 469 | sepNavSelRange = "{1, 0}"; 470 | sepNavVisRange = "{0, 1554}"; 471 | }; 472 | }; 473 | 59D125EA138D298500D9EFC5 /* SSLocationManager.m */ = { 474 | uiCtxt = { 475 | sepNavFolds = "{\n c = (\n {\n r = \"{876, 45}\";\n s = 0;\n },\n {\n r = \"{962, 48}\";\n s = 0;\n },\n {\n r = \"{1052, 345}\";\n s = 0;\n },\n {\n r = \"{1461, 435}\";\n s = 0;\n },\n {\n r = \"{1921, 216}\";\n s = 0;\n },\n {\n r = \"{2361, 757}\";\n s = 0;\n },\n {\n r = \"{3210, 330}\";\n s = 0;\n },\n {\n r = \"{3707, 250}\";\n s = 0;\n },\n {\n r = \"{4039, 189}\";\n s = 0;\n }\n );\n r = \"{0, 4236}\";\n s = 0;\n}"; 476 | sepNavIntBoundsRect = "{{0, 0}, {1510, 1296}}"; 477 | sepNavSelRange = "{1, 0}"; 478 | sepNavVisRange = "{0, 1072}"; 479 | }; 480 | }; 481 | 59D125EB138D298500D9EFC5 /* YahooPlaceData.h */ = { 482 | uiCtxt = { 483 | sepNavIntBoundsRect = "{{0, 0}, {1510, 1836}}"; 484 | sepNavSelRange = "{2, 0}"; 485 | sepNavVisRange = "{0, 1370}"; 486 | }; 487 | }; 488 | 59D125EC138D298500D9EFC5 /* YahooPlaceData.m */ = { 489 | uiCtxt = { 490 | sepNavIntBoundsRect = "{{0, 0}, {1510, 3294}}"; 491 | sepNavSelRange = "{569, 0}"; 492 | sepNavVisRange = "{0, 1311}"; 493 | }; 494 | }; 495 | 59D125ED138D298500D9EFC5 /* YahooPlaceFinder.h */ = { 496 | uiCtxt = { 497 | sepNavIntBoundsRect = "{{0, 0}, {1510, 1134}}"; 498 | sepNavSelRange = "{569, 0}"; 499 | sepNavVisRange = "{0, 1695}"; 500 | }; 501 | }; 502 | 59D125EE138D298500D9EFC5 /* YahooPlaceFinder.m */ = { 503 | uiCtxt = { 504 | sepNavFolds = "{\n c = (\n {\n r = \"{1529, 83}\";\n s = 0;\n },\n {\n r = \"{1631, 43}\";\n s = 0;\n },\n {\n r = \"{1745, 173}\";\n s = 0;\n },\n {\n r = \"{1942, 24}\";\n s = 0;\n },\n {\n r = \"{2141, 1117}\";\n s = 0;\n },\n {\n r = \"{3345, 103}\";\n s = 0;\n },\n {\n r = \"{3540, 220}\";\n s = 0;\n },\n {\n r = \"{3850, 1056}\";\n s = 0;\n },\n {\n r = \"{4993, 326}\";\n s = 0;\n }\n );\n r = \"{0, 5330}\";\n s = 0;\n}"; 505 | sepNavIntBoundsRect = "{{0, 0}, {1510, 1458}}"; 506 | sepNavSelRange = "{2007, 0}"; 507 | sepNavVisRange = "{0, 1625}"; 508 | }; 509 | }; 510 | 59D125F3138D298E00D9EFC5 /* SSWebRequest.h */ = { 511 | uiCtxt = { 512 | sepNavIntBoundsRect = "{{0, 0}, {1510, 1746}}"; 513 | sepNavSelRange = "{568, 0}"; 514 | sepNavVisRange = "{0, 1458}"; 515 | }; 516 | }; 517 | 59D125F4138D298E00D9EFC5 /* SSWebRequest.m */ = { 518 | uiCtxt = { 519 | sepNavIntBoundsRect = "{{0, 0}, {1510, 4392}}"; 520 | sepNavSelRange = "{568, 0}"; 521 | sepNavVisRange = "{0, 1630}"; 522 | }; 523 | }; 524 | 59D125F5138D298E00D9EFC5 /* SSWebRequestDelegate.h */ = { 525 | uiCtxt = { 526 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 527 | sepNavSelRange = "{569, 0}"; 528 | sepNavVisRange = "{0, 1095}"; 529 | }; 530 | }; 531 | 59D125F6138D298E00D9EFC5 /* SSWebRequestParams.h */ = { 532 | uiCtxt = { 533 | sepNavIntBoundsRect = "{{0, 0}, {1510, 921}}"; 534 | sepNavSelRange = "{569, 0}"; 535 | sepNavVisRange = "{0, 1018}"; 536 | }; 537 | }; 538 | 59D125F7138D298E00D9EFC5 /* SSWebRequestParams.m */ = { 539 | uiCtxt = { 540 | sepNavIntBoundsRect = "{{0, 0}, {1510, 1206}}"; 541 | sepNavSelRange = "{569, 0}"; 542 | sepNavVisRange = "{0, 1581}"; 543 | }; 544 | }; 545 | 59D125FE138D29BC00D9EFC5 /* PlistBookmark */ = { 546 | isa = PlistBookmark; 547 | fRef = 8D1107310486CEB800E47090 /* SSLocationManager-Info.plist */; 548 | fallbackIsa = PBXBookmark; 549 | isK = 0; 550 | kPath = ( 551 | ); 552 | name = "/Users/ardalahmet/Documents/SSLocationManager/SSLocationManager-Info.plist"; 553 | rLen = 0; 554 | rLoc = 9223372036854775808; 555 | }; 556 | } 557 | -------------------------------------------------------------------------------- /SSLocationManager.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* SSLocationManagerAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* SSLocationManagerAppDelegate.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 /* SSLocationManagerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* SSLocationManagerViewController.xib */; }; 16 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 17 | 28D7ACF80DDB3853001CB0EB /* SSLocationManagerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* SSLocationManagerViewController.m */; }; 18 | 592F0BEB138BECD4002A3967 /* NSObject+Helpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0BDC138BECD4002A3967 /* NSObject+Helpers.m */; }; 19 | 592F0BEC138BECD4002A3967 /* NSObject+SBJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0BE0138BECD4002A3967 /* NSObject+SBJSON.m */; }; 20 | 592F0BED138BECD4002A3967 /* NSString+SBJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0BE2138BECD4002A3967 /* NSString+SBJSON.m */; }; 21 | 592F0BEE138BECD4002A3967 /* SBJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0BE4138BECD4002A3967 /* SBJSON.m */; }; 22 | 592F0BEF138BECD4002A3967 /* SBJsonBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0BE6138BECD4002A3967 /* SBJsonBase.m */; }; 23 | 592F0BF0138BECD4002A3967 /* SBJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0BE8138BECD4002A3967 /* SBJsonParser.m */; }; 24 | 592F0BF1138BECD4002A3967 /* SBJsonWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0BEA138BECD4002A3967 /* SBJsonWriter.m */; }; 25 | 592F0BFA138BED4A002A3967 /* MulticastDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0BF9138BED4A002A3967 /* MulticastDelegate.m */; }; 26 | 592F0C1B138BEF48002A3967 /* UIHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0C1A138BEF48002A3967 /* UIHelpers.m */; }; 27 | 592F0C2B138BF0E8002A3967 /* NSString+Helpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 592F0C2A138BF0E8002A3967 /* NSString+Helpers.m */; }; 28 | 592F0C39138BF127002A3967 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 592F0C38138BF127002A3967 /* CoreLocation.framework */; }; 29 | 59D125EF138D298500D9EFC5 /* SSLocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D125EA138D298500D9EFC5 /* SSLocationManager.m */; }; 30 | 59D125F0138D298500D9EFC5 /* YahooPlaceData.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D125EC138D298500D9EFC5 /* YahooPlaceData.m */; }; 31 | 59D125F1138D298500D9EFC5 /* YahooPlaceFinder.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D125EE138D298500D9EFC5 /* YahooPlaceFinder.m */; }; 32 | 59D125F8138D298E00D9EFC5 /* SSWebRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D125F4138D298E00D9EFC5 /* SSWebRequest.m */; }; 33 | 59D125F9138D298E00D9EFC5 /* SSWebRequestParams.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D125F7138D298E00D9EFC5 /* SSWebRequestParams.m */; }; 34 | /* End PBXBuildFile section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 38 | 1D3623240D0F684500981E51 /* SSLocationManagerAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSLocationManagerAppDelegate.h; sourceTree = ""; }; 39 | 1D3623250D0F684500981E51 /* SSLocationManagerAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSLocationManagerAppDelegate.m; sourceTree = ""; }; 40 | 1D6058910D05DD3D006BFB54 /* SSLocationManager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SSLocationManager.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 42 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 43 | 2899E5210DE3E06400AC0155 /* SSLocationManagerViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SSLocationManagerViewController.xib; sourceTree = ""; }; 44 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 45 | 28D7ACF60DDB3853001CB0EB /* SSLocationManagerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSLocationManagerViewController.h; sourceTree = ""; }; 46 | 28D7ACF70DDB3853001CB0EB /* SSLocationManagerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSLocationManagerViewController.m; sourceTree = ""; }; 47 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | 32CA4F630368D1EE00C91783 /* SSLocationManager_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSLocationManager_Prefix.pch; sourceTree = ""; }; 49 | 592F0BDB138BECD4002A3967 /* NSObject+Helpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Helpers.h"; sourceTree = ""; }; 50 | 592F0BDC138BECD4002A3967 /* NSObject+Helpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Helpers.m"; sourceTree = ""; }; 51 | 592F0BDE138BECD4002A3967 /* JSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSON.h; sourceTree = ""; }; 52 | 592F0BDF138BECD4002A3967 /* NSObject+SBJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+SBJSON.h"; sourceTree = ""; }; 53 | 592F0BE0138BECD4002A3967 /* NSObject+SBJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+SBJSON.m"; sourceTree = ""; }; 54 | 592F0BE1138BECD4002A3967 /* NSString+SBJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+SBJSON.h"; sourceTree = ""; }; 55 | 592F0BE2138BECD4002A3967 /* NSString+SBJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+SBJSON.m"; sourceTree = ""; }; 56 | 592F0BE3138BECD4002A3967 /* SBJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJSON.h; sourceTree = ""; }; 57 | 592F0BE4138BECD4002A3967 /* SBJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJSON.m; sourceTree = ""; }; 58 | 592F0BE5138BECD4002A3967 /* SBJsonBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJsonBase.h; sourceTree = ""; }; 59 | 592F0BE6138BECD4002A3967 /* SBJsonBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJsonBase.m; sourceTree = ""; }; 60 | 592F0BE7138BECD4002A3967 /* SBJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJsonParser.h; sourceTree = ""; }; 61 | 592F0BE8138BECD4002A3967 /* SBJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJsonParser.m; sourceTree = ""; }; 62 | 592F0BE9138BECD4002A3967 /* SBJsonWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJsonWriter.h; sourceTree = ""; }; 63 | 592F0BEA138BECD4002A3967 /* SBJsonWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJsonWriter.m; sourceTree = ""; }; 64 | 592F0BF8138BED4A002A3967 /* MulticastDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MulticastDelegate.h; sourceTree = ""; }; 65 | 592F0BF9138BED4A002A3967 /* MulticastDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MulticastDelegate.m; sourceTree = ""; }; 66 | 592F0C19138BEF48002A3967 /* UIHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIHelpers.h; sourceTree = ""; }; 67 | 592F0C1A138BEF48002A3967 /* UIHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIHelpers.m; sourceTree = ""; }; 68 | 592F0C29138BF0E8002A3967 /* NSString+Helpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Helpers.h"; sourceTree = ""; }; 69 | 592F0C2A138BF0E8002A3967 /* NSString+Helpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Helpers.m"; sourceTree = ""; }; 70 | 592F0C38138BF127002A3967 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 71 | 59D125E9138D298500D9EFC5 /* SSLocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSLocationManager.h; sourceTree = ""; }; 72 | 59D125EA138D298500D9EFC5 /* SSLocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSLocationManager.m; sourceTree = ""; }; 73 | 59D125EB138D298500D9EFC5 /* YahooPlaceData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YahooPlaceData.h; sourceTree = ""; }; 74 | 59D125EC138D298500D9EFC5 /* YahooPlaceData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YahooPlaceData.m; sourceTree = ""; }; 75 | 59D125ED138D298500D9EFC5 /* YahooPlaceFinder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YahooPlaceFinder.h; sourceTree = ""; }; 76 | 59D125EE138D298500D9EFC5 /* YahooPlaceFinder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YahooPlaceFinder.m; sourceTree = ""; }; 77 | 59D125F3138D298E00D9EFC5 /* SSWebRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSWebRequest.h; sourceTree = ""; }; 78 | 59D125F4138D298E00D9EFC5 /* SSWebRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSWebRequest.m; sourceTree = ""; }; 79 | 59D125F5138D298E00D9EFC5 /* SSWebRequestDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSWebRequestDelegate.h; sourceTree = ""; }; 80 | 59D125F6138D298E00D9EFC5 /* SSWebRequestParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSWebRequestParams.h; sourceTree = ""; }; 81 | 59D125F7138D298E00D9EFC5 /* SSWebRequestParams.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSWebRequestParams.m; sourceTree = ""; }; 82 | 8D1107310486CEB800E47090 /* SSLocationManager-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SSLocationManager-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 83 | /* End PBXFileReference section */ 84 | 85 | /* Begin PBXFrameworksBuildPhase section */ 86 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 91 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 92 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 93 | 592F0C39138BF127002A3967 /* CoreLocation.framework in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | /* End PBXFrameworksBuildPhase section */ 98 | 99 | /* Begin PBXGroup section */ 100 | 080E96DDFE201D6D7F000001 /* Classes */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 592F0BC7138BEC7B002A3967 /* SSLocationManager */, 104 | 1D3623240D0F684500981E51 /* SSLocationManagerAppDelegate.h */, 105 | 1D3623250D0F684500981E51 /* SSLocationManagerAppDelegate.m */, 106 | 28D7ACF60DDB3853001CB0EB /* SSLocationManagerViewController.h */, 107 | 28D7ACF70DDB3853001CB0EB /* SSLocationManagerViewController.m */, 108 | ); 109 | path = Classes; 110 | sourceTree = ""; 111 | }; 112 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 1D6058910D05DD3D006BFB54 /* SSLocationManager.app */, 116 | ); 117 | name = Products; 118 | sourceTree = ""; 119 | }; 120 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 080E96DDFE201D6D7F000001 /* Classes */, 124 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 125 | 29B97317FDCFA39411CA2CEA /* Resources */, 126 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 127 | 19C28FACFE9D520D11CA2CBB /* Products */, 128 | ); 129 | name = CustomTemplate; 130 | sourceTree = ""; 131 | }; 132 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 32CA4F630368D1EE00C91783 /* SSLocationManager_Prefix.pch */, 136 | 29B97316FDCFA39411CA2CEA /* main.m */, 137 | ); 138 | name = "Other Sources"; 139 | sourceTree = ""; 140 | }; 141 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 2899E5210DE3E06400AC0155 /* SSLocationManagerViewController.xib */, 145 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */, 146 | 8D1107310486CEB800E47090 /* SSLocationManager-Info.plist */, 147 | ); 148 | name = Resources; 149 | sourceTree = ""; 150 | }; 151 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 155 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 156 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 157 | 592F0C38138BF127002A3967 /* CoreLocation.framework */, 158 | ); 159 | name = Frameworks; 160 | sourceTree = ""; 161 | }; 162 | 592F0BC7138BEC7B002A3967 /* SSLocationManager */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 592F0BDA138BECD4002A3967 /* Helpers */, 166 | 592F0BDD138BECD4002A3967 /* SBJSON */, 167 | 59D125E8138D298500D9EFC5 /* SSLocationManager */, 168 | 59D125F2138D298E00D9EFC5 /* SSWebRequest */, 169 | ); 170 | path = SSLocationManager; 171 | sourceTree = ""; 172 | }; 173 | 592F0BDA138BECD4002A3967 /* Helpers */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 592F0C29138BF0E8002A3967 /* NSString+Helpers.h */, 177 | 592F0C2A138BF0E8002A3967 /* NSString+Helpers.m */, 178 | 592F0C19138BEF48002A3967 /* UIHelpers.h */, 179 | 592F0C1A138BEF48002A3967 /* UIHelpers.m */, 180 | 592F0BF8138BED4A002A3967 /* MulticastDelegate.h */, 181 | 592F0BF9138BED4A002A3967 /* MulticastDelegate.m */, 182 | 592F0BDB138BECD4002A3967 /* NSObject+Helpers.h */, 183 | 592F0BDC138BECD4002A3967 /* NSObject+Helpers.m */, 184 | ); 185 | path = Helpers; 186 | sourceTree = ""; 187 | }; 188 | 592F0BDD138BECD4002A3967 /* SBJSON */ = { 189 | isa = PBXGroup; 190 | children = ( 191 | 592F0BDE138BECD4002A3967 /* JSON.h */, 192 | 592F0BDF138BECD4002A3967 /* NSObject+SBJSON.h */, 193 | 592F0BE0138BECD4002A3967 /* NSObject+SBJSON.m */, 194 | 592F0BE1138BECD4002A3967 /* NSString+SBJSON.h */, 195 | 592F0BE2138BECD4002A3967 /* NSString+SBJSON.m */, 196 | 592F0BE3138BECD4002A3967 /* SBJSON.h */, 197 | 592F0BE4138BECD4002A3967 /* SBJSON.m */, 198 | 592F0BE5138BECD4002A3967 /* SBJsonBase.h */, 199 | 592F0BE6138BECD4002A3967 /* SBJsonBase.m */, 200 | 592F0BE7138BECD4002A3967 /* SBJsonParser.h */, 201 | 592F0BE8138BECD4002A3967 /* SBJsonParser.m */, 202 | 592F0BE9138BECD4002A3967 /* SBJsonWriter.h */, 203 | 592F0BEA138BECD4002A3967 /* SBJsonWriter.m */, 204 | ); 205 | path = SBJSON; 206 | sourceTree = ""; 207 | }; 208 | 59D125E8138D298500D9EFC5 /* SSLocationManager */ = { 209 | isa = PBXGroup; 210 | children = ( 211 | 59D125E9138D298500D9EFC5 /* SSLocationManager.h */, 212 | 59D125EA138D298500D9EFC5 /* SSLocationManager.m */, 213 | 59D125EB138D298500D9EFC5 /* YahooPlaceData.h */, 214 | 59D125EC138D298500D9EFC5 /* YahooPlaceData.m */, 215 | 59D125ED138D298500D9EFC5 /* YahooPlaceFinder.h */, 216 | 59D125EE138D298500D9EFC5 /* YahooPlaceFinder.m */, 217 | ); 218 | path = SSLocationManager; 219 | sourceTree = ""; 220 | }; 221 | 59D125F2138D298E00D9EFC5 /* SSWebRequest */ = { 222 | isa = PBXGroup; 223 | children = ( 224 | 59D125F3138D298E00D9EFC5 /* SSWebRequest.h */, 225 | 59D125F4138D298E00D9EFC5 /* SSWebRequest.m */, 226 | 59D125F5138D298E00D9EFC5 /* SSWebRequestDelegate.h */, 227 | 59D125F6138D298E00D9EFC5 /* SSWebRequestParams.h */, 228 | 59D125F7138D298E00D9EFC5 /* SSWebRequestParams.m */, 229 | ); 230 | path = SSWebRequest; 231 | sourceTree = ""; 232 | }; 233 | /* End PBXGroup section */ 234 | 235 | /* Begin PBXNativeTarget section */ 236 | 1D6058900D05DD3D006BFB54 /* SSLocationManager */ = { 237 | isa = PBXNativeTarget; 238 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "SSLocationManager" */; 239 | buildPhases = ( 240 | 1D60588D0D05DD3D006BFB54 /* Resources */, 241 | 1D60588E0D05DD3D006BFB54 /* Sources */, 242 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 243 | ); 244 | buildRules = ( 245 | ); 246 | dependencies = ( 247 | ); 248 | name = SSLocationManager; 249 | productName = SSLocationManager; 250 | productReference = 1D6058910D05DD3D006BFB54 /* SSLocationManager.app */; 251 | productType = "com.apple.product-type.application"; 252 | }; 253 | /* End PBXNativeTarget section */ 254 | 255 | /* Begin PBXProject section */ 256 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 257 | isa = PBXProject; 258 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SSLocationManager" */; 259 | compatibilityVersion = "Xcode 3.1"; 260 | developmentRegion = English; 261 | hasScannedForEncodings = 1; 262 | knownRegions = ( 263 | English, 264 | Japanese, 265 | French, 266 | German, 267 | ); 268 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 269 | projectDirPath = ""; 270 | projectRoot = ""; 271 | targets = ( 272 | 1D6058900D05DD3D006BFB54 /* SSLocationManager */, 273 | ); 274 | }; 275 | /* End PBXProject section */ 276 | 277 | /* Begin PBXResourcesBuildPhase section */ 278 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 279 | isa = PBXResourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 283 | 2899E5220DE3E06400AC0155 /* SSLocationManagerViewController.xib in Resources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | /* End PBXResourcesBuildPhase section */ 288 | 289 | /* Begin PBXSourcesBuildPhase section */ 290 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 295 | 1D3623260D0F684500981E51 /* SSLocationManagerAppDelegate.m in Sources */, 296 | 28D7ACF80DDB3853001CB0EB /* SSLocationManagerViewController.m in Sources */, 297 | 592F0BEB138BECD4002A3967 /* NSObject+Helpers.m in Sources */, 298 | 592F0BEC138BECD4002A3967 /* NSObject+SBJSON.m in Sources */, 299 | 592F0BED138BECD4002A3967 /* NSString+SBJSON.m in Sources */, 300 | 592F0BEE138BECD4002A3967 /* SBJSON.m in Sources */, 301 | 592F0BEF138BECD4002A3967 /* SBJsonBase.m in Sources */, 302 | 592F0BF0138BECD4002A3967 /* SBJsonParser.m in Sources */, 303 | 592F0BF1138BECD4002A3967 /* SBJsonWriter.m in Sources */, 304 | 592F0BFA138BED4A002A3967 /* MulticastDelegate.m in Sources */, 305 | 592F0C1B138BEF48002A3967 /* UIHelpers.m in Sources */, 306 | 592F0C2B138BF0E8002A3967 /* NSString+Helpers.m in Sources */, 307 | 59D125EF138D298500D9EFC5 /* SSLocationManager.m in Sources */, 308 | 59D125F0138D298500D9EFC5 /* YahooPlaceData.m in Sources */, 309 | 59D125F1138D298500D9EFC5 /* YahooPlaceFinder.m in Sources */, 310 | 59D125F8138D298E00D9EFC5 /* SSWebRequest.m in Sources */, 311 | 59D125F9138D298E00D9EFC5 /* SSWebRequestParams.m in Sources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | /* End PBXSourcesBuildPhase section */ 316 | 317 | /* Begin XCBuildConfiguration section */ 318 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | ALWAYS_SEARCH_USER_PATHS = NO; 322 | COPY_PHASE_STRIP = NO; 323 | GCC_DYNAMIC_NO_PIC = NO; 324 | GCC_OPTIMIZATION_LEVEL = 0; 325 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 326 | GCC_PREFIX_HEADER = SSLocationManager_Prefix.pch; 327 | INFOPLIST_FILE = "SSLocationManager-Info.plist"; 328 | PRODUCT_NAME = SSLocationManager; 329 | }; 330 | name = Debug; 331 | }; 332 | 1D6058950D05DD3E006BFB54 /* Release */ = { 333 | isa = XCBuildConfiguration; 334 | buildSettings = { 335 | ALWAYS_SEARCH_USER_PATHS = NO; 336 | COPY_PHASE_STRIP = YES; 337 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 338 | GCC_PREFIX_HEADER = SSLocationManager_Prefix.pch; 339 | INFOPLIST_FILE = "SSLocationManager-Info.plist"; 340 | PRODUCT_NAME = SSLocationManager; 341 | VALIDATE_PRODUCT = YES; 342 | }; 343 | name = Release; 344 | }; 345 | C01FCF4F08A954540054247B /* Debug */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 349 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 350 | GCC_C_LANGUAGE_STANDARD = c99; 351 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | PREBINDING = NO; 354 | SDKROOT = iphoneos; 355 | }; 356 | name = Debug; 357 | }; 358 | C01FCF5008A954540054247B /* Release */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 362 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 363 | GCC_C_LANGUAGE_STANDARD = c99; 364 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 365 | GCC_WARN_UNUSED_VARIABLE = YES; 366 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 367 | PREBINDING = NO; 368 | SDKROOT = iphoneos; 369 | }; 370 | name = Release; 371 | }; 372 | /* End XCBuildConfiguration section */ 373 | 374 | /* Begin XCConfigurationList section */ 375 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "SSLocationManager" */ = { 376 | isa = XCConfigurationList; 377 | buildConfigurations = ( 378 | 1D6058940D05DD3E006BFB54 /* Debug */, 379 | 1D6058950D05DD3E006BFB54 /* Release */, 380 | ); 381 | defaultConfigurationIsVisible = 0; 382 | defaultConfigurationName = Release; 383 | }; 384 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SSLocationManager" */ = { 385 | isa = XCConfigurationList; 386 | buildConfigurations = ( 387 | C01FCF4F08A954540054247B /* Debug */, 388 | C01FCF5008A954540054247B /* Release */, 389 | ); 390 | defaultConfigurationIsVisible = 0; 391 | defaultConfigurationName = Release; 392 | }; 393 | /* End XCConfigurationList section */ 394 | }; 395 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 396 | } 397 | -------------------------------------------------------------------------------- /SSLocationManager_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SSLocationManager' target in the 'SSLocationManager' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SSLocationManager 4 | // 5 | // Created by Ahmet Ardal on 5/24/11. 6 | // Copyright 2011 SpinningSphere Labs. 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 | --------------------------------------------------------------------------------