how to set facebook app id in iOS - facebook-ios-sdk

I thought an app need to submit the App ID to facebook server to pass OAuth , getting user's permission , then get the active session to read/post information.
I am looking for something like:
Facebook fb = new Facebook("YOUR_APP_ID");
I checked the "Facebook iOS SDK" tutorials and project "HelloFacebookSample" , but did not find any code to set my App ID. How to set my App ID and App Secret? How to make "HelloFacebookSample" to use my App , instead of using the official sample app?
I am using Xcode. Thanks.

you should set it in the Info.plist just before the last </dict> element
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbxxxxxxxxxxxxxxx</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>2.8</string>
<key>FacebookAppID</key>
<string>xxxxxxxxxxxxxxx</string>
<key>FacebookDisplayName</key>
<string>{{Your app name}}</string>
Source: https://developers.facebook.com/docs/ios/getting-started

Related

Session Value not persisted in Azure App Service

Session not persisted in Azure App Service
I have a Web Application in Asp.net MVC, I used to set the session. When I click a LoginButton
Session["FlowType"] : "Auth"
Now the request goes to IdentityServer and during Callback on
I tried to retrieve the session Session["FlowType"] and it gave me null value.
I checked the Azure Affinity Cookie too. It is same, when I checked in fiddler.
Can someone help me with this.
First, make sure the strings is same like 'FlowType'.
Second,you can try to debug your code like below.
Session["FlowType"]="aaa";
string test = Session["FlowType"].ToString();
Check the value of 'test', is null or 'aaa'. If the value of test is correct,maybe you can print Ctrl+Alt+i to open the Immediate Window in Visual Studio. Then you can check when the Session is missing.
The last Step,maybe you can modfiy your web.config to set config about the Session.
I hope the above answers can help you.
Add Pic
How to debug in azure. You also can google it.
step 1: Make sure publish configuration setting. Like pic bellow
step 2: When publish succeed,you can attach debugger
My IDE is vs2019, you can click View-> Cloud Explore ,then you find you sourcegroup and web app.
Like pic, you find it , and click, it will show Attach Debugger, then you
debugger in azure to test.
3. The first debugging will take a long time.

FaceId either crashes or shows error on authentication?

App either hangs with a white screen (if installed from fresh) or shows a error message (if installed over an older 6.X app) "Bootstrap error page: Your app specifies authentication at startup, but there are no credentials. Did you run [[SalesforceSDKManager sharedManager] launch]? Error context: AppLoading"
Should use biometric authentication when passcode policy is enabled in the connected app.
if started from a sample app created with forceios please ensure that you add the required entry in the apps plist for FaceId (NSFaceIDUsageDescription) and try. If upgrading your app from 6.x to 7.x there will be a few changes required for launching your app. Please get a template from forcehybrid and proceed.
<dict>
<key>NSFaceIDUsageDescription</key>
<string>"Unlock the app"</string>
</dict>
This feature is linked with the usage of pin code in your connected app. So please make sure that the connected app in salesforce is setup with that policy.

How do I configure the Firebase SDK for the codelab?

I have followed every instruction as it is in the codelabs tutorial for the FriendlyChat app to the best of my understanding.
I pasted into the index page the code generated from clicking the Add firebase to your web app icon in the console.
However, when I run firebase serve and load the page at localhost:5000, I get an alert telling me I have not configured and imported the Firebase SDK.
How exactly do I configure and import the SDK?
You just have to paste the initialization snippet from:
Firebase Console > Overview > Add Firebase to your web app
in index.html file in web-start folder.
I found the the above answer a bit unclear but managed to solve it with this method in case it helps anyone:
Go to the Firebase main page
Top right (next to your profile image) you'll find 'Go To Console' click on it
There you'll find your 'FriendlyChat' project, click on it
On the left, under the Firebase icon, you'll find a gear icon (settings), go there
Scroll down and you'll find a window with your web apps
There is a title 'SDK setup and configuration '
Make sure you include the 'automatic' code in index.html if you haven't already. It will look similar to this:
<script src="/__/firebase/8.6.3/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="/__/firebase/8.6.3/firebase-analytics.js"></script>
<script src="/__/firebase/init.js"></script>
Make sure you include the 'CDN' code in index.html if you haven't already (remember to put it before any firebase script calls). It will look something like this:
<script src="https://www.gstatic.com/firebasejs/8.6.3/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.6.3/firebase-analytics.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "...",
authDomain: "...",
projectId: "...",
storageBucket: "...",
messagingSenderId: "...",
appId: "...",
measurementId: "..."
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
Note: if you didn't include analytics I suppose you shouldn't include the analytic scripts (just copy and paste the code given to you on the website)
This stopped the alert from showing up for me.

Use Google Analytics in Chrome packaged app?

I have an existing webapp that I'd like to package up as a chrome packaged app, but I'm getting the following error when trying to hit google analytics:
Refused to load the image
'http://www.google-analytics.com/__utm.gif...' because it violates the
following Content Security Policy directive: "img-src 'self' blob:
filesystem: data: chrome-extension-resource:".
Adding content_security_policy to my manifest.son as described here seems to be out of date and is giving me the error.
There were warnings when trying to install this extension:
'content_security_policy' is only allowed for extensions and legacy
packaged apps, but this is a packaged app.
What is the package app way to register a google analytics page view?
The apps documentation says:
Your Chrome App can only refer to scripts and objects within your app, with the exception of media files (apps can refer to video and audio outside the package). Chrome extensions will let you relax the default Content Security Policy; Chrome Apps won’t.
Use chrome-platform-analytics version of the GA script that supports apps
Include the GA script in your app package, load it as a local script:
<script src="google-analytics-bundle.js"></script>
<script src="mainwindow.js"></script>
Add the necessary permissions in manifest.json:
"permissions": ["https://www.google-analytics.com/*"]
Initialize it:
service = analytics.getService('my_app');
service.getConfig().addCallback(function(config) {
console.log(config.isTrackingPermitted());
config.setTrackingPermitted(true);
});
// Get a Tracker using your Google Analytics app Tracking ID.
tracker = service.getTracker('UA-XXXXX-X');
// Record an "appView" each time the user launches your app or goes to a new
// screen within the app.
tracker.sendAppView('MainView');
The code is quoted from Google analytics app in the official app samples repository on github.

UIAlertView and UIWebView don't work after migration to Xcode 7

I wrote the below swift code in Xcode 7, but 'UIAlertView' was deprecated in iOS 9.0. Moreover, the webview display nothing. It was working well in Xcode 6.
#IBOutlet weak var WebView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.backgroundColor = UIColor.redColor()
let alert = UIAlertView(title: "This App needs internet connection",
message: "If not connected now, please make sure your device connect to internet and restart it.",
delegate: nil,
cancelButtonTitle: "OK")
alert.show()
let URL = NSURL(string: "http://saloonjob.com/catering")
WebView.loadRequest(NSURLRequest(URL: URL!))
}
1)UIAlertView
Starting from iOS8, UIActionSheet and UIAlertView are being replaced by the new UIAlertController.
An instance of the UIAlertController can be presented modally on screen just as any other UIViewController using the presentViewController:animated:completion: method. What makes the UIAlertController instance differentiate between working as an ActionSheet or as an AlertView is the style parameter you pass when creating it.
2)WebView
“If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible,” Apple explains in its pre-release documentation for iOS 9.
check with HTTPS url ,webview will load..
2) WebView:
It is not enough to use HTTPS.
In addition, the server should support the latest SSL technology.
Please read this article:
http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/
If you don't have control on the server side then you can add this flag to the info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<!--Include to allow all connections (DANGER)-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Pay attention to the DANGER note, you should avoid this solution.

Resources