As with any software solution, there are usually several ways to do the same thing. Iterating through NSDictionary on iOS certainly has it’s own set of ways. iOs allows you [...]
More →As with any software solution, there are usually several ways to do the same thing. Iterating through NSDictionary on iOS certainly has it’s own set of ways. iOs allows you [...]
More →Regular expressions can be used on the iOS platform as iOS 4.0 comes with the foundation framework courtesy of the . Pattern syntax currently is specified by ICU.
More →NSNotifications is a way to message other classes and objects within iOS. Unlike protocols and delegates, NSNotifications are blind in that they do not directly know which objects and methods [...]
More →I was watching the Carnegie Mellon iOS dev series on iTunesU. Very briefly in the lecture on core data, was a section of code that copied a database out of [...]
More →Working with Python in a scripting environment where Python is already installed is pretty straight forward. OSX comes already installed with Python and it’s fairly easy to find installs in [...]
More →Objective-C introduced a new way to reference header files. Traditionally, a #include statement would literally drop in the header file of a respective file into a location indicated by the [...]
More →Singleton example using the automatic reference counter (ARC): Interface
|
1 2 3 4 5 6 7 8 |
#import <foundation/Foundation.h>
@interface MyManager : NSObject {
NSString *someProperty;
}
@property (nonatomic, retain) NSString *someProperty;
+ (id)sharedManager;
@end |
Implementation
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#import "MyManager.h"
static MyManager *sharedMyManager = nil;
@implementation MyManager
@synthesize someProperty;
#pragma mark Singleton Methods
+ (id)sharedManager {
@synchronized(self) {
if (sharedMyManager == nil)
sharedMyManager = [[self alloc] init];
}
return sharedMyManager;
}
- (id)init {
if (self = [super init]) {
someProperty = [[NSString alloc] initWithString:@"Default Property Value"];
}
return self;
}
- (void)dealloc {
// Should never be called, but just here for clarity really.
}
@end |
There are many applications for spoofing user-agents on web browsers. Most solutions from Firefox or Chrome utilize plug-ins to achieve this. Safari on OSX has the ability to perform this [...]
More →