刚刚碰到个很奇怪的问题,iPad发出的网络请求无法获取User-Agent,而使用浏览器去请求就可以正常获取。
iPad中,是使用ASIHttpRequest去发出请求的,NSLog了一下User-Agent,发现其中有中文,因为如果没有指定ASIHttpRequest发出的请求的User-Agent的话,ASIHttpRequest会默认的建立一个User-Agent。
结构是:appName, appVersion, deviceName, OSName, OSVersion, locale
其中appName默认是CFBundleDisplayName,这个在中文程序中一般为中文。所以只要修改这里就可以了。
在ASIHttpRequest.m的第4091行可以看到+ (NSString *)defaultUserAgentString 这个getter,修改其中的代码即可。怎么修改就不提了吧?
今天对于所有的果粉来说是灰色的一天。那位神再也不会站在那舞台上说:”There is one more thing!”
R.I.P Steve Jobs!

有时候复制了一个svn库中的目录到其他svn库中,原来的信息也被带过来了(当然可以用export),目录比较多的情况下,手动删除肯定不方面(况且默认还隐藏了.svn – -),其实很简单,使用rm和find命令很快解决问题
cd /some/of/your/folders/
rm -rf `find . -type d -name .svn`
今天Steve Jobs宣布辞去Apple CEO,虽然知道这一天迟早都要到来,不过还是挺遗憾和伤感的。
相信很多朋友想在键盘上直接敲出苹果的Logo,Google了一下,很简单
先按住键盘上的Shift+Alt,然后按下K就可以了
今天下午发现,在UITabBar的子显示对象的- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 有点问题,屏幕旋转了,只是调用了UITabBar的shouldAutorotateToInterfaceOrientation,容器内部的显示对象并不会做出反应。那么只能检测屏幕的旋转事件了再做出相应的动作了
// Do any additional setup after loading the view from its nib.
//----- SETUP DEVICE ORIENTATION CHANGE NOTIFICATION -----
UIDevice *device = [UIDevice currentDevice]; //Get the device object
[device beginGeneratingDeviceOrientationNotifications]; //Tell it to start monitoring the accelerometer for orientation
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; //Get the notification centre for the app
[nc addObserver:self //Add yourself as an observer
selector:@selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification
object:device];
- (void)orientationChanged:(NSNotification *)note
{
UIView *ftView = [self.view viewWithTag:200];
if([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)
{
[ftView setFrame:CGRectMake(0, 0, 480, 200)];
}else
{
[ftView setFrame:CGRectMake(0, 0, 320, 360)];
}
}
ref:http://www.ios-developer.net/iphone-ipad-programmer/development/notifications/orientation-change-notification
之前iPhone的推送一直有问题,最开始是越狱后无信号,应该是RedSn0W的问题,刷回去激活后重新越狱就OK了。
后来又发生了facetime无法激活的问题,自己好了=。=
后来不知道什么时候开始WIFI环境下推送是正常的,但是联通3G下却不行。
昨晚研究了一下,查了好多地方。也没找到结果
后来再描述文件里发现了,原来使用农业银行网上银行的时候,会修改APN为3GWAP导致了这个问题。晕塌,移除了这个描述文件就正常了。。。
对于这个问题查了不少地方,有好多种解决方案,后来发现原来在iOS 4.1 之后,Apple 提供了UIKeyboardTypeDecimalPad这种键盘模式。
只要设置UITextField的keyboardType即可。
特别需要注意的是,只适合iOS 4.1之后的版本。
如果要兼容之前的版本,那么请参考:http://blog.devedup.com/index.php/2010/03/13/iphone-number-pad-with-a-decimal-point/
相信你是通过搜索引擎过来的,嘿嘿。。。
在使用ASIHttpRequest的时候,需要在Header Search Paths中添加${SDKROOT}/usr/include/libxml2。
Header Search Paths在XCode 3中很好找到,可是在XCode 4中因为菜单的改变。发现有点捉迷藏了。
那就画个示意图吧:
首先在左侧选择你的项目。
然后选择中间位置的Project 或者Targets,随便都可以。
第三步,选择 Build Settings.
第四步,把Tab Navigate中的Basic改成All
然后就可以在Search Path中找到Header Search Paths了。。。

