- 博客(367)
- 收藏
- 关注
原创 iOS 7: How to get own number via private API?
iOS 越狱开发 获取本机手机号码:http://stackoverflow.com/questions/19504478/ios-7-how-to-get-own-number-via-private-api
2014-10-30 17:25:07
1428
原创 ld: warning: directory not found for option '-F"/Applications/Xcode.app/Contents/Developer/Platforms
在用AFNetworking 或者 Reachablity.h/.m的时候,遇到这个编译错误:ld: warning: directory not found for option '-F"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.s
2014-09-09 13:07:50
2356
转载 防止iOS程序进入休眠状态
设置应用程序的 idleTimerDisabled 属性为 YES (默认为NO)[UIApplication sharedApplication].idleTimerDisabled=YES;//当然一定要慎用,记着退出程序时把自动休眠功能开启
2014-09-09 10:44:13
1429
转载 AFNetworking 2.0 编译不过的问题修复
Link: http://blog.youkuaiyun.com/zaitianaoxiang/article/details/22597785AFNetworking 2.0 当Deployment Target 低于6.0时,AFURLConnectionOperation.h,AFURLSessionManager.h@property (nonatomic, strong) dispa
2014-09-09 10:35:54
602
转载 Xcode Interface Builder Help Link
https://developer.apple.com/library/ios/recipes/xcode_help-interface_builder/_index.html
2014-09-05 13:57:27
518
转载 Colorize Git Terminal Commands
Add the following to your ~/.gitconfig file to show the git command output in color when working in a terminal. This is really handy, give it a go.[color]ui = auto[color "branch"]current =
2014-09-03 10:03:41
611
原创 Get Application Display Name
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
2014-09-03 09:58:37
980
转载 NSString写入文件,append模式实现
- (BOOL)appendToFile:(NSString *)path usingEncoding:(NSStringEncoding)encoding{ NSLog(@"\n\n Append String :%@", self); NSFileHandle *fh = [NSFileHandle fileHandleForWritingAtPath:path];
2014-09-03 09:25:21
1301
转载 Introduction to CocoaPods Tutorial
http://www.raywenderlich.com/64546/introduction-to-cocoapods-2
2014-09-01 22:41:06
535
原创 Presenting a local notification immediately while running in the background
- (void)applicationDidEnterBackground:(UIApplication *)application { NSLog(@"Application entered background state."); // bgTask is a property of the class NSAssert(self.bgTask == UII
2014-08-30 19:40:32
810
原创 Creating, configuring, and scheduling a local notification
- (void)scheduleNotificationWithItem:(ToDoItem *)item interval:(int)minutesBefore { NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar]; NSDateComponents *dateComps = [[NSDateComp
2014-08-30 19:34:09
772
原创 Monitoring the death of a parent process (via Dispatch Sources)
void MonitorParentProcess() { pid_t parentPID = getppid(); dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_source_t source = dispatc
2014-08-29 17:20:45
674
原创 Installing a block to monitor signals (via Dispatch Sources)
void InstallSignalHandler() { // Make sure the signal does not terminate the application. signal(SIGHUP, SIG_IGN); dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_
2014-08-29 17:09:13
1126
原创 Watching for filename changes (via Dispatch Sources)
an example that monitors a file for name changes and performs some custom behavior whenit does. (You would provide the actual behavior in place of theMyUpdateFileNamefunction called in theexample.
2014-08-29 16:57:12
751
原创 Reading /(Writing) Data from / (to) a Descriptor (Dispatch Sources)
dispatch_source_t ProcessContentsOfFile(const char* filename) { // Prepare the file for reading. int fd = open(filename, O_RDONLY); if (fd == -1) return NULL; fcntl(fd, F
2014-08-29 16:47:58
605
原创 Getting data from a dispatch source
FunctionDescriptiondispatch_source_-get_handleThis function returns the underlying system data type that the dispatch sourcemanages.For a descriptor dis
2014-08-29 16:18:42
536
原创 Creating a timer dispatch source
dispatch_source_t CreateDispatchTimer(uint64_t interval, uint64_t leeway, dispatch_queue_t queue, dispatch_block_t block) { dispatch_source_t tim
2014-08-29 16:17:45
1301
原创 Dispatch Sources
About Dispatch SourcesA dispatch sourceis a fundamental data type that coordinates the processing of specific low-level systemevents. Grand Central Dispatch supports the following types of dispatc
2014-08-29 15:21:49
602
原创 Waiting on Groups of Queued Tasks (dispatch_group_async)
// Waiting on asynchronous tasks dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);dispatch_group_t group = dispatch_group_create();// Add a task to the grou
2014-08-29 14:47:45
854
原创 Using Dispatch Semaphores to Regulate the Use of Finite Resources
The semantics for using a dispatch semaphore are as follows:When you create the semaphore (using thedispatch_semaphore_createfunction), you can specifya positive integer indicating the numbe
2014-08-29 14:42:29
682
原创 Performing Loop Iterations Concurrently
Original:for (i = 0; i < count; i++) { printf("%u\n",i);}Replacement:dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);dispatch_apply(count, queue,
2014-08-29 14:37:38
510
原创 Performing a Completion Block When a Task Is Done (!!!)
Executing a completion callback after a task
2014-08-29 14:03:15
625
原创 Adding a Single Task to a Queue
The following example shows how to use the block-based variants for dispatching tasks asynchronously and synchronously: dispatch_queue_t myCustomQueue;myCustomQueue = dispatch_queue_create("com.exa
2014-08-29 13:59:02
456
原创 Storing Custom Context Information with a Queue
Storing Custom Context Information with a QueueAll dispatch objects (including dispatch queues) allow you to associate custom context data with the object.To set and get this data on a given object,
2014-08-29 13:52:19
589
原创 Creating an NSInvocationOperation Object / NSBlockOperation Object
@implementation MyCustomClass - (NSOperation*)taskWithData:(id)data {NSInvocationOperation* theOp = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(myTaskMethod:) object:data]
2014-08-29 10:09:28
568
原创 Reading the contents of a file using POSIX functions
- (NSData*)readDataFromFileAtURL:(NSURL*)anURL { NSString* filePath = [anURL path]; fd = open([filePath UTF8String], O_RDONLY); if (fd == -1)return nil; NSMutableData* theData = [[[NS
2014-08-28 15:12:58
694
原创 Reading the contents of a file using NSFileHandle
- (NSData*)readDataFromFileAtURL:(NSURL*)anURL { NSFileHandle* aHandle = [NSFileHandle fileHandleForReadingFromURL:anURLerror:nil]; NSData* fileContents = nil; if (aHandle) fileCo
2014-08-28 14:57:51
1049
原创 Reading the bytes from a text file using a dispatch I/O channel
- (void)readContentsOfFile:(NSURL*)anURL { // Open the channel for reading. NSString* filePath = [anURL path]; self.channel = dispatch_io_create_with_path(DISPATCH_IO_RANDOM,
2014-08-28 14:42:43
1226
原创 How to create a custom directory for app files inside the ~/Library/Application Support directory.
- (NSURL*)applicationDirectory { NSString* bundleID = [[NSBundle mainBundle] bundleIdentifier];Managing Files and DirectoriesCreating New Files and Directories Programmatically NSFil
2014-08-28 14:03:35
991
原创 Filters Limit the File Types That the User Can Select
- (IBAction)askUserForImage:(id)sender { NSOpenPanel* panel = [NSOpenPanel openPanel]; // Let the user select any images supported by // the NSImage class. NSArray* imageTypes = [NSImag
2014-08-28 13:56:05
727
原创 Saving a file with a new type
- (void)exportDocument:(NSString*)name toType:(NSString*)typeUTI{ NSWindow* window = [[[self windowControllers] objectAtIndex:0] window]; // Build a new name for the file using the curren
2014-08-28 13:54:13
777
原创 Presenting the open panel to the user
- (IBAction)openExistingDocument:(id)sender { NSOpenPanel* panel = [NSOpenPanel openPanel]; // This method displays the panel and returns immediately. // The completion handler is called when
2014-08-28 13:48:14
625
原创 Retrieving the list of items in a directory all at once
NSURL *url = ;NSError *error = nil;NSArray *properties = [NSArray arrayWithObjects: NSURLLocalizedNameKey, NSURLCreationDateKey, NSURLLocalizedTypeDescriptionKey,nil];NSA
2014-08-28 11:24:31
557
原创 Looking for files that have been modified recently
NSString *directoryPath = ;NSDirectoryEnumerator *directoryEnumerator = [[NSFileManager defaultManager]enumeratorAtPath:directoryPath];NSDate *yesterday = [NSDate dateWithTimeIntervalSinceNow:(-60*
2014-08-28 11:18:03
764
转载 iOS进程间通讯(私有) CPDistributedMessagingCenter
Server:-(id)init... {... CPDistributedMessagingCenter *messagingCenter; // Center name must be unique, recommend using application identifier. messagingCenter = [CPDistributedMessagingCenter
2014-08-26 09:21:55
3966
原创 Notification Centers
Cocoa includes two types of notification centers:The NSNotificationCenter class manages notifications within a single process.The NSDistributedNotificationCenter class manages notifications
2014-08-25 15:39:15
463
原创 笔记1
1. Cocoa does not use getName because methods that start with “get” in Cocoa indicate that the method will return values by reference.
2014-08-25 08:59:20
456
转载 iOS Reverse Engineering Resources
http://samdmarshall.com/re.htmlReverse Engineering ResourcesDebuggingThese are very important guides for understanding the debugging process and how applications work.Mac OS X Debu
2014-08-13 16:41:31
696
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人