摘要: 转自:http://hi.baidu.com/%B0%D9ii%D6%AAi%B5%C0/blog/item/5d4c0a2b284e5fea98250a41.html手头一个iphone项目需要取iphone本机ip地址,在iphone os 2.0上可以用下面的方法获得:-(NSString*)getAddress{chariphone_ip[255];strcpy(iphone_ip,"127.0.0.1"); // if everything failsNSHost* myhost = [NSHostcurrentHost];if(myhost){ NSString 阅读全文
posted @ 2012-03-16 14:23 K' 阅读(894) 评论(0) 推荐(0) 编辑
摘要: NSNotificationCenter负责程序内的通知的监听和发送,而Darwin Notification Center负责程序间的通知的管理。要想监听所有程序内的通知,只需要在addObserver方法里面的name属性设为nil即可:[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(trackNotifications:) name:nil object:nil];查看每个通知的具体类别和内容,把他们打印出来:- (void) trackNotifications: (N... 阅读全文
posted @ 2012-03-16 14:14 K' 阅读(423) 评论(0) 推荐(0) 编辑