有部分图片是名称一样存放在模块的image文件下与公共的image 文件重复
有的是图片名称一样 文件不一样
xib 中引用的到请用以下命令逐一查看排除
grep -i -r --include=*.xib --include=*.m "line" ./ | grep "line.png"
Mac OS里除了Apple Script, 还有一个更简单的自动化工具Automator,恰当运用可以提高工作效率。
下面举一个简单的例子, 比如在Mac OS执行Android模拟器,不想用AVD再选对,而是想直接运行我想要的模拟器,可以在命令行执行:
emulator -avd avd_name
我比较懒,也不想特意打开AVD或Terminal再执行,而是希望直接从Dock上就可以运行。解决方法就是在Automator。
1. 打开Automator, 选择Workflow:
2. 新建一个Run Shell Command,然后设定Shell和具体的指令:
3. 保存为Application。
刚刚的指令已经被包装成和一个应用程序一样了。
4. 然后把它拖到Dock上,需要时候执行一下就可以了。
还有一种情况,我总是要不断的执行一段测试脚本,但需要有指定一个目标目录。只需要在命令设置上选择"Pass Input: as arguments", 如下使用一般的Shell脚本的方式接受参数就可以了:
使用时将要测试的目录拖到新建的程序上就可以了。
嗯,如此而已!你应该能做得更好!
*将Automator建立的程序统一放置起来,也会更方便调用!
参考:
开发工作中使用的软件列表
懒人可以用Automator提高工作效率
使用脚本简化工作
程序员要学会偷懒---正确运用自动化技术
如何使用搜索技巧来成为一名高效的程序员
游戏开发论坛:http://jiushun8.com/forum.php?mod=viewthread&tid=2839&extra=page%3D1
TCP通讯实例
#import <Foundation/Foundation.h> @interface Communicator : NSObject <NSStreamDelegate> { @public NSString *host; int port; } - (void)setup; - (void)open; - (void)close; - (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)event; - (void)readIn:(NSString *)s; - (void)writeOut:(NSString *)s; @end
Communicator.m
#import "Communicator.h" CFReadStreamRef readStream; CFWriteStreamRef writeStream; NSInputStream *inputStream; NSOutputStream *outputStream; @implementation Communicator - (void)setup { NSURL *url = [NSURL URLWithString:host]; NSLog(@"Setting up connection to %@ : %i", [url absoluteString], port); CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (CFStringRef)[url host], port, &readStream, &writeStream); if(!CFWriteStreamOpen(writeStream)) { NSLog(@"Error, writeStream not open"); return; } [self open]; NSLog(@"Status of outputStream: %i", [outputStream streamStatus]); return; } - (void)open { NSLog(@"Opening streams."); inputStream = (NSInputStream *)readStream; outputStream = (NSOutputStream *)writeStream; [inputStream retain]; [outputStream retain]; [inputStream setDelegate:self]; [outputStream setDelegate:self]; [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inputStream open]; [outputStream open]; } - (void)close { NSLog(@"Closing streams."); [inputStream close]; [outputStream close]; [inputStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inputStream setDelegate:nil]; [outputStream setDelegate:nil]; [inputStream release]; [outputStream release]; inputStream = nil; outputStream = nil; } - (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)event { NSLog(@"Stream triggered."); switch(event) { case NSStreamEventHasSpaceAvailable: { if(stream == outputStream) { NSLog(@"outputStream is ready."); } break; } case NSStreamEventHasBytesAvailable: { if(stream == inputStream) { NSLog(@"inputStream is ready."); uint8_t buf[1024]; unsigned int len = 0; len = [inputStream read:buf maxLength:1024]; if(len > 0) { NSMutableData* data=[[NSMutableData alloc] initWithLength:0]; [data appendBytes: (const void *)buf length:len]; NSString *s = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; [self readIn:s]; [data release]; } } break; } default: { NSLog(@"Stream is sending an Event: %i", event); break; } } } - (void)readIn:(NSString *)s { NSLog(@"Reading in the following:"); NSLog(@"%@", s); } - (void)writeOut:(NSString *)s { uint8_t *buf = (uint8_t *)[s UTF8String]; [outputStream write:buf maxLength:strlen((char *)buf)]; NSLog(@"Writing out the following:"); NSLog(@"%@", s); } @end
#import <Foundation/Foundation.h> #import "Communicator.h" int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; Communicator *c = [[Communicator alloc] init]; c->host = @"http://127.0.0.1"; c->port = 6789; [c setup]; [c open]; [pool drain]; return 0; }