简体   繁体   中英

Facebook SDK 3.21.1 deprecated methods error

I installed facebook SDK via cocoapods and after building my project that includes facebook sdk it shows 4 errors of deprecated methods in iOS 8.

I think i have the last version of facebook SDK (3.21.1) so i don't know that the problem is.I want to know why i have the problem and how to solve it, I don't need to know a workaround.

I understand that the methods are deprecated but if facebook sdk is updated they should update that methods too.

You can see in the image the errors i get

失误

That's because Facebook is using deprecated methods on it SDK, probably because they have to support older versions of iOS.

You can change your Podfile to ignore the warnings in a dependency, as mentioned on the docs :

pod 'Facebook-iOS-SDK', :inhibit_warnings => true

You can also ignore warnings from all dependencies:

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'
inhibit_all_warnings!

pod 'Facebook-iOS-SDK'

It's an example from the Facebook SDK right!? I mean right now it's just deprecated but not unsupported. So they can still use it in their example. However you shouldn't use it in your project! There are a lot of workarounds online in order to manage the necessary tasks without using the deprecated methods.

If this would be your project the warning would have been there already without the use of the FB SDK, since it's iOS related and not FB related.

These items were deprecated by Apple, not Facebook.

For the device orientation, try using UITraitCollection to get information about the device's orientation ie:

self.traitCollection.verticalSizeClass
self.traitCollection.horizontalSizeClass

For NSGregorianCalendar, try using NSCalendarIdentifierGregorian

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM