iphone renderInContext 不捕获 iAd
我已成功将 iAd 添加到按预期工作的表格单元格。当用户点击表格单元格时,我想执行特定的动画,因此我使用下面的代码将视图捕获到 UIImage 中,然后转换图像。这与捕获的图像包含除 iAd 之外的所有内容这一事实完全不同。我已经将 iAds 换成了 AdMob,它工作得很好,所以一定与 iAd 附加到视图树的方式有关。任何人对如何捕获 iAd 图像有任何想法。
CGRect rect = view.bounds;
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer.superlayer renderInContext:context];
UIImage *imageCaptureRect;
imageCaptureRect = UIGraphicsGetImageFromCurrentImageContext();
self.capturedImage = imageCaptureRect;
UIGraphicsEndImageContext();
I have managed to add an iAd to a table cell which is working as expected. When the user taps a table cell I want to perform a specific animation, so I captured the view using the code below into a UIImage then transform the image. This works perfectly apart form the fact that the captured image contains everything appart from the iAd. I have swapped iAds for AdMob and it works fine, so must be something to do with the way an iAd is attached to the view tree. Any one have any ideas on how to capture the iAd image.
CGRect rect = view.bounds;
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer.superlayer renderInContext:context];
UIImage *imageCaptureRect;
imageCaptureRect = UIGraphicsGetImageFromCurrentImageContext();
self.capturedImage = imageCaptureRect;
UIGraphicsEndImageContext();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我大胆猜测这是设计使然。 Apple 使用其用户的个人信息及其帐户历史记录将 iAd 定位到正确的受众群体。如果苹果允许开发者确定用户正在接收哪些 iAd,他们就会泄露这些个人信息。考虑一下 iAd 的目标受众是 30 岁以下的人的可能性。捕获您的 iAd 的应用程序可以留意该广告并确定您的年龄段。
I would hazard a guess that this is by design. Apple uses the personal information they have on their users and their account histories to target iAds to the correct demographics. If Apple allowed developers to determine which iAds a user was receiving, they would be leaking this personal information. Consider the possibility that an iAd was targeted to people under the age of 30. An application that captured your iAds could watch out for this advert and determine your age bracket.