在我的应用程序中添加了谷歌登录 - 我有不同的故事板用于 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
这是我的代码(代码很长,所以我只放图像的代码)
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)
}
请记住,此代码正在运行,我可以在模拟器和 6-6s-7-5-4 之类的 iPhone 中看到配置文件图像,而问题仅适用于 iPhone 加大尺寸