itsniper / ftasync Goto Github PK
View Code? Open in Web Editor NEWAllows you to sync CoreData entities with a Parse backend.
License: MIT License
Allows you to sync CoreData entities with a Parse backend.
License: MIT License
Is there a way of selecting the list of todos assigned to a particular person?
In the example app I get the following EXC_BAD_ACCESS error when I have created a person. You can reproduce it by creating a new person after logging in. After that you directly try to edit this record by clicking on it. The error is produced because the record is not yet inserted (as far as I can tell). After restarting the app (and probably trigger something that actually saves the record) the person can be clicked and therefore edited.
The method that triggers the EXC_BAD_ACCESS is: updateInterfaceForCurrentPerson
In the debugger a PO of self.person shows this:
(Person *) $1 = 0x07a2ffa0 <Person: 0x7a2ffa0> (entity: CDPerson; id: 0x9055ee0 x-coredata://05BD5986-FA3C-4F0D-9025-4A34FB52291D/CDPerson/tE9FFF278-49AE-4C11-8BE6-B29EC909B1A02 ; data: )
After a restart a PO of self.person shows this:
(Person *) $1 = 0x0f691360 <Person: 0xf691360> (entity: CDPerson; id: 0x7d9b8a0 x-coredata://05BD5986-FA3C-4F0D-9025-4A34FB52291D/CDPerson/p2 ; data: )
Here are possible scenario:
On parse server, there are 1000 rows of data
The first time ViewController loaded, it will pull 50 rows of data using FTASync
user tap "Load More", to load another 50 rows of data. --- How to use FTASync to load another 50 rows of data and not the previous one? Or the from code, using updatedDate?
from the code, there is syncAll and syncEntity but I did not see sync base on certain numbers of rows.
I tried integrating FTASync to my app by following steps you have mentioned , yes i don't get errors but i when i run app crashes.(because i can't add everything properly because of lack of documentation )
the prerequisites you mentioned, i added them all, i am new to mogenerator and magical records too.
In my app i have pre loaded sqlite db. its working with backend Parse sdk.
I can't understand from where my views will connect with core data objects or the newly created mogenerator objects .
I don't want to use user login for parse so i login as anonymous.
Please if you could add detailed documentation to this.
I am new to this. any help would be appreciated.
Thanks
If I restart app, the data I saved gets lost, core data is empty.
(void)FTA_updateObjectsForClass:(NSEntityDescription *)entityDesc withRemoteObjects:(NSArray *)parseObjects {
for (PFObject *remoteObject in parseObjects) {
FTASyncParent *localObject = [self FTA_localObjectForClass:entityDesc WithRemoteId:remoteObject.objectId];
if (!localObject) {
//FSALog(@"Could not find local object matching remote object: %@", remoteObject);
localObject = [FTASyncParent FTA_newObjectForClass:entityDesc WithRemoteObject:remoteObject];
break;
}
[localObject updateObjectWithRemoteObject:remoteObject];
}
}
Removing the FSALog and Assertion and adding the break will do the trick, currently i'm using it with three many to many objects and its working just fine (sometimes it duplicates objects, but i haven't been able to detect when, it may have been caused by different versions of my app between the device and simulator)
It will be good if FTASync can support cocoapods so it can be installed easily
I have a existing app on the market and was looking to use this library with parse. Everything is going well but when I try to migrate Coe data is having a issue with the migration because of the new parent. I set up mapping modules, but still no luck.
Do you know how I can migrate using magical record?
I'm having some serious issues trying to get this to work with storyboards, the app will just crash every time I give it a go. If anyone has got it working properly with storyboards, it'd be great to see some sample code.
The main error i'm getting is this:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
However i'm not entirely sure what is causing it.
Hello
i m facing an issue when m want to fetch All transaction list about particular Account using core data with magical records.
An m working with parse and my application have a sync feature so m using FTASYNC .
But m not able to get All transaction which is related to one particular account with one to many relationship.
Anybody can please help me.
Thanks in advance
Hi,
Just I clone the code,but when i open the project,i found it lost the file "ParseKeys.h".
What's this file? set the parse's app id and client id?
I am trying to produce a list of todo items for a specific person, I am pushing a view to the user when they select a particular person, at this particular moment all of the todo items, regardless of selected person are displayed. I understand that it is the following piece of code that fetches the todo items, how would I alter that to display the todo items for a specific person?
(NSFetchedResultsController *)fetchedResultsController {
if (!_fetchedResultsController ) {
_fetchedResultsController = [ToDoItem MR_fetchAllGroupedBy:nil withPredicate:nil sortedBy:@"priority" ascending:YES delegate:self];
}
return _fetchedResultsController;
}
Each person and todoitem is given a unique objectId, and the todo items are also assigned the person objectId if selected so I can see a way of doing it, but am a little confused as to how you can filter the todo items.
For my app I need to have a way to give other users access to an entity if they are invited. So a user can invite another user to have access on an entity. I found out Parse.com has an excellent way of dealing with this in the form of ACL's.
I would love to use these ACL's in the way they are meant to be used and expand the standard use of the default ACL for all records, but I cannot seem to find out where to put the code to fill them.
My first guess was to put them into this method:
In that method I can check which entity is being updated and then add the specific user defined ACL for that entity. I am not sure if that is the way this was intended? Could you please give me some pointers on this. Maybe there is a way better (nicer) way to handle this, maybe even not with the ACL's.
Not entirely sure what all will be required, but I think FTASync could benefit from using a PFRelation. Will be some work to develop the correct queries to ensure conflict resolution works correctly.
Looking at the source for FTASync, it seems to rely heavily on the Parse.com User class. I have an application where Parse is essentially just serving up data (no user generated content), is there any way to use FTASync without Users and ACLs?
Thanks.
Problem:
I sync 15 MB files using FTASync and the instruments says that [FTASyncHandler syncAll] takes 15MB memory which is not reasonable
So I changed the code in FTASyncParent.m :
- (void)updateObjectWithRemoteObject:(PFObject *)parseObject {
NSDictionary *attributes = [[self entity] attributesByName];
NSDictionary *relationships = [[self entity] relationshipsByName];
//Set all the attributes
if (self.syncStatusValue != 1) { //Local changes take priority
for (NSString *attribute in attributes) {
NSString *className = [[attributes valueForKey:attribute] attributeValueClassName];
if ([className isEqualToString:@"NSData"]) {
PFFile* remoteFile = [parseObject objectForKey:attribute];
[self setValue:[remoteFile getData] forKey:attribute]; //CHANGED HERE
remoteFile = nil; //CHANGED HERE
continue;
}
And I run the app again and the [FTASyncHandler syncAll] takes 33.88KB only this time (see the attachment photo:)
(Note: in .xcdatamodel, the binary data field, I checked the "Allows External Storage" box to reduce use of memory of core data)
Can you please update the code in FTASync according to the code above?
MagicalRecord 2.1 seems to fix a number of CD bugs I ran into, but it kills FTASync. Are there any plans to update FTASync to the latest MR?
Thanks!
In the module FTASyncHandler.m, there are at least 3 calls using [NSManagedObjectContext MR_contextForCurrentThread] which is deprecated, the use of MR_Save is deprecated and saveInBackgroundWithBlock is deprecated. The file will not build! and I need some help here to figure out what the correct methods are supposed to be!
Anyone?
I'm not sure what i'm doing wrong, but the data just won't save into core data locally, it has to download the data from Parse every single time.
I've setted my project and added this fix #6. My app is very similar to FTASyncDemo, even simpler. I have a table view showing core data objects and two buttons, one for synching and one for adding an object. I've tried to use NSFetchedResultsController and now I'm handling by myself core data notification but in both cases I'm having the same issue. This is what I do when I add a new Person object:
NSManagedObjectContext *moc = [NSManagedObjectContext MR_contextWithParent: [NSManagedObjectContext MR_defaultContext]];
Person *newPerson = [Person MR_createInContext: moc];
//Person *newPerson = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext: moc];
newPerson.name = nameField.text;
newPerson.age = [NSNumber numberWithInteger: [ageTextField.text integerValue]];
newPerson.isMale = ([isMaleField.text isEqualToString: @"YES"]?[NSNumber numberWithBool: YES]:[NSNumber numberWithBool: NO]);
[moc MR_saveNestedContexts];
[[FTASyncHandler sharedInstance] syncWithCompletionBlock:^
{
DCLog(@"Completion Block INSERT Called");
[self dismissModalViewControllerAnimated: YES];
}
progressBlock:^(float progress, NSString *message)
{
DLog(@"PROGRESS UPDATE: %f - %@", progress, message);
}];
moc = nil;
I receive three NSManagedObjectContextObjectsDidChangeNotifications, the first one for an inserted object and the other two for updating an object. In the insert notification, in the managed object context I have one object. In the next two update notifications, I have two objects:
One object is the one I have just created and the other is the object returned from the server after the sync operation.
This is the log after last notification:
***** DATASOURCE AFTER UPDATE(
"<Person: 0x7b835e0> (entity: Person; id: 0x6df8220 x-coredata:///Person/t3E85364B-445F-4DDA-BC49-FC80042B753D2 ; data: {\n age = 0;\n createdHere = 1;\n deleted = 0;\n isMale = 0;\n name = Carlotta;\n objectId = nil;\n syncStatus = 2;\n updatedAt = nil;\n})",
"<Person: 0x6d690c0> (entity: Person; id: 0xcff9290 x-coredata://3BB06E3A-2674-4908-B744-BC6C0208129F/Person/p8 ; data: {\n age = 0;\n createdHere = 1;\n deleted = 0;\n isMale = 0;\n name = Carlotta;\n objectId = mm5E0JBaqv;\n syncStatus = 1;\n updatedAt = "2012-12-18 09:38:14 +0000";\n})"
The result is that I have a duplicate Person in my table.
On Parse side, the sync hasn't produced any duplicate. If I run again the app, the duplicate disappears and so everything is ok.
Can you help me figure out what's going on?
Thanks,
L.
I have this problem only on iOS 5.0 and 5.1, not on iOS 6
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.