FBSDKProfilePictureView 的上下文 0x0 无效
Invalid context 0x0 with FBSDKProfilePictureView
我在使用 Facebook SDK 4.1 FBSDKProfilePictureView 时在控制台中收到一堆奇怪的警告:
Error: CGContextDrawPath: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
这是我的代码:
import FBSDKCoreKit
func getFBProfilePicture(facebookID: String) -> UIView {
let picView = FBSDKProfilePictureView()
picView.profileID = facebookID
picView.pictureMode = FBSDKProfilePictureMode.Square
return picView as UIView
}
好的,实际上你不能在没有框架的情况下初始化 FBProfilePictureView...现在我知道了。
正确代码如下:
import FBSDKCoreKit
func getFBProfilePicture(facebookID: String) -> UIView {
let picView = FBSDKProfilePictureView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
picView.profileID = facebookID
picView.pictureMode = FBSDKProfilePictureMode.Square
return picView as UIView
}
我在使用 Facebook SDK 4.1 FBSDKProfilePictureView 时在控制台中收到一堆奇怪的警告:
Error: CGContextDrawPath: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
这是我的代码:
import FBSDKCoreKit
func getFBProfilePicture(facebookID: String) -> UIView {
let picView = FBSDKProfilePictureView()
picView.profileID = facebookID
picView.pictureMode = FBSDKProfilePictureMode.Square
return picView as UIView
}
好的,实际上你不能在没有框架的情况下初始化 FBProfilePictureView...现在我知道了。
正确代码如下:
import FBSDKCoreKit
func getFBProfilePicture(facebookID: String) -> UIView {
let picView = FBSDKProfilePictureView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
picView.profileID = facebookID
picView.pictureMode = FBSDKProfilePictureMode.Square
return picView as UIView
}