是否有可能确定应用程序何时关闭是否通过正常方式(主页按钮)完成,或者是因为点击了广告(此示例为admob广告)... Admob没有任何有助于实现的内容这个目标呢?任何想法从哪里开始将非常感谢...
答案 0 :(得分:2)
如果没有其他/更好的方法可用,请在广告区域上放置UIView,检测其上的触摸,记下笔记然后将其传递给下一个响应者(广告视图)。
换句话说,你需要一个方法,你可以调用它来告诉你点击了admob,并且UIView的子类位于admod视图的正上方,具有以下touchesBegan:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
// you may want to do some extra work here to detect whether the touch is a
// touchUp in the view, vs. a touchUpOutside which is not the same. It all
// depends on how admob treats touches. If it immediately quits your app on
// touchdown, then you call your method immediately. If admob waits to see
// if there is a touchUp in its view, then you need to detect the same and
// call your method after that. Play around to see what you need to mimic.
[self adViewHasBeenTouched];
// The following is needed to let admob get the touch, after you are done
// with your method.
[self.nextResponder touchesBegan:touches withEvent:event];
}