XCode7编译Osirix

1、到Github下载源码
https://github.com/pixmeo/osirix

2、用Xcode打开Osirix.xcodeproj,提示要升级配置,升级

3、运行任务Unzip Binaries

4、Osirix目标调整为x86(上面的Binaries都是x86的)

5、编译Osirix,恩,出错了是吧

6、下载openssl库

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install openssl

将/usr/local/opt/openssl/include添加到include路径
将/usr/local/opt/openssl/lib添加到lib路径

7、在Osirix项目中,去除Message依赖

8、还需要调整几个编译错误和几个连接错误,然后就好了
其中有一个错误是有多个jaritab符号,可以找到三个,然后改为不同名或改为static就好了
其余问题都是很简单的问题咯

9、搞定

MAC解析HTML

- (void)fetchOneHtmlwithUrl:(NSURL *)url withCode:(NSString *)code withValueIn:(double)valueIn withMoneyIn:(double)moneyIn
{
    NSError *error;
    NSData *dataGB2312 = [[NSData alloc] initWithContentsOfURL:url options:NSDataReadingMappedIfSafe error:&error];
    NSStringEncoding gb2312Encoding =CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
    NSString *htmlGB2312 = [[NSString alloc] initWithData:dataGB2312 encoding:gb2312Encoding];
    NSString *utf8HtmlStr = [htmlGB2312 stringByReplacingOccurrencesOfString:@"charset=gb2312"
                                                               withString:@"charset=utf-8"];
    NSData *dataUTF8 = [utf8HtmlStr dataUsingEncoding:NSUTF8StringEncoding];
    
    ParseResultBean *bean = [ParseResultBean alloc];
    TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:dataUTF8];
    
    NSArray *eArrayCode  = [xpathParser searchWithXPathQuery:@"/html/body/div[1]/div[7]/div[2]/div[1]/div[1]/div[1]/span[2]"];
    TFHppleElement *eCode = [eArrayCode objectAtIndex:0];
    bean->code = [[eCode attributes] objectForKey:@"title"];
    
    [allRows addObject:bean];
}

MAC解析JSON

    
    NSError *parseError;
    NSData *jsonData = [sJsonText dataUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:&parseError];
    if (json == nil)
    {
        NSLog(@"json parse failed. \r\n");
        //NSLog([[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]);
        NSLog(@"%@",[parseError localizedDescription]);
        return;
    }

    NSArray *jijinArray = [json objectForKey:@"jijinlist"];
    for(NSDictionary *jijin in jijinArray)
    {
        NSString *sCode = [jijin objectForKey:@"code"];
        NSString *sValuein = [jijin objectForKey:@"valuein"];
    }

MAC系统托盘图标

 - (void)viewDidLoad {
    [super viewDidLoad];

    // Do any additional setup after loading the view.    
    CGFloat f = 30.0;
    statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:f];
    [statusItem setHighlightMode:YES];
    [statusItem setTitle:[NSString stringWithFormat:@"%@",@"Hi"]];
    [statusItem setMenu:statusMenu];
    [statusItem setEnabled:YES];
}