I know I'm using the latest version (v3.2.1). But I want find it in header or programmatically.
In iOS I can't find version number in FacebookSDK.framework headers.
After about 2014, simply do this:
NSLog( @"### running FB sdk version: %@", [FBSDKSettings sdkVersion] );
For very old versions. Before about 3.6:
I found an undocumented way to print the SDK version (FB_IOS_SDK_VERSION_STRING), try this
NSLog(@"### FB SDK VERSION : %@",
[[FBRequestConnection class] performSelector:@selector(userAgent)]);
Worked for me with sdk 3.5.1
Hope that helps...
Update: As of FB SDK 3.6, "The SDK version number is defined in FacebookSDK.h and available from [FBSDKSettings sdkVersion]"
Take a look at FBSDKVersion.h
. There's a define there:
#define FB_IOS_SDK_VERSION_STRING @"3.2.1"
For those running SDK version >= 4, [FBSDKSettings sdkVersion]
.
#import <FBSDKCoreKit/FBSDKCoreKit.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSLog(@"### Running FB SDK Version: %@", [FBSDKSettings sdkVersion]);
}
From the SDK directory I did:
% find . -name \*.h -exec fgrep -i version {} /dev/null \;
Amongst other stuff, the following line was returned:
./FBSDKCoreKit.framework/Headers/FBSDKCoreKit.h:#define FBSDK_VERSION_STRING @"4.11.0"
This will help you identify the version without needing to actually link/run/log.
Facebook might possibly be the only technology company in the world that omits the version number from their tar/zip file, as well as the unpacked root directory. I find this baffling.
In swift 2, FBSDK 4.4 you can output the version string:
print("FBSDK Version: \(FBSDK_VERSION_STRING)");
//outputs:
//FBSDK Version: 4.4.0
FBSDKSettings.version() returned 0 for me.
To check the current version of facebook SDK use below line:
print("SDK version \(FBSDKSettings .sdkVersion())")
In my case, SDK version 4.8.0
Tested against swift 2.0 and xCode 7.0+
For Facebook SDK 3.18, I had to do
#import <FacebookSDK/FacebookSDK.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSLog( @"My app is running FB sdk version: %@", [FBSettings sdkVersion]);
}
Try(Android) - I only posted this because I was looking for this answer and didn't see for android.
String s = FacebookSdk.getSdkVersion();
Log.d("FacebookSKD_V",s);
If you are using pods you can check in the Info.plist file:
"Pods/FBSDKCoreKit/Support Files/Info.plist"
The version is the key CFBundleShortVersionString
My version was 4.18.0
Example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.18.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
在 Xcode 12 的 11.0 之后,无法在 SPM 上获取它。
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.