Creating a note in a Evernote linked notebook - ios

I have some issue creating a note in a linked notebook with the iOS evernote SDK.
I've tried to simply get the noteStore in question by
EvernoteNoteStore* noteStore = [EvernoteNoteStore noteStoreForLinkedNotebook:self.linkedNotebook];
I've then attempted to create a note with
[noteStore createNote:note success:success failure:^(NSError *error) {
NSLog(#"%#", error);
}];
This always ends in an error saying I don't have permission to create the note.
I have further tried to authenticate with the shared key in my linked notebook but have there also been stopped with the same error in the failure block.
[noteStore authenticateToSharedNotebookWithShareKey:self.linkedNotebook.shareKey success:^(EDAMAuthenticationResult *result) {
[noteStore createNote:note success:success failure:^(NSError *error) {
NSLog(#"%#", error);
}];
} failure:^(NSError *error) {
NSLog(#"%#", error);
}];
How can I go about the issue of creating a note in a linked notebook?

OK. So if your permissions are correct, I guess there's an error in the process.
I just published a blog post on this : http://laurent.sarrazin.io/2014/05/evernote-api-create-notes-in-a-linked-notebook.html It's in PHP but the process would be the same in other languages.
I guess you're not setting the notebook guid when creating the note. You can obtain this guid by calling the getSharedNotebookByAuth method. Don't use the linked notebook guid ! It would result in an EDAMNotFoundException.

Are you sure that you have the right permissions ? i.e. write permissions on the notebook.

Related

Core Data Requests from Today Extension returning 0 results?

I'm working on a simple app, and am looking to include some Core Data functionality from the Today Widget. It's giving me some trouble however, and I'm not sure what it is I'm missing.
Here's what I have done:
I've added the widget target to the Core Data model
I have NOT added my entity subclasses. This opens a can of worms with a bunch of sharedApplication references. I don't need to do much within the widget, so I think it will be much easier to just work with NSManagedObject instances.
In viewDidLoad of the widget I create a persistent container:
NSPersistentContainer *myContainer = [[NSPersistentContainer alloc] initWithName:#"MyDataModelName"];
[myContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) {
if (error != nil) {
NSLog(#"Unresolved error %#, %#", error, error.userInfo);
abort();
}
}];
So far so good, and no error is returned.
However, no results are returned when I call:
[myContainer.viewContext executeFetchRequest:request error:&error];
Entity Name and predicates don't seem to make a difference. No request error is returned. Identical requests work fine within the app proper.
It would seem that I am maybe initiating an empty container instead of grabbing the correct one? I'm sure this is a simple thing, but I'm at a loss. Any help is appreciated.

Is it possible to post 360 Photos to Facebook from an iOS App?

I am looking for a way to post 360 photos on Facebook through my iOS app.
I have been searching on google and couldn't find any useful answer.
Could anyone please clarify about the possibility?
Ok, finally I found this thread.
It seems Facebook reads metadata to recognize 360 degree photos.
I've created a framework that does exactly this.
Given that you've got the permission successfully, here's what you would do:
[[Facebook360Manager sharedInstance] shareImage:[UIImage imageNamed:#"cylindrical360.jpg"]
userCaption:#"Example caption..."
horizontalFOV:360.0
sharePreference:FacebookShareManagerPreferenceCylindricalImage
completionBlock:^(NSError * _Nullable error, NSString * _Nullable postID) {
if (error) {
NSLog(#"Error: %#",error);
}else{
NSLog(#"Shared successfully. Post ID: %#",postID);
}
}];
Here's a link to the framework: https://github.com/AppCoders-io/Facebook360

Parse.com caching with localDataStore enabled

I have caching problems in the iOS-Parse-SDK and I don't know what is wrong. I'm using the local datastore and it runs smoothly. But sometimes when I call a PFCloud function I don't get the current but an old version of an object or at least some fields of it are old (in my case it is a custom object with the field "status"). The strange thing is if I call the same function in the dev console on the Parse site I get the updated object. Is there anything I can do to prevent caching within the app or at least make sure I get the current version of an object?
Example PFCloud call:
[PFCloud callFunctionInBackground:#"importFriends"
withParameters:#{#"phoneNumbers": numbers}
block:^(NSDictionary *result, NSError *error) {
if (!error) {
DDLogDebug(#"Request Send Numbers SUCCESS: %#", result); //result objects are out of date
if (successBlock) successBlock(result);
}else{
DDLogDebug(#"Request Send Numbers FAIL: %#", error);
if (failedBlock) failedBlock(error);
}
}];
It seem like when you use the localdatastore and custom classes for any object you can't overwrite it's setters otherwise parse will never change it again. Even though the setter did exactly what a normal setter would do just a little bit more math afterwards.

Parse unpinFromBackground doesn't work

I'm currently using Parse to save details about users in an app. When the ViewController is loaded for the first time, the user data is retrieved from the server. When the user leaves the ViewController, I use the code [user pinInBackground] to save user variables to the local datastore. When the ViewController is reloaded later, the user variables are set using the data from the local datastore. This works correctly in my app.
However, when the user leaves to a specific view controller, on returning to the original ViewController, I wish for the app to access the data from the server instead of the local datastore. To do this, I use the code:
[user fetchFromLocalDatastoreInBackgroundWithBlock:^(PFObject *object, NSError *error) {
[user unpinInBackgroundWithName:#"MAINPIN" block:^(BOOL succeeded, NSError *error) {
[user fetchInBackgroundWithBlock:^(PFObject *object, NSError *error) {
NSLog([NSString stringWithFormat:#"personalHeaderString is equal to %#", user[pfPersonalHeader]]);
}];
}];
}];
The NSLog shows that the code is definitely run as intended. However, the NSLog also shows that the data is not unpinned, and instead the app continues to use data from the local datastore, rather than fetching the data from the Parse server as fetch is supposed to do. How can I fix this?
All help appreciated.
Is there a reason that you are fetching from the local datastore before you unpin? I'm guessing that when you pin the result initially you give it the name "MAINPIN" so why not use:
PFObject.unpinInBackgroundWithName:("MAINPIN")
and then run a your "live" query after after this?
More info here: https://parse.com/docs/ios/api/Classes/PFObject.html#//api/name/unpinInBackgroundWithName:
Andrew

Parse loginWithUsernameInBackground block callback not working

I have a parse app in the appstore already. I'm about to submit an update for the app using the latest Parse SDK 1.7.4 and I noticed the manual parse login IS NOT WORKING!
I hope this is due to my code and not a parse issue.
Here is the code:
[PFUser logInWithUsernameInBackground:username password:password block:^(PFUser *user, NSError *error) {
if (!error) {
//do stuff with user
} else {
//error handling here
}
I of course did some search on the internet to find an answer and most people are saying not to use the background functions because things need to run on the main thread. And I tried using the dispatch async and forced it to run on the main thread but still no callback from the login.
Here is the error message I'm getting:
-[BFTask isFaulted]: unrecognized selector sent to instance
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[BFTask isFaulted]: unrecognized selector sent to instance
When I run the below code:
NSError *error;
PFUser *user = (PFUser *)[PFUser logInWithUsername:username password:password error:&error];
if (error) {
//do error handling here
} else {
//do stuff with user object here and go to logged in screen.
}
Also, I want to note, I have this:
NSString *const BFTaskMultipleExceptionsException = #"BFMultipleExceptionsException";
in my AppDelegate just to be able to compile and run the app ever since I upgraded to Parse 1.7.4 SDK.
These are the errors I get if I take out this line from the AppDelegate:
"_BFTaskMultipleExceptionsException", referenced from:
___53+[PFObject(Private) deleteAllAsync:withSessionToken:]_block_invoke226 in Parse(PFObject.o)
___65+[PFObject(Private) _deepSaveAsync:withCurrentUser:sessionToken:]_block_invoke319 in Parse(PFObject.o)
Here is a question that's similar to this in Parse blogs that's not really solved:
https://www.parse.com/questions/ios-sdk-loginwithusernameinbackgroundpasswordblock-does-not-execute-block-on-error-case
Unfortunately I cannot comment on your question (not enough reputation), but it seems you have an old FacebookSDK in your project. Xcode gives you a duplicate symbols error, which is caused by the fact that your (old) FacebookSDK has Bolts integrated. The moment you integrate it from the Parse SDK, you have it effectively two times in your project, resulting in the duplicate symbols error.
Please update your FacebookSDK to the last v3 version, available here. Then, use the latest ParseSDK, and include everything from Parse (also ParseUI, Bolts, etc, everything from their SDK folder EXCEPT the v4Facebook framework) into your project.
This should do the trick and your method:
[PFUser logInWithUsernameInBackground:username password:password block:^(PFUser *user, NSError *error) {
if (!error) {
//do stuff with user
} else {
//error handling here
}
should work.

Resources