一个故事板中的谷歌帐户图像显示,但没有在另一个故事板中显示

时间:2017-04-19 06:11:03

标签: image swift3 user-profile googlesigninaccount

在我的应用程序中添加了谷歌登录 - 我有iPhone 4或4s的另一个故事板和iPhone 5-5c-5s-se的另一个故事板和iPhone 6-6s的另一个 - 7和iPhone 6plus-6splus-7plus的另一个 我的问题是,除了iPhone 6plus-6splus-7plus的故事板外,我可以看到所有故事板中的个人资料图片!

我收到了这样的错误:

fatal error: unexpectedly found nil while unwrapping an Optional value
2017-04-19 10:29:27.083269 Tipo[7327:3648156] fatal error: unexpectedly found nil while unwrapping an Optional value

这是我的代码(代码非常长所以我只是把代码放到Image中)

if GIDSignIn.sharedInstance().currentUser.profile.hasImage 
{
    print("Account Has Image")

    print("\(personalImage)")

    ////Profile Photo

    let dimension = round(200 * UIScreen.main.scale)

    let pic = GIDSignIn.sharedInstance().currentUser.profile.imageURL(withDimension: UInt(dimension))

    self.personalImage?.image = UIImage(data: NSData(contentsOf: pic!)! as Data)
}

请记住,此代码正常工作,我可以在模拟器和iPhone中查看配置文件图像,如6-6s-7-5-4,问题仅适用于iPhone加上大小

这是错误的图片 error picture

0 个答案:

没有答案