Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the problem caused by read-only properties #17

Closed
wants to merge 10 commits into from

Conversation

npahucki
Copy link

See #16 for description of what I am trying to fix here.

@npahucki
Copy link
Author

BTW: just included in this pull request: A fix for a bug where trying to get the Data from PFFile that was restored from cache would crash the app.

Apparently when you stopped saving all the ivars (which caused a different type of crash) you threw out the baby with the bathwater. We must save the state and previousState variables otherwise parse thinks you just created the PFFile and have not saved it, so it fails with "This file is not ready to be fetched" when you try to load it.

…th the new version of Parse (April 4th 2014).
@npahucki
Copy link
Author

Pardon, the mess, I reverted the changes to PFFile. I realized that I still had an OLDER version of Parse.framework and that a newer version had been pulled in as a dependency of Parse-NSCoding. The older version had some state variables in PFFile that needed to be saved, but it appears in the newer version these variables are gone, making my changes to PFFile+NSCoding unneeded for the latest version of the Parse SDK. The original commit is unaffected and is still needed.

@joeyvlin
Copy link

Hi @npahucki, could explain a bit more about why having an older version of Parse.framework required you to save all the ivars but not with the new one? I have a fairly new Parse.framework and am seeing the "This file is not ready to be fetched" issue. I really need some help resolving this. I would get fetching for the file data and this would randomly happen, maybe once every 40 times.

@npahucki
Copy link
Author

@joeyvlin I explained pretty clearly why the error was happening in my original comments. I don't think it has anything to do with the problem that you describe as the failure mode was 100% in this case. The only thoughts I have on your issue is that perhaps in some code branch, you are forgetting to upload the PFFile to Parse before trying to use the PFFile or you are somehow getting race conditions perhaps due to the way that you are using threading. If you haven't already, make sure you are using the latest version of Parse, as "fairly new" doesn't mean latest.

Hope that helps some.

@npahucki
Copy link
Author

Fixes to make compatible with Parse 1.4.x.

Summary:

  1. Remove categories for classes that now have native NSCoding support.
  2. Fix a crash condition when the data for PFFile is nil. The new version of the Parse API throws an exception if you call [PFFile fileWithName:name data:data] where data is nil (which is the case if a file has not been downloaded).
  3. Increase the version number and Parse dependency version.

@pronebird pronebird mentioned this pull request Sep 27, 2014
@pronebird
Copy link

Tremendous work @npahucki. I am switching to your branch, will test it. I don't use files but at least I can test PFObject and PFACL.

@pronebird
Copy link

@npahucki so far so good.

Not your edit apparently, but would be nice to move the following:

//Re-declare timestamp properties as read-write
@property (nonatomic, retain, readwrite) NSDate* updatedAt;
@property (nonatomic, retain, readwrite) NSDate* createdAt;

somewhere in implementation file of PFObject+NSCoding category so the rest of app would still see this as originally readonly.

@pronebird
Copy link

Another thing I noticed, there is now ivar called "estimatedData", I don't think it was in earlier SDKs. It seems to be used as "the latest value" of object after all pending operations finished. When we restore object from archive, it's filled with NSNull values. I am not sure if there is any side effect to that or shall we fill it with current data too...

@pronebird
Copy link

@eladb I know you do not actively maintain this library anymore, but can we make this release happen? This PR fairly covers a transition to Parse 1.4.

@eladb eladb closed this Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants