[TIMOB-26347] IOS: setRemoteBackup(flag) outputs an ERROR message when used on individual files.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-09-01T12:48:34.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.5.0 |
Components | iOS |
Labels | n/a |
Reporter | kosso |
Assignee | Hans Knöchel |
Created | 2018-08-31T15:09:32.000+0000 |
Updated | 2019-03-16T01:32:19.000+0000 |
Description
Since 7.3.0.GA+ I'm seeing an error when calling setRemoteBackup(bool) on an individual File object. "Could not configure remote backup: The file “mydatabase.db” couldn’t be opened." (Setting the flag on a folder works fine,)
Looking at the code in TiFilesystemFileProxy.m around line 570, it appears that the object is setting the flag correctly (on the 'URL'), but then continues to treat the object as a folder, get the contents then output (not throw) an error if no contents are found. (Which a single file will always fail on).
It's not a fatal error, but the code just shouldn't have got that far to output the ERROR message.
A quick fix would be to change the setRemoteBackup method to :
- (void)setRemoteBackup:(id)value
{
ENSURE_TYPE(value, NSNumber);
BOOL isExcluded = ![TiUtils boolValue:value def:YES];
NSNumber *isDirectory;
BOOL success = [[NSURL fileURLWithPath:[self path]] getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil];
if (success && [isDirectory boolValue]) {
[self addSkipBackupAttributeToFolder:[NSURL fileURLWithPath:[self path]] withFlag:isExcluded];
} else {
[self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:[self path]] withFlag:isExcluded];
}
}
I don't think this is 7.3.0+ only, because the method wasn't changed for 1+ year. I agree on the improvement, can you file a PR for that?
PR: https://github.com/appcelerator/titanium_mobile/pull/10302
*Closing ticket.* Verified fix in SDK version
7.5.0.v20180925002114
. setRemoteBackup(fla g) no longer outputs an ERROR message when used on individual files. *FR passed (Test steps)*Created a new project using the sample code from https://github.com/appcelerator/alloy/tree/master/samples/apps/models/sql_preload
Ran the program
No longer saw the following error which could be seen in (7.4.0.GA)
*Test Environment* APPC Studio: 5.1.0.201808080937 iphone 6 (11.3) APPC CLI: 7.0.7-master.1 Operating System Name: Mac OS Mojave Operating System Version: 10.14 Node.js Version: 8.9.1 Xcode 10.0
I see the same error in my project compiled with SDK 7.4.1 I cannot use 7.5.0 as GA version is not yet launched. I need to use stable one, being working for any enterprise.
[~mr.jatinjoshi.mca@gmail.com] just do the change in the description under "quick fix" in your 7.4.1 folder. The file and place is described in the PR: https://github.com/appcelerator/titanium_mobile/pull/10302/files Works fine for me
I am still having this issue when using 8.0.0.GA