I'm trying to add authentication via Facebook onto my app, within my plist I have:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb146156719258538</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>146156719258538</string>
<key>FacebookDisplayName</key>
<string>applicationTest</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
In my AppDelegate I have a method:
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
let appId = FBSDKSettings.appID()
print("app id:" + appId!)
print("url id:" + String(url.scheme!.hasPrefix("fb\(appId)")))
print("url host:" + String(describing: url.host))
if url.scheme != nil && url.scheme!.hasPrefix("fb\(appId)") && url.host == "authorize" { // facebook
return FBSDKApplicationDelegate.sharedInstance().application(app, open: url, options: options)
}
return false
}
When the FB login button is clicked in my ViewController, you would then expect the code within the IF statement of the AppDelegate method to be executed. However this returns false, i've debugged the code and it appears that the line:
url.scheme!.hasPrefix("fb\(appId)")
Is returning false even though the correct appId is being printed.
Does anyone know why this is happening?
P.S: Printing the url.scheme gives:
fb146156719258538
Have you configured the settings on your Facebook account correctly?
Related
I have built an ios app which is using azure ad login and it was working fine but after install microsoft authenticator app the azure ad login is not working anymore
in fact the alert which does say " app wants to use 'microsoftonline.com' to sign in"
not coming
and uninstalling the authenticator my ios app can login via azure ad again
let kClientID = [clientid]
let kGraphEndpoint = "https://graph.microsoft.com/"
let kAuthority = "https://login.microsoftonline.com/xxxxxxxxx"
let kRedirectUri = [URI]
let kScopes: [String] = ["user.read"]
func initMSAL() throws {
guard let authorityURL = URL(string: kAuthority) else {
print("Unable to create authority URL")
return
}
let authority = try MSALAADAuthority(url: authorityURL)
let msalConfiguration = MSALPublicClientApplicationConfig(clientId: kClientID,
redirectUri: kRedirectUri,
authority: authority)
self.applicationContext = try MSALPublicClientApplication(configuration: msalConfiguration)
self.initWebViewParams()
}
func initWebViewParams() {
self.webViewParamaters = MSALWebviewParameters(authPresentationViewController: self)
}
func acquireTokenInteractively() {
guard let applicationContext = self.applicationContext else { return }
guard let webViewParameters = self.webViewParamaters else { return }
let parameters = MSALInteractiveTokenParameters(scopes: kScopes, webviewParameters: webViewParameters)
parameters.promptType = .selectAccount
applicationContext.acquireToken(with: parameters) { (result, error) in
if let error = error {
print("Could not acquire token: \(error)")
return
}
guard let result = result else {
print("Could not acquire token: No result returned")
return
}
self.accessToken = result.accessToken
let aduser=MicrososftUser.init(id: result.uniqueId ?? "", mail: result.account.username ?? "", givenName: result.account.username ?? "", surname: "");
self.adLoginRequest(aduser: aduser)
//self.getContentWithToken()
}
}
info.plist
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>msauth.$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.674973595907-gsm9poebb8u1vvb28rvt7osv</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>msalv2</string>
<string>msaalv3</string>
<string>msauthv2</string>
<string>msauthv3</string>
</array>
<key>UIAppFonts</key>
<array>
<string>Inter.ttf</string>
<string>Inter-Black.ttf</string>
<string>Inter-ExtraLight.ttf</string>
<string>Inter-Regular.ttf</string>
<string>Inter-Bold.ttf</string>
<string>Inter-Light.ttf</string>
<string>Inter-SemiBold.ttf</string>
<string>Inter-ExtraBold.ttf</string>
<string>Inter-Medium.ttf</string>
<string>Inter-Thin.ttf</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>processing</string>
<string>remote-notification</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
</plist>
when i click on azure ad login button the following error is showing in debug window
Could not acquire token: Error Domain=MSALErrorDomain Code=-50000 "(null)" UserInfo={MSALErrorDescriptionKey=Failed to delete broker key with error: -34018, MSALInternalErrorCodeKey=-42708, MSALCorrelationIDKey=4A0C2756-0173-7068-AC4F-AFEC1C84BCB3}
could any one help me with this issue
sorry for my bad english
solving the issue by disabling the access from my app to authenticator.
Adding the following line in initMSAL function
MSALGlobalConfig.brokerAvailability = .none
got help from following links:
https://github.com/AzureAD/microsoft-authentication-library-for-objc/issues/845
https://github.com/AzureAD/microsoft-authentication-library-for-objc/blob/dev/MSAL/src/public/configuration/MSALGlobalConfig.h#L74
wonder if anyone can help me. I have an app and I'm trying to move some files into iCloud so they'll show up in "Files" and cloud to other devices. I've been going through lots of resources online researching what's wrong, and nothing seems to help.
In my app project, I have turned on iCloud Documents in capabilities.
In my plist file, I have this:
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.com.mypublishername.myappname</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>myappname</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
In my entitlements file I have:
<dict>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.mypublishername.myappname</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.com.mypublishername.myappname</string>
</array>
</dict>
in ObjC, I'm fetching the iCloud folder like so:
NSURL *rootDirectory = [[[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]URLByAppendingPathComponent:#"Documents"];
if (rootDirectory)
{
if (![[NSFileManager defaultManager] fileExistsAtPath:rootDirectory.path isDirectory:nil]) [[NSFileManager defaultManager] createDirectoryAtURL:rootDirectory withIntermediateDirectories:YES attributes:nil error:nil];
gCloudFolder=rootDirectory;
}
Then, when I save a file, I do so locally, and move it into the cloud folder like this:
//
// theFilename is a file in the app's documents folder...
//
int aFile=creat(theFilename,S_IREAD|S_IWRITE);close(aFile);
aFile=open(theFilename,O_BINARY|O_RDWR);
if (aFile)
{
write(aFile,theDataPtr,theLen);
close(aFile);
if (gCloudFolder)
{
NSURL *aLocalStr=[NSURL fileURLWithPath:[NSString stringWithUTF8String:theFilename]];
NSURL *aCloudStr=[gCloudFolder URLByAppendingPathComponent:#"testing_file.txt"];
NSError *error;
if (![[NSFileManager defaultManager] setUbiquitous:YES itemAtURL:aLocalStr destinationURL:aCloudStr error:&error]) NSLog(#"iCloud Error occurred: %#", error);
}
So... what happens. This file DOES get created. If I run this twice, it tells me it can't move to testing_file.txt because it already exists. Also, if I try to setUbiquitous:NO on the file, it tells me I can't set it to no when the file hasn't been synced.
Any idea why my app's folder and this file don't show up in my FILES folder under iCloud?
I have increased the bundle version, which is something I've seen elsewhere. Did nothing.
What am I doing wrong?
This completely stunned me; I had no idea it was possible. I'll just describe my test app in full. It's going to look a lot like yours!
Here is the bundle identifier:
Here is the entitlement:
Here is the entitlement text:
<?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>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.neuburg.matt.SaveIntoFilesApp</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.com.neuburg.matt.SaveIntoFilesApp</string>
</array>
</dict>
</plist>
Here is the entry in the Info.plist:
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.com.neuburg.matt.SaveIntoFilesApp</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>MyApp</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
Here is the app delegate:
var ubiq : URL!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
DispatchQueue.global(qos:.default).async {
let fm = FileManager.default
let ubiq = fm.url(forUbiquityContainerIdentifier:nil)
print("ubiq: \(ubiq as Any)")
DispatchQueue.main.async {
self.ubiq = ubiq
}
}
return true
}
Here is the button I tap:
#IBAction func doButton (_ sender:Any) {
if let del = UIApplication.shared.delegate as? AppDelegate {
if let ubiq = del.ubiq {
do {
let fm = FileManager.default
let docs = ubiq.appendingPathComponent("Documents")
try? fm.createDirectory(at: docs, withIntermediateDirectories: false, attributes: nil)
let url = docs.appendingPathComponent("test.txt")
print("here we go")
try? fm.removeItem(at: url)
try "howdy \(Date())".write(to: url, atomically: true, encoding: .utf8)
print("saved")
} catch {
print(error)
}
}
}
}
I did have to increment the bundle version (from 1 to 2) and I did have to kill and restart the Files app. And then I saw my file (and can open and examine it):
login I have problem
2020-05-17 06:44:38.565714-0700 OuthFairbeass[3744:135615] [default] Failed to open URL twitterauth://authorize?consumer_key=5WnJxeILzBOa2ujeKFsbOiooz&consumer_secret=6EyBR9KvtO055Rrbt4EqM9oQW3xiZtxrR3alAjxkcRXyVlmjpW&oauth_callback=twitterkit-5WnJxeILzBOa2ujeKFsbOiooz&identifier=pzoIhelxQVsJcW5h0eUbduxjzw8Lr+fk8qFg6Xx6qtNeo6nTdPgprnMhLqbqqkrX: Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=247, _LSFunction=-[_LSDOpenClient openURL:options:completionHandler:]}
2020-05-17 06:44:39.546329-0700 OuthFairbeass[3744:135619] Local time is off from UTC by -35995.546318 seconds
2020-05-17 06:44:39.546526-0700 OuthFairbeass[3744:135452] [TwitterKit] Error obtaining user auth token.
(lldb)
In the info plist, everything is fine. Also, enter the application on Twitter. Add Callback URLs
Special Firebase, but I do not know what the problem is, please help
#IBAction func clickedLoginBtn(_ sender: Any) {
TWTRTwitter.sharedInstance().logIn { (session, error) in
if session != nil{
let client = TWTRAPIClient.withCurrentUser()
client.requestEmail { email, error in
if (email != nil) {
UserDefaults.standard.set(email, forKey: "email")
} else {
print("error: \(error!.localizedDescription)");
}
}
}
}
here my file info. plist
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbapi2016032888</string>
<string>fbauth</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>twitter</string>
<string>twitterauth</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>FacebookAppID</key>
<string>1462236107289657</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>FacebookDisplayName</key>
<string>OuthChat</string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb146223610728</string>
</array>
</dict>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>twitterkit-xeILzBOa2ujeKFsbOiz</string>
</array>
</dict>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
</dict>
</array>
</dict>
</dict>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
TWTRTwitter.sharedInstance().start(withConsumerKey:"xeILzBOa2ujeKFsbOiz", consumerSecret:"4EqM9oQW3xiZtxrR3alAjxkcRXyVlmjpW")
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return TWTRTwitter.sharedInstance().application(app, open: url, options: options)
}
I'm trying to implement Facebook login in my Xamarin.iOS application. I have tried to use Xamarin.Auth package, but sometimes user cannot processed and there are some issues with this package. I found the best way is to implement manual login flow to my application (using web-view). Currently, I have created an app in Faceboook developer portal, and I can access the link from my iOS application.
So, user will click normal button which will be forwarded to Facebook login page. My question is, how can I get the result from Facebook login page? and how can I get user id, email, ... ?
Here is the source code so far:
partial void BtnFacebookLogin_TouchUpInside(UIButton sender)
{
NSUrl apiRequest =
new NSUrl("https://www.facebook.com/dialog/oauth?client_id="
+ SharedResources.fbClientId
+ "&response_type=token&redirect_uri="
+ SharedResources.fbRedirectUrl);
UIApplication.SharedApplication.OpenUrl(apiRequest);
}
I found the answer by using Facebook SDK, which is currently considered as the best existing solution, after your download the official SDK (Xamarin.Facebook.iOS), here are the steps:
In Info.plist file, add these codes:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
Also in Info.plist file, the original view, Advanced tab, URL Types, add your facebook app ID like this way "fb1112222......". Keep 'fb' at the beginning.
Pic: Facebook app ID in Info.plist
In AppDelegate.cs, override these methods:
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
Profile.EnableUpdatesOnAccessTokenChange(true);
Settings.AppID = "fb app id";
Settings.DisplayName = "fb app name";
// This method verifies if you have been logged into the app before, and keep you logged in after you reopen or kill your app.
return ApplicationDelegate.SharedInstance.FinishedLaunching(application, launchOptions);
//return true;
}
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
{
// We need to handle URLs by passing them to their own OpenUrl in order to make the SSO authentication works.
return ApplicationDelegate.SharedInstance.OpenUrl(application, url, sourceApplication, annotation);
}
Lastly, this is the function for Facebook, you can use their own button, or use your button. In my way, I used my button with the name (BtnFacebookLogin).
//Here is the facebook function
private void SetupFacebookLoginButton()
{
List readPermissions = new List { "public_profile", "email" };
////Set Up Button Design
var fbBtnText = new NSAttributedString("login with facebook", new
UIStringAttributes()
{
ForegroundColor = UIColor.White
});
BtnFacebookLogin.SetAttributedTitle(fbBtnText, UIControlState.Normal);
BtnFacebookLogin.SetBackgroundImage(
UIImage.FromBundle("btn_long_blue.png"), UIControlState.Normal);
//Strat Login Functions
Profile.Notifications.ObserveDidChange((sender, e) =>
{
if (e.NewProfile == null)
return;
if (AccessToken.CurrentAccessToken != null)
{
var request = new GraphRequest("/me?fields=name,email", null, AccessToken.CurrentAccessToken.TokenString, null, "GET");
request.Start((connection, result, error) =>
{
// Handle if something went wrong with the request
if (error != null)
{
showAlert("Error", error.Description);
return;
}
fbReponseFromSDK facebookSDKLoginItem = new fbReponseFromSDK();
// Get your profile name
var userInfo = result as NSDictionary;
if(userInfo["id"] != null)
{
Console.WriteLine("id is: " + userInfo["id"].ToString());
}
if (userInfo["name"] != null)
{
Console.WriteLine("name is: " + userInfo["name"].ToString());
}
if (userInfo["email"] != null)
{
Console.WriteLine("email is: " + userInfo["email"].ToString());
}
//(Success) Do what you want next :
doneFacbookLogin();
});
}
});
// Handle actions once the user is logged in
BtnFacebookLogin.ReadPermissions = readPermissions.ToArray();
BtnFacebookLogin.Completed += (sender, e) =>
{
if (e.Error != null)
{
// Handle if there was an error
showAlert("Facebook Login", e.Error.Description);
return;
}
if (e.Result.IsCancelled)
{
// Handle if the user cancelled the login request
//showAlert("Facebook Login", "Login Cancelled");
return;
}
showAlert("Facebook Login", "Login Successfull");
};
// Handle actions once the user is logged out
BtnFacebookLogin.LoggedOut += (sender, e) =>
{
// Handle your logout
};
// If you have been logged into the app before, ask for the your profile name
if (AccessToken.CurrentAccessToken != null)
{
var request = new GraphRequest("/me?fields=name,email", null, AccessToken.CurrentAccessToken.TokenString, null, "GET");
request.Start((connection, result, error) =>
{
// Handle if something went wrong with the request
if (error != null)
{
showAlert("Error", error.Description);
return;
}
// Get your profile name
});
}
}
For more info, refere to their samples in GitHub (Link)
Looking around and especially following the Pinterest API docs, I think I've set everything up correctly, but still get error NSError: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: unauthorized (401)" when I try to log in. Granted the SDK docs are in Objective-C, but I think my Swift conversion looks ok? The only thing I can think of is that they have to approve the APP ID on their end maybe?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
PDKClient.configureSharedInstanceWithAppId("XXX")
return true
}
func application(application: UIApplication, handleOpenURL url: NSURL) -> Bool {
let pdkClient: PDKClient = PDKClient.sharedInstance()
return pdkClient.handleCallbackURL(url)
}
PDKClient.sharedInstance().getAuthenticatedUserPinsWithFields(Set(["id", "image", "note"]), success:
{ (pdk :PDKResponseObject!) -> Void in
print("success /(pdk)")
}) { (err :NSError!) -> Void in
print("error NSError: \(err)")
}
<key>LSApplicationQueriesSchemes</key>
<array>
<string>pinterestsdk.v1</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>pinit</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
I think I was missing another key in my info.plist, I added the below (that I found in the SDK's example app) and I'm authenticating successfully now:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>pdkXXX</string>
</array>
</dict>
</array>
Before making call to the getAuthenticatedUserPinsWithFields method ensure that you have proper permissions.
if(PDKClient.sharedInstance().authorized == false)
{
PDKClient.sharedInstance().authenticateWithPermissions([PDKClientReadPrivatePermissions,PDKClientReadPublicPermissions,PDKClientReadRelationshipsPermissions,PDKClientWritePublicPermissions,PDKClientWritePrivatePermissions,PDKClientWriteRelationshipsPermissions], withSuccess: { (response : PDKResponseObject!) -> Void in
// call getAuthenticatedUserPinsWithFields method here
}, andFailure: { (error : NSError!) -> Void in
print(error.description)
})
}