Find Facebook SDK Version on iOS - ios

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
Update: As of FB SDK 3.6, "The SDK version number is defined in FacebookSDK.h and available from [FBSDKSettings sdkVersion]"
https://developers.facebook.com/ios/change-log-3.x/

You can find the version of your Facebook SDK in FBSDKCoreKit.h defined as
#define FBSDK_VERSION_STRING #"X.XX.X". Have a look at the image below.

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+

There is no way to get it on SPM after 11.0 from Xcode 12.

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>

import FBSDKCoreKit
print(Settings.shared.sdkVersion)

Related

unable to read property list from file, Info.plist issue when I use Mapbox sdk in my app

im facing an issue in one of my flutter apps. Im was using MapBox-SDK plugin but when I tested the app on IOS, it asked me to update my Mapbox-sdk to some version (which I did using pop install command). Now after everything, I am facing new errors in my info.plist file. I forgot to take a backup of my old info.plist file.
Anyways, the new info.plist is:
<plist version="1.0">
<dict>
<string>YES</string>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>MGLMapboxAccessToken</key>
<string>Mapbox-key-not-visible</string>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<key>NSLocationAlwaysUsageDescription</key>
<key>NSPhotoLibraryUsageDescription</key>
<key>NSCameraUsageDescription</key>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to location when open.</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</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>project1</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist
the error im facing while building up the app is:
ERROR:
Users/apple/flutter-practice/Project-Casky/casky/ios/Runner/Info.plist: Property List error: Found non-key inside <dict> at line 10 / JSON error: JSON text did not start with array or object and option to allow fragments not set.
Xcode build done. 24.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: unable to read property list from file: /Users/apple/flutter-practice/Project- Casky/casky/ios/Runner/Info.plist: The operation couldn’t be completed. (XCBUtil.PropertyListConversionError error 1.) (in target 'Runner' from project 'Runner')
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Exited (sigterm)
GUYS I can't find a solution to this. Kindly help me in anyway possible. Thanks in advance.
The error error: unable to read property list from file: Info.plist is usually caused by missing config on the plist file. As previously mentioned in the comments, you need to have a value set on NSLocationWhenInUseUsageDescription. More details are explained in the package's docs.
<key>NSLocationWhenInUseUsageDescription</key>
<string>[Your explanation here]</string>
In my case, it was because the Info.plist file was poorly formatted. It hasn't to do with XML format, because when I tried to find if that file was correctly formatted according to XML rules, it was ok, but when I tried to open the .plist file as a property list, I realized Xcode couldn't read it, so I added my keys using the property list utility, not the "code view".
I have been facing the same problem with a newly imported Flutter project. After some debugging, it seems like the issue was caused by a corrupt GoogleService-Info.plist file! Dunno why and how it was corrupted, because I have newly imported and existing project.
To solve this problem, you can follow those steps;
Open your project in XCode
delete the existing GoogleService-Info.plist file
download the original one from Firebase
then reimport/re-copy this file into your project
When this is done, run flutter clean then try running it in iOS Simulator
This worked for me, hope it solves your problem too.
I solved this issue by including <string/> after each <key>...</key> like this :
<key>NSPhotoLibraryUsageDescription</key>
<string />
<key>NSCameraUsageDescription</key>
<string />
<key>NSMicrophoneUsageDescription</key>
<string />

ERROR ITMS-90207 Apple Store Submisson

My app works perfectly when I'm running it on the simulator or device (for debug and release build configuration). But when I try to submit my app to the Apple Store I got the following error:
ERROR ITMS-90207: "Invalid Bundle. The bundle at 'APPNAME.app' does
not contain a bundle executable."
I tried to upload the archive with Xcode and Application Loader, without success.
I have tried some of the solutions found in this topic (Xcode App Submisson ERROR ITMS-90207: "Invalid Bundle) but none of them work with my project:
CFBundleExecutable is declared in my plist file as $(EXECUTABLE_NAME)
I tried to disable Bitcode
I tried to remove all CFBundleExecutable form Pods plist files (keep only the one from my target's plist)
Maybe this error is related to Xcode version... My mac is running macOS Sierra Version 10.12.6 Beta (16G8c), Xcode Version 8.3.2 (8E2002) and Application Loader Version 3.0 (620).
Any help is welcome.
UDPATE:
I try with Xcode 8.2, I have the same error.
Here is my plist file for more detail:
<?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>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>APPNAME</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>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb000000</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>639</string>
<key>FacebookAppID</key>
<string>000000</string>
<key>FacebookDisplayName</key>
<string>APPNAME</string>
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Description...</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Description...</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Description...</string>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<false/>
</dict>
</dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
UDPATE 2:
I managed to publish the archive from another mac with Xcode 8.2.1.
I try with Xcode version 8.2 an 8.2.1 on my mac, but I still have the same error.
I have also tried Application Loader version 3.0 and 3.6, without success...
So it looks like, the problem comes from my mac. I have no idea what to do.
I have contacted the Apple Developer Technical Support, and as #Larme suggest in the comments above, the error is due to my beta version of macOS.
Here is the full Apple support answer:
I looked at the .ipa you provided that was giving trouble, and
compared it to the one successfully submitted to the App Store. The
one giving you trouble was built on a beta version of macOS, which is
not supported for distribution. Apps released to the App Store need to
be built for a GM version of macOS, with a GM version of Xcode, using
a GM version of the iOS SDK.
Normally, apps submitted with any beta software receive a message
indicating this problem, and the message you received
was completely misleading.
I am going to complete the Bug Reporter form to report this bug.
Thanks everyone for your help.
Ridiculously enough, you also get this error if you try to submit a 9.0 deployment target app with XCode 9.1. Switchting the deployment target to 11.1 "fixed" it.
My hunch is that it is related to this: https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html
"Deprecations: Apps with a deployment target of iOS 11 no longer build a 32-bit slice. To build and include a 32-bit slice, set the deployment target to an earlier version of iOS. (32163517)"

Cordova Phonegap "Export Failed" error code 70 While building ios

I am currently using Cordova Phonegap to build an application for iOS. It was working fine, but now I'm getting an error when I'm running cordova build ios in the terminal.
I'm getting the following error:
** EXPORT FAILED **
Error: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,RoastBot.xcarchive,-exportOptionsPlist,/Users/JarrodMorgan/Desktop/RoastBot/platforms/ios/exportOptions.plist,-exportPath,/Users/JarrodMorgan/Desktop/RoastBot/platforms/ios/build/device
Any help is appreciated!
This is caused by Xcode 9 expecting certain values in exportOptions.plist located in the path that is displayed in the error message. In your case it is ,/Users/JarrodMorgan/Desktop/RoastBot/platforms/ios/exportOptions.plist.
Here is how exportOptions.plist looks for me:
<?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>compileBitcode</key>
<false/>
<key>method</key>
<string>development</string>
<key>teamID</key>
<string>TEAM_ID_GOES_HERE</string>
<key>provisioningProfiles</key>
<dict>
<key>YOUR_BUNDLE_ID</key>
<string>PROVISIONIG_PROFILE_UUID_WOULD_BE_HERE</string>
</dict>
<key>signingStyle</key>
<string>manual</string>
<key>signingCertificate</key>
<string>iPhone Developer</string>
</dict>
</plist>
Double check that you have provisioningProfiles and signingStyle values in your exportOptions.plist if you don't then you probably have cordova-ios version prior to 4.5.2. This was fixed and released in cordova-ios 4.5.2 please see this PR
In order for your to resolve this error update your cordova-ios to 4.5.2 or later, drop your plugins and platforms and re-add them.
However in my case after upgrading to cordova-ios 4.5.4 I started to see following error:
ld: 270 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It turns out that that was caused by the fact that cordova built cordova-plugin-console into its core and if you have that plugin in your project than you might get the above error. Simply remove cordova-plugin-console and this error will go away. Here is what it says on console plugin's github page:
This plugin is no longer being worked on as the functionality provided
by this plugin is now included in cordova-ios 4.5.0 or greater, and
support is already built in to cordova-windows > 5.0.0. You should
remove this plugin from your applications.
Here is the link to the docs.
You can solve this problem by returning to the old PhoneGap version.
Add this to your config.xml file
<preference name="phonegap-version" value="cli-6.3.1" />

Project wont run on simulator in xcode 8

After upgrading to xcode8, my project will no longer run on the simulator (runs on a device)
Error:
/Users/johnsmith/Library/Developer/Xcode/DerivedData/JT-fnslglvifmonzwhlgrchcqujqiwt/Build/Products/Debug-iphonesimulator/
Assets.bundle: Is a directory
Command /usr/bin/codesign failed with exit code 1
I have deleted the entire deriveddata folder and cleaned the project several times with no success. Any ideas how to fix please?
If you are using CocoaPods (especially an older version), you'll notice that all the resource bundle targets in the pods project file don't have an info.plist.
Set them all using CocoaPods generic Info.plist and it'll run.
This however is not a permanent solution. It will reset on next pod install
https://forums.developer.apple.com/thread/66538
EDIT:
If you don't happen to have a generic plist file in your project already
create a new file Info.plist in Pods Target Support Files/Pods-<App Name>/ and paste this
<?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>CFBundleIdentifier</key>
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
EDIT 2:
Fixed the values above. Apple won't accept it when uploading to App Store the way it previously was.
It shouldn't have CFBundleExecutable
and the CFBundlePackageType should be set to BNDL

Archive upload error: ERROR ITMS-90207 - The bundle does not contain a bundle executable

I have an iOS app developed in Swift 2.1.1 with Xcode 7.2. The app runs perfectly and Xcode creates an archive with no problem, but upon uploading it to the app store (iTunes Connect) I get the following error:
ERROR ITMS-90207: "Invalid Bundle. The bundle at 'My App Name.app'
does not contain a bundle executable."
I have tried any suggestions I could find with no improvement whatsoever. How do I fix this issue? How can I find the cause? Is there a workaround?
I use several libraries with CocoaPods, my Podfile:
platform :ios, '8.0'
use_frameworks!
target 'My App Name' do
pod 'RealmSwift'
pod 'SwiftDateExtension'
pod "JDFTooltips"
end
target 'My App NameTests' do
pod 'RealmSwift'
end
My Info.plist:
<?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>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Text removed</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Text removed</string>
<key>UILaunchStoryboardName</key>
<string>Launch Screen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
I tried any suggestion I could find including:
Bundle id is set in app target, re-added info.plist (source)
CFBundleExecutable is set in the Info.plist (source)
Device connected or not makes no difference (source)
Disabling bit codes
I went into the archive to ensure it contains an executable and the Plist file links to it (from what I can gather) correctly. Even removed spaces in the name to ensure that's not the issue.
Turns out the NSHumanReadableCopyright broke the Info.plist. Completely removing the key from the Info.plist solved the issue (removing just the © character wasn't enough).
I think it's a fair suggestion to anyone experiencing a similar issue to try to submit an archive with a default, unmodified, Info.plist to see if that works. From my experience you can submit as many times as you want so don't hesitate to experiment.
I added the key because Apple suggests doing so in their documentation: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html#//apple_ref/doc/uid/TP40012582-CH28-SW29.
Seems weird and stupid for their verification process to break and point to the executable when they can't interpret the Info.plist.

Resources