第一次打电话registerForRemoteNotificationTypes:给你的UIApplication对象,a UIAlertView弹出说"[app]想要发送推送通知".
有没有办法知道何时点击"确定"或"不允许" AlertView?
即使在用户做出决定之前application:didRegisterForRemoteNotificationsWithDeviceToken:,我的目前也会被调用AppDelegate.
我想问的原因是因为第一次启动,我要推一个ViewController与Notification选择,但前提是用户表示,他们希望收到通知.
在 NSOperation 子类中,我使用以下代码从我们的服务器下载一个 xml 文件,然后对其进行解析:
NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:15];
NSData * receivedData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
Run Code Online (Sandbox Code Playgroud)
我第二次发出同样的请求,服务器返回一个 HTTP 304,缓存的响应数据存储在receivedData. 到现在为止还挺好。
我的问题:当设备离线时是否有可能获得相同的缓存响应?