iOS Touch ID no password button wanted - ios

Touch ID presents two buttons in its view, “Enter Password” and “Cancel” and I can’t find documentation on how to ask for fingerprints only, apps like Withings can successfully do it, asking only for fingerprints without the password button (just the cancel one).
How they can make it?

Simply set the myContext.localizedFallbackTitle to an empty string
LAContext *myContext = [[LAContext alloc] init];
myContext.localizedFallbackTitle = #"";
NSError *authError = nil;
NSString *myReasonString = #"Authentication required";

Related

Is it possible to get the value of USE TOUCHID FOR iPhone unlock in default settings

Is it possible to Access Default settings > TouchID & Passcode > iPhone Unlock toggle value.
As far as I know, it's not possible.
NO. there is no way to know if user has opted for using TouchID for Unlocking phone.
There is method canEvaluatePolicy: error:
But this tells you if TouchId is configured / Enabled or Not Configured/Not Enabled. If you want to check for Availability of touch Id for your app, you can use canEvaluatePolicy: error:
-(void)canEvaluatePolicy {
LAContext *context = [[LAContext alloc] init];
__block NSString *message;
NSError *error;
BOOL success;
// test if we can evaluate the policy, this test will tell us if Touch ID is available and enrolled
success = [context canEvaluatePolicy: <BR>LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
if (success) {
message = [NSString stringWithFormat:#"Touch ID is available"];
}
else {
message = [NSString stringWithFormat:#"Touch ID is not available"];
}
[super printMessage:message inTextView:self.textView];
}
you can find fully working code from developer.apple.com website:
https://developer.apple.com/library/content/samplecode/KeychainTouchID/Listings/KeychainTouchID_AAPLLocalAuthenticationTestsViewController_m.html
I don't know why you would want to know that however, you can always check if the device supports TouchID and if it has been setup by the user. You do this by creating an LAContext (Local Authentication Context) and calling the function canEvaluatePolicy:error:. That is all I think you can find out about the TouchID settings on a given iPhone through an app. I hope this helps a little :)

Open Graph Facebbok SDK2.5

I'm a bit confused about all the open graph mechanism for request and send objects.
Currently I'm doing the following:
FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
gameRequestContent.message = [SPBLabelUtils stringMessageForKey:#"FacebookAskLivesMessage"];
gameRequestContent.recipients = friends;
gameRequestContent.objectID = #"794790780644074";
gameRequestContent.actionType = FBSDKGameRequestActionTypeAskFor;
FBSDKGameRequestDialog *dialog = [[FBSDKGameRequestDialog alloc] init];
dialog.frictionlessRequestsEnabled = TRUE;
dialog.content = gameRequestContent;
dialog.delegate = self;
NSError *error;
if([dialog canShow] && [dialog validateWithError:&error]){
[dialog show];
}else if(error){
[self showAlertForError:error];
}
else{
[self showAlertWithMessage:[SPBErrors messageForCode:#"FBE:CantShowDialog"] title:[SPBLabelUtils stringMessageForKey:#"FacebookTitle"]];
}
and getting the following error in my:
- (void)gameRequestDialog:(FBSDKGameRequestDialog *)gameRequestDialog didFailWithError:(NSError *)error
Error Domain=com.facebook.sdk.share Code=2 "The operation couldn’t be
completed. (com.facebook.sdk.share error 2.)" UserInfo=0x17887f7c0
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Sorry, this feature
isn't available right now: An error occurred while processing this
request. Please try again later.}
I'm not sure I completely understand the objectID idea - do I need to create an object every time I need to ask for it?
And if I do, do I need to use the 'create code' and link it to a page to a page that contains all the metadata?
Why would I create a new object every time? I don't even need to read it, just to inform the other players that they have an object request pending.
The API is not 100% clear tbh.
If someone can explain\give a tutorial link\post sample code it'll be lovely.
Thanks
Where did you get the ID for your Object? The one you are using is a sample object. You will need to create (at least) one real Open Graph object, which you can use in your code to refer to.
I have stucked on this for several hours. Hope someone can find solution on this question in my answer.
In your project settings go to "Open Graph" section on facebook. Create some Object Type. Then there is a button on the top "Tools & support".
After click you will see several links, the one you need is "Object browser".
Object browser is required section. There is on combobox with "Type:" text, It contains our object types that we have created earlier. An there is a button "New object" for selected type.
When you will create New object than It gets his Id.
And that is your Object Id you are looking for.
May be there is a better way to find section "Object Browser".
And one more important thing:
FBSDKGameRequestContent *Content = [[ FBSDKGameRequestContent alloc ] init];
Content.title = #"Title test";
Content.message = #"Test message";
Content.data = #"Test data";
Content.objectID = #"1012001268809871";
Content.actionType = FBSDKGameRequestActionTypeAskFor;
Content.filters = FBSDKGameRequestFilterAppUsers;
fbRequestDialog.content = Content;
fbRequestDialog.delegate = self;
BOOL Result = [ fbRequestDialog show ];
This code works fine for me. So as you can see "objectID" field is string but it represents numeric string. Now you know how does it look like.

Explicit Sharing on Facebook iOS SDK 4.0

I want to explicitly share an open graph action on Facebook using the new iOS 4.0 SDK. The following does not work. It shows up on my Activity Log, but not on my Timeline.
// Construct an FBSDKSharePhoto
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = img;
photo.userGenerated = YES;
// Create an object
NSDictionary *properties = #{
#"og:type": #"theprose:post",
#"og:title": post.title,
#"og:description": post.text,
#"og:caption": #"A fresh picked Prose for you.",
#"og:url": post.url,
#"fb:explicitly_shared": #"true"
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
// Create an action
FBSDKShareOpenGraphAction *act = [[FBSDKShareOpenGraphAction alloc] init];
act.actionType = #"theprose:share";
[act setObject:object forKey:#"theprose:post"];
[act setPhoto:photo forKey:#"image"];
// Create the content
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = act;
content.previewPropertyName = #"theprose:post";
[[FBSDKShareAPI shareWithContent:content delegate:nil] share];
Piecing together the answers from this page, this is what worked for me:
1. Check the Explicitly Shared box
Go to your open graph settings, action types and then choose your custom action. Scroll down to capabilities section and make sure that "explicitly share" box is checked.
2. Set fb:explicitely_shared On Action
[action setString:#"true" forKey:#"fb:explicitly_shared"];
3. Set the Relationship Between Action & Object
Make sure that you know the correct to connect your action to your object. In this case the key is "article":
[FBSDKShareOpenGraphAction actionWithType:#"mynamespace:share" object:object key:#"article"]
You can find that key by looking at the Action Type you created in your FB app's Open Graph settings. When you connected the Action with the Object via a Story, a new key for that relationship appears on the Action's page under the Property Name column.
The original poster is using the namespace:property_name format when what you really need is just the property_name for that key. This could be the fix for the OP.
4. Set the Delegate, Look For Errors
The OP is not taking advantage of the FBSDKSharingDelegate features. It reports errors and will help you fix the problem:
[[FBSDKShareAPI shareWithContent:content delegate:self] share];
And implement the delegate methods in self:
#pragma mark - FBSDKSharingDelegate
- (void) sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results {
NSLog(#"Facebook sharing completed: %#", results);
}
- (void) sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error {
NSLog(#"Facebook sharing failed: %#", error);
}
- (void) sharerDidCancel:(id<FBSDKSharing>)sharer {
NSLog(#"Facebook sharing cancelled.");
}
For Reference, Here's My Working Code
// Create the object
NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithDictionary: #{
#"og:type": #"mynamespace:article",
#"og:title": myModel.title,
#"og:description": #"myModel.description",
#"og:url": #"http://mywebsite.com"
}];
NSURL *imageURL = [myModel getImageURL];
if (imageURL) {
FBSDKSharePhoto *photo = [FBSDKSharePhoto photoWithImageURL:imageURL userGenerated:NO];
[properties setObject:#[photo] forKey:#"og:image"];
}
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
// Create the action
FBSDKShareOpenGraphAction *action = [FBSDKShareOpenGraphAction actionWithType:#"mynamespace:share" object:object key:#"article"];
[action setString:#"true" forKey:#"fb:explicitly_shared"];
// Create the content
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = #"article";
// Share the content
FBSDKShareAPI *shareAPI = [[FBSDKShareAPI alloc] init];
shareAPI.shareContent = content;
shareAPI.delegate = self;
[shareAPI share];
The same problem but works fine with FBSDKShareDialog under the same account. So the problem is in something else.
I got the same problem. I mean the reason in your code is, that you set the fb:explicitly_shared property in the object not in the concerning action.
The following code should solve the issue.
[action setString:#"true" forKey:#"fb:explicitly_shared"];
If your Facebook app is not public, make sure you have the test account added as a Test account, in the Roles section.
Make sure you have requested the publish_actions permission:
https://developers.facebook.com/docs/facebook-login/ios/permissions
You have no delegate assigned to your call, there is a high chance you are not getting the error returned by Facebook
Go to your open graph settings, action types and then choose your custom action. Scroll down to capabilities section and make sure that "explicitly share" box is checked.
It shouldn't work because there is a bug in FB with SDK versions before 4.1:
https://developers.facebook.com/bugs/943100005734949/
https://developers.facebook.com/bugs/1563738347248670
but with SDK version 4.1 this bug is fixed but the content for custom story/action/object was shown in very different way in compare with FSDKShareDialog (((
One more check to the checklist: FBSDKShareApi only works on the main thread. So make sure you are sharing from there.

Facebook iOS - not able to post OpenGraph on Share Dialog

On the following code, when I try to share OG story via Share Dialog, and when I get to the share dialog, the "Post" button isn't enabled (even after I enter text).
I had "something went wrong..." in the FB app, but now I don't have it at all
The rest of the post seems OK.
Another important thing:
Almost a similar variant of this code, but with user generated photo works perfectly, but here the photo is a URL and is not user_generated
The code:
NSString *FacebookAppNamespace = #"my_fb_namespace";
id<FBGraphObject> object = [FBGraphObject openGraphObjectForPost];
FBOpenGraphActionParams *params = [[FBOpenGraphActionParams alloc] init];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
NSString *previewPropertyName;
url = [NSString stringWithFormat:#"%#/facebook.html?al_applink_data=type%%3Drecipe%%26id%%3D%#",APPLINKS_LINK,self.recipeID];
name = self.recipeTitle;
image = self.recipeImage;
description = self.recipeTitle;
object[#"title"] = name;
object[#"type"] = [NSString stringWithFormat:#"%#:recipe",FacebookAppNamespace];
object[#"description"] = description;
object[#"image"] = #[#{#"url": image}]; //NOTE: tried a lot of variants here, thinking this is the cause
object[#"url"] = url;
[action setObject:object forKey:#"recipe"];
params.action = action;
params.actionType = [NSString stringWithFormat:#"%#:cook",FacebookAppNamespace];
previewPropertyName = #"recipe";
if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params]) {
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:params.actionType
previewPropertyName:previewPropertyName
handler:dialogAppErrorHandler];
}
It is confirmed by Facebook that indeed this is a bug in SDK 3.19.
Actually digging deeper says that this is a bug in Facebook app 15.0 so no need to change SDK
I get a similar behavior (it allows me to post, but then i get "oops, something went wrong".
Somehow, when i tagged a friend in the share dialog, suddenly the entire story appeared (two-to-one), and then the posting/sharing works!
Try it!
(I still don't know how to make it work without it :( so it's still unacceptable)

Dropbox Error Opens Another App on device, not on simulator

I have three apps that upload files to Dropbox. Same code for all three. They all share the same folder so I've used same secret key etc
Heres where it gets weird
1. All was fine for few months
2. Now on apps 2 and 3 when the user tries to log in it opens the first app?
3. Logging out and in, no help, just says Theres a an error connecting to Dropbox and to try later
What ive tried
Creating seprate secret keys etc for all three apps rathe rthan sharing the same, still get the same behaviour?
Some research on this suggested that Dropbox has changed the way it links to users accounts through applications and remins linked even if you delete the app? Has anyone else got any experience with this?
Appdelegate
NSString* appKey = #"00000000000";
NSString* appSecret = #"0000000000";
NSString *root = kDBRootAppFolder;
DBSession* session =
[[DBSession alloc] initWithAppKey:appKey appSecret:appSecret root:root];
session.delegate = self; // DBSessionDelegate methods allow you to handle re-authenticating
[DBSession setSharedSession:session];
[DBRequest setNetworkRequestDelegate:self];
Button Handler in viewController
LogCmd();
self.publishButtonPressed = YES;
if (![[DBSession sharedSession] isLinked]) {
[self loginLogoutButtonPressed:nil];
} else {
DBRestClient *restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
restClient.delegate = self;
NSError *error = nil;
NSString *filePath = [ICUtils pathForDocument:self.fileName];
[self.pdfData writeToFile:filePath options:0 error:&error];
if (nil == error) {
[restClient uploadFile:self.fileName
toPath:#"/"
withParentRev:nil
fromPath:filePath];
} else {
[ICUtils raiseAlertWithTitle:#"An error occurred" message:[error localizedDescription]];
}
}
}
Note works ok on the simulator, problem is only present on device
That is because you are using the same key for multiple applications. The Dropbox app is communicating with your app through a custom URL scheme - to launch your app (because there is no other way to launch apps programmatically on iOS).
In other words, the Dropbox app tells the system to open "db-yoursecretkey://somemessage" which opens the registered app for that custom URL scheme. Unfortunately, all of your apps use the same custom scheme as they are all using the same key, so the system just picks one: most likely the first one.
However, you can grant your apps access to all folders in dropbox, thus effectively sharing folders. So it's not really necessary to have all three apps using the same key.

Resources