Is there any support for using Facebook SDK (app events to be specific) in Flutter? - flutter

I would like to add the Facebook app-events to my Flutter project: https://developers.facebook.com/docs/app-events/android https://developers.facebook.com/docs/app-events/ios
May I know should Flutter users implement their plugin to use the Facebook features?

You can integrate Facebook app events using this package called facebook_app_events(null-safety).
Android Setup:
STEP 1: goto your_project\android\app\src\main\res\values create a new file called strings.xml (if you don't have any already)
In the strings.xml file just paste this
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="facebook_app_id">[APP_ID]</string>
</resources>
Don't forget to replace [APP_ID] with the original APP_ID you got from Facebook e.g
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="facebook_app_id">1234567890</string>
</resources>
STEP 2: goto your_project\android\app\src\main\AndroidManifest.xml and paste this under your app <application> open tag
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
Android setup done.
iOS setup:
goto one_app\ios\Runner\info.plist file and add
If your code does not have CFBundleURLTypes, add the following just
before the final </dict> element:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb[APP_ID]</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>[APP_ID]</string>
<key>FacebookDisplayName</key>
<string>[APP_NAME]</string>
If your code already contains CFBundleURLTypes, insert the
following:
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb[APP_ID]</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>[APP_ID]</string>
<key>FacebookDisplayName</key>
<string>[APP_NAME]</string>
iOS setup is done
NOTE: don't forget to add the package to your pubspec.yaml file
dependencies:
facebook_app_events: ^0.12.0

So far, you can find the facebook_app_events package at pub.dev which is very good. Note that (at the time of writing this answer) the package doesn't support null safety, so you should use it with Dart 2.11 and lower.
There are no official packages from Facebook yet.

Related

Installing ArrayFire python bindings with Canopy (MacOS X Sierra)

I have installed ArrayFire and am trying to get it working within Canopy. I followed these instructions and entered
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
in a Canopy terminal (launched using the 'Tools' menu). Directory /usr/local is the one where ArrayFire libraries are:
ls /usr/local/lib/libaf*
/usr/local/lib/libaf.3.4.2.dylib
/usr/local/lib/libafcpu.3.4.2.dylib
/usr/local/lib/libafcuda.3.4.2.dylib
/usr/local/lib/libafopencl.3.4.2.dylib
/usr/local/lib/libaf.3.dylib
/usr/local/lib/libafcpu.3.dylib
/usr/local/lib/libafcuda.3.dylib
/usr/local/lib/libafopencl.3.dylib
/usr/local/lib/libaf.dylib
/usr/local/lib/libafcpu.dylib
/usr/local/lib/libafcuda.dylib
/usr/local/lib/libafopencl.dylib
After pip-installing arrayfire in the terminal, running python and trying
import arrayfire
does not work:
RuntimeError: Could not load any ArrayFire libraries.
Please look at https://github.com/arrayfire/arrayfire-python/wiki for more information.
I tried instructions in this post and also this one from Enthought support and created the following file ~/Library/LaunchAgents/environment.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>Label</key>
<string>my.startup</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>
launchctl setenv DYLD_LIBRARY_PATH $DYLD_LIBRARY_PATH:/usr/local/lib
</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
without success.
Doing the same in a non-Canopy python is working ok, arrayfire can be imported.
Any idea?

Application failed codesign verification in application loader

I am using xcode 4.2 Build 4C151a. And I failed to submit my app through organizer because this.
But app loader doesn't work either. It just gives a error:
Application failed codesign verification. The signature was invalid, or it was not signed with an iPhone Distribution Certificate.
I check build setting of Project and Targets. The code signing identity of release is iphone distribution.
In Product > Edit Scheme , build configuration has already been change to release.
Xcode gives no error or warning when building and achieving.
After google this error and read the documents of Apple, I use codesign cmd to check my app,
but find nothing wrong:
$ codesign -dvvv /Users/apple/Library/Developer/Xcode/DerivedData/AttentionDetector-gmmelanobmbjlbhahwbarnsctfdk/Build/Products/Release-iphoneos/AttentionDetector.app
Executable=/Users/apple/Library/Developer/Xcode/DerivedData/AttentionDetector-gmmelanobmbjlbhahwbarnsctfdk/Build/Products/Release-iphoneos/AttentionDetector.app/AttentionDetector
Identifier=com.MyCom.MyName.AttentionDetector
Format=bundle with Mach-O thin (armv7)
CodeDirectory v=20100 size=8122 flags=0x0(none) hashes=397+5 location=embedded
CDHash=727f1bb04fb535821626ce50b1a35bc2c638223a
Signature size=4315
Authority=iPhone Distribution: My Name
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=2013-5-6 下午02:43:10
Info.plist entries=28
Sealed Resources rules=3 files=18
Internal requirements count=1 size=148
Then I check the zip file, and find something confusing:
$ codesign -dvvv /Users/apple/Library/Developer/Xcode/DerivedData/AttentionDetector-gmmelanobmbjlbhahwbarnsctfdk/Build/Products/Release-iphoneos/AttentionDetector.zip
/Users/apple/Library/Developer/Xcode/DerivedData/AttentionDetector-gmmelanobmbjlbhahwbarnsctfdk/Build/Products/Release-iphoneos/AttentionDetector.zip: code object is not signed
I am not sure if this matters.
BTW my macbook is 32-bits, but my app is build for iOS 6.1 ( may require 64-bits?).
I just copy the SDK of Xcode 4.6 into my Xcode 4.2. The app works well when debuging in my iPad (iOS 6.1.2).
Thanks for your answer.
EDIT1:
Thanks to #Rushabh. I check the entitlements, which I haven't modified, with
security cms -D -i MyApp.app/embedded.mobileprovision
, getting 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>AppIDName</key>
<string>Attention Detector</string>
<key>ApplicationIdentifierPrefix</key>
<array>
<string>XJJGWB4EW6</string>
</array>
<key>CreationDate</key>
<date>2013-05-04T12:31:30Z</date>
<key>DeveloperCertificates</key>
<array>
<data>
...
</data>
</array>
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>XJJGWB4EW6.com.MyCom.MyName.AttentionDetector</string>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>XJJGWB4EW6.*</string>
</array>
</dict>
<key>ExpirationDate</key>
<date>2014-02-25T12:31:30Z</date>
<key>Name</key>
<string>Attention Detector</string>
<key>TeamIdentifier</key>
<array>
<string>XJJGWB4EW6</string>
</array>
<key>TeamName</key>
<string>My Name</string>
<key>TimeToLive</key>
<integer>297</integer>
<key>UUID</key>
<string>F0636A25-B371-4FEF-906B-C2979028F218</string>
<key>Version</key>
<integer>1</integer>
</dict>
</plist>
There are two differences: I get this line but others don't
<key>aps-environment</key>
Besides, I get
Authority=iPhone Distribution: My Name
instead of
Authority=iPhone Distribution: My Name(XXXXXXXX)
In my keychain access, I find two distribution certifications: one is "iPhone distribution: My name" and the other is "iPhone distribution: My name (XXXXXXXXX)". Both are valid, but can I delete the former one? The former one was created when I first apply for Apple developer account.
EDIT2: fix the problem of "MyName(XXXXX)". I delete one of the certificates, download the new provision file. Now I get My name (XXXXXXX), But the error still exist!

update version in settings bundle fails iphone

I am trying to write a run script that updates version in Root.plist.
This is the script
version=/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString"
$SRCROOT/AppName/AppName-Info.plist /usr/libexec/PlistBuddy
"$SRCROOT/AppName/Settings.bundle/Root.plist" -c "set
PreferenceSpecifiers:1:DefaultValue $version"
Root.plist in settings bundle is
<?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>PreferenceSpecifiers</key>
<array>
<dict>
<key>Title</key>
<string>About</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>1.0.24</string>
<key>Key</key>
<string>version_preference</string>
<key>Title</key>
<string>Version</string>
<key>Type</key>
<string>PSTitleValueSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>
</dict>
</plist>
I have followed instructions from this answer. The version number updates successfully when I create the .ipa and I can see the new version in itunes. But when I try to upgrade the app, device shows '1 item could not be synced. See iTunes for more information'. However if the older app on phone is deleted and a fresh install is made the app installs successfully and correct version appears in phone settings.I am using xcode 4.5.2
Could anyone please help
The following script works to insert the current subversion revision number into our plist:
G_VERSIONRP="`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}`"
G_BUILDRP="`svnversion -n`"
G_TITLERP="MyApp v"
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:0:Title ${G_TITLERP}${G_VERSIONRP} (${G_BUILDRP})" ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Settings.bundle/Root.plist
I tried again a few days later, used the script and did a clean build. Replaced existing copy in iTunes, synched, it worked!! The only step not same as previous attempt was, earlier I had deleted existing copy in iTunes library and dragged in the new one. Not very sure if that was causing the '1 item could not be synced. See iTunes for more information' message but now the correct version does appear in phone settings.

Xcode 4.0 validation error CFBundleVersion

I am trying the Update my iPhone/iPad Application which I had created in Xcode 3.x version.
I have added CFBundleVersion and the other in my Info.plist and I have crossed checked every thing but I am still getting the error which is following below.
This Bundle is Invalid. The Info.plist file is missing the required key: CFBundleVersion (1091)
I am getting it again and again and I have checked the CFBundleVersion which is already in my Info.plist file.
Please help me out
Thanks
Following below is the Info.plist file. I have crossed check it several times
<?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>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleDocumentTypes</key>
<array/>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>icon-57.png</string>
<string>icon-72.png</string>
<string>icon-144.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.my-irc</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.3.5</string>
<key>CFBundleSignature</key>
<string>coRC</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Internet Relay Chat Server</string>
<key>CFBundleURLSchemes</key>
<array>
<string>irc</string>
<string>ircs</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1</string>
<key>CQBuildType</key>
<string>personal</string>
<key>LSMinimumSystemVersion</key>
<string>3.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MVChatCoreCTCPVersionReplyInfo</key>
<string>http://colloquy.mobi</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIRequiresPersistentWiFi</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UTExportedTypeDeclarations</key>
<array/>
<key>UTImportedTypeDeclarations</key>
<array/>
</dict>
</plist>
I had the same problem. I solved it this way. In XCode 4.2 click on the Target. In the summary section, you will see a version and a build number. If you set them both to the same thing, it works. If you just set the version only and ignore the build field you will get the error. This fixed the problem for me.
Sounds like something went wrong in the transition from 3.x to 4.0 A few things to check:
In the Project Target Build Settings make sure that "Info.plist File" is pointing to the right file.
Check that the Version field in the Project Target Summary is the right value
There should actually be two entries (by default) these days: CFBundleVersion and CFBundleShortVersionString though I doubt that's the issue
Make sure you don't have a space before or after "CFBundleVersion"
Else, you should be able to paste your plist here. In Xcode right-click on the plist file and choose Open As > Source Code. That'll give you the raw-xml that you can paste into your question (edit your question to update it).
In my case the CFBundleVersion is composed of the subversion working copy revision number on build. This is done by a script that is found under:
Target -> Build Phases -> Run script
After checking the build log it turns out that the subversion binaries Xcode uses are different from the ones I use on the command line (MacPorts version). The received error is:
svn: The path '.' appears to be part of a Subversion 1.7 or greater /.../
After modification of the line below:
REV=`svnversion -nc | /usr/bin/sed -e 's/^[^:]*://;s/[A-Za-z]//'`
to:
REV=`/opt/local/bin/svnversion -nc | /usr/bin/sed -e 's/^[^:]*://;s/[A-Za-z]//'`
everything works fine again.
I had that problem too. Here is my solution:
Follow the directions Here
Click Product > Clean
Click Window > Organizer
Click Archives
Click Validate

How to regenerate an iPhone Xcode info.plist file

I have moved my iPhone app from one machine to another. In the process my info.plist file seems to have a bad bundle identifier and is not working. I want to create an entirely new info.plist file for my project.
How can I do this?
Here's a clean info.plist for you. Don't forget to replace xxx.yyy, and rename xib file (if required)
<?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>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>CFBundleIdentifier</key>
<string>xxx.yyy.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string>MainWindow</string>
</dict>
</plist>
If you just want an empty info.plist file, then just select "New File..." on the "File" menu in XCode.
In the "New File" window you pick "Other" on the left hand and then "Property List" on the right hand.
I had problem finding "Info.plist" file too, especially that some C++ test application target doesn't have "Info" tab, so modification in this file had to be done manually.
To find it:
Select project in project navigator
Select desired target (project can have multiple targets)
Select tab "build Settings"
Search for entry "Info.plist File". There you should find path of this file
Tested on Xcode 7.3.
In my case I had to "Allow Arbitrary Load" in "App Transport Security Settings" to restore insecure HTTP protocol.