applicationWillTermminate 正常退出与广告退出 iPhone 问题

发布于 2024-08-08 17:58:48 字数 110 浏览 2 评论 0原文

是否可以确定应用程序何时关闭,是通过正常方式(主页按钮)还是因为点击广告(本例中的 admob 广告)来完成... Admob 没有任何可以帮助实现此目标的内容它?任何从哪里开始的想法将不胜感激......

Is it possible to determine when an app is closing whether it is done by normal means (home button) or because an ad was clicked (admob ad for this example)... Admob doesn't have anything that would help accomplish this goal does it? Any ideas where to start would be greatly appreciated...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不必了 2024-08-15 17:58:48

如果没有其他/更好的方法可用,请将 UIView 放在广告区域上,检测对其的触摸,做笔记,然后将其传递给下一个响应者(这是广告的视图)。

换句话说,您需要一个可以调用的方法来告诉您 admob 已被单击,以及 UIView 的子类(位于 admod 视图的正上方),它具有以下 TouchBegan:

- (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];
}

If no other/better means are available, put a UIView over the ad area, detect touches on it, make a note then pass that to the next responder (which is the ad's view).

In other words, you need a method you can call to tell you that admob was clicked, and a subclass of UIView, which is positioned right over the admod view, that has the following 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];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文