iOS5后苹果居然不支持gmail的推送了。找到个解决方法:
- 删除原有的Gmail账户
- 添加新邮件账户,选择 Exchange (不是gmail)
- 输入 email, username(还是邮件名),passcode
- 接下来会提示输入服务器 m.google.com
- 验证后即重新支持推送了!
写iOS程序最讨厌的就是写个如下图的设置界面 或 登陆(注册)界面了

这完全是体力活,没头脑,还得在cell里加入一大堆控件。同时由于tableview的重用机制,导致必须每次都得对各个控件设置属性,防止出现内容错误。
虽然iOS5中增加了新的静态tableview类型,可等它普及估计至少要半年,还是早些其他解决方法为妙。
目前有两个开源的代码能完成类似的功能
原来是将苹果app外部的setting.bundle在程序内部显示用的开源库。现在也提供了快速搭建脚手架的功能
地址 https://github.com/futuretap/InAppSettingsKit
QuickDialog allows you to create HIG-compliant iOS forms for your apps without having to directly deal with UITableViews, delegates and data sources. Fast and efficient, you can create forms with multiple text fields, or with thousands of items with no sweat!
刚发现的,看起来比InAppSetting方便,未测试使用过~
地址 https://github.com/escoz/QuickDialog/
原来计划几个小时内加个IAP功能,结果一天过去了,还没搞定。无奈的刷机中。
搜索了下IAP是个超级大坑,各种奇怪的问题,而且苹果没一份完整的文档解释可能出现的情况。于是有人根据回馈总结了这么个表格
To save you the pain of exhaustively searching the web for the cause of your error, here is a checklist of everything I have stumbled across that can cause an invalid product ID. Make sure you can answer “Yes” to each of these questions:
SKProductRequest?If you answered “No” to any one of these questions, there’s your problem.
原文附录了一大堆可能提供解决方案的链接,如果你也有类似的问题可以尝试下。
当然stackoverflow也有大量关于IAP的离奇问题
--- 更新 ---
刷玩最新的 4.3.5后,然后什么都没改动就突然能用了。
这里有篇写的不错的教程,希望对用IAP的人有帮助
你是否有过类似的经验,从一个TableView push到另一个视图后,然后pull back, 这时候有可能会发现tableView的contentOffset 已经滚动到顶部了,而且时有时无,所以也就没深入探讨下去了?
举个很简单的例子,现在有个附件位置聊天工具叫 陌陌, 我就喜欢在列表页面一直向下滑动找各种美女看PP,可是在看完美女资料返回列表后经常发现居然又滚回视图的顶部了,悲痛之余,又得话费很久时间重新滚动到下面,继续看美女。然后又被离奇的滚动到顶部。。。。
其实这个问题在 这篇文章 里提到过,没错还是 -viewDidUnload 导致的问题。首先我们来快速重现下这个bug
其原因很容易解释,在接收到内存警报的通知后,非当前用户可见的视图控制器(vc)会接收到额外的通知,并将它的view给释放掉节约内存占用。然后当该vc的视图即将重新被用户可见时(比如被pullBack),vc会调用 -loadView , – viewDidLoad 这些方法重新将view创造出来, 但是偏移位却没有被保存下来,所以就发生这个Bug了。
写到这里应该已经知道如何解决这个问题了吧,增加一个变量记录来记录当前tableView.contentOffset.y 的数值,然后 – viewDidLoad 里面将tableview的偏移位给恢复即刻。
番外篇
iOS 中内存问题会导致各种奇怪的现象,在 – viewDidUnload被执行后会导致下次 – loadView, – viewDidLoad 被重新执行,所以一定要在 -viewDidUnload 中把其他retain的东西给释放掉。
每次通过模拟器的菜单来模拟内存警告比较麻烦,这里提供一个特殊的类来实现自动内存警报功能,将你的视图控制器从该类继承下来,这里以UIViewController为例子。当视图不可见时,该控制器便会自动接收到内存警告并释放掉自己的视图。这样子调试起来就方便了。有木有!!!
@interface MotherUIViewController : UIViewController
- (void)simulateMemoryWarning;
@end
@implementation MotherUIViewController
- (void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
[self simulateMemoryWarning];
}
- (void)simulateMemoryWarning
{
#if TARGET_IPHONE_SIMULATOR
#ifdef DEBUG
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)@"UISimulatedMemoryWarningNotification", NULL, NULL, true);
#endif
#endif
}
@end
UIActionSheet 只提供了一个构造函数
- (id)initWithTitle:(NSString *)title delegate:(id<UIActionSheetDelegate>)delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...
如果需要动态的添加按钮,就必须使用另外个函数:
- (NSInteger)addButtonWithTitle:(NSString *)title;
但出现的诡异结果是新添加的内容均出现在 取消 按钮之下,非常讨厌。
解决方法直接看代码
//.....
UIActionSheet* sheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"请选择埋掉的原因", @"reason to bury")
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
[sheet addButtonWithTitle:@"btn1"];
[sheet addButtonWithTitle:@"btn1"];
[sheet addButtonWithTitle:@"btn1"];
[sheet addButtonWithTitle:NSLocalizedString(@"取消", @"cancel button title")];
sheet.cancelButtonIndex = sheet.numberOfButtons - 1;
//....
在iOS3.0后,UIViewController多了一个叫做viewDidUnLoad的方法.不少人都不清楚这个方法的具体意义,苹果的文档也就一句”Called when the controller’s view is released from memory” 简单的解释了下,并要求你把IBOutlet绑定的视图给清空,为什么呢?
先看下UIViewController从创建view到展示的流程的几个函数
-init
-initWithNibName:bundle:
这两个方法都是初始化一个vc,但请注意view不是这时候载入的
-loadView
-viewDidLoad
当一个视图准备展现时,vc首先会判断view是否已经创建,否则便通过之前指定的xib文件来初始化view,以及绑定其他关系(若没有指定xib文件,则默认会搜索和vc同名的xib,比如myNameViewController就会搜索 myNameViewController.xib文件)
若是没有xib文件,你就可以在loadview中自己手动创建这个viewControoler需要的视图.
接下来就是调用到 -viewDidLoad,许多人喜欢在这里做些其他事情,比如做个http请求,建立个数组啥的, 这里若不处理正确, -viewDidUnload 激活时内存就容易泄露了,稍后提到.
-view()appear
-view()disappear
这几个方法就不解释了
-viewDidUnload
该方法在收到内存警告,同时该视图并不在当前界面显示时候会被调用,此时该controller的view已经被释放并赋值为nil.
接下来你要做的是
因为当该viewController再次被激活准备显示时(比如navigationControler返回到上一级),vc发现自己的view为空后会重复之前的流程直到把view给创建起来,若没将自己额外添加的子视图,各种类实例变量释放,这里便会重新再次创建.
于是,内存泄露了.
好久没来RP掉的厉害,刚把wp升级到3.0,庆幸没什么异样。
最近很少花时间码代码,整理点资料加点RP
Steven 写的 Apple’s iBooks Dynamic Page Curl
Steven: I manage the CoreAnimation team at Apple. Are you interested in working for us?
注意文章的评论,以及另一个没使用private api的项目
还有一篇
见到cocoachina上dr_watson的分享
原文地址 http://techcrunch.com/2010/05/16/iphone-app-sales-exposed/
摘录其中一段
However, when the top 10% of the most successful apps are removed from the data set, the numbers skew much lower, giving a far better impression of what the iPhone industry looks like for most developers. In this scenario, the average sales were 11,625 total units, averaging 44 copies/day. Approximately 23% of apps sold less than 1000 units from launch (ranging from 12 to 370 days in the App Store). Further, 56% of apps sold less than or equal to 10,000 units, while 90% sold less than 100,000 units, with the remaining 10% achieving sales of 127,000 – 3,000,000 units.
apple 把 webview 封装的实在太简单了.
留给开发者只有寥寥几个api,甚至连scrollview的基本操作都没法完成.
不过下面这个方法
stringByEvaluatingJavaScriptFromString:String
还是给了些希望.
搜索后发现果然javascript提供了一系列移动页面的操作
这样我的需求就实现了.当然js能做的事情太多了,给webview换一套css也不是不可能的.
好像 Reeder 以及 便携百科ipad 就是这么做到的吧. 这两款软件都做得相当完美,体验上也无可挑剔.作者确实费了不少心血.
用心的产品才能引起共鸣.
Apple 发布了 os4.0
新的Game Center -> openFeint , Plus+ 等第三方平台怎么活下去。矛盾开始了
iAD -> 公开指责 google ,又一个敌人
以及 3.3.1
3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).
这下 unity 和 即将来临的flash也被一棍打死了。
Adobe 目前在twitter上的声明 :AdobeWe are looking into the new SDK language. We continue to develop Packager for iPhone OS which will debut in Flash #CS5