gpt4 book ai didi

ios - CGAffineTransform 反转 : singular matrix Error

转载 作者:IT王子 更新时间:2023-10-29 05:36:31 25 4
gpt4 key购买 nike

我在 Xcode 中创建了通用应用程序(单一 View )。因为我想在每个 View 上都有 iAd 横幅,所以我将这段代码添加到 AppDelegate 文件中:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
if var root = self.window?.rootViewController
{
let contentFrame = UIScreen.mainScreen().bounds
var _banner = ADBannerView(adType: ADAdType.Banner)

_banner.frame=CGRectMake(0, contentFrame.height - _banner.frame.height, _banner.frame.width, _banner.frame.height)
_banner.delegate = self
root.view.addSubview(_banner)
}

return true
}

在真正的 iPhone (iOS 8) 上一切正常(横幅出现在每个 View 上)但我收到此错误:

<Error>: CGAffineTransformInvert: singular matrix.

如果我尝试在模拟器 (iOS 8) 上运行此应用程序,行为是相同的。一切正常,我得到了同样的错误,但此外我得到: *ADBannerView:

 Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:):
Error Domain=ADErrorDomain Code=7 "The operation couldn’t be completed. Ad was unloaded from
this banner" UserInfo=0x7b83bf30 {ADInternalErrorCode=7, ADInternalErrorDomain=ADErrorDomain,
NSLocalizedFailureReason=Ad was unloaded from this banner}*

但是我有委托(delegate)并且我实现了didFailToReceiveAdWithError。在真正的 iPhone 上它可以工作...

我的问题是如何解决这两个特定错误?

最佳答案

最可能的原因是这里的一个矩形为零。您不能反转零矩阵(这是一个技术细节,您真的不必关心;我只是想说明为什么这是您得到的错误)。

application(didFinishLaunchingWithOptions:) 很早就被调用了,框架可能还没有设置。您可能希望在 Root View Controller 的 viewDidLoad 中完成这项工作(可能需要在 viewWillAppear 中修复框架)(您可能需要创建一个子类)如果您还没有的话)。

关于ios - CGAffineTransform 反转 : singular matrix Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25837585/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com