Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26347] IOS: setRemoteBackup(flag) outputs an ERROR message when used on individual files.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-09-01T12:48:34.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.5.0
ComponentsiOS
Labelsn/a
Reporterkosso
AssigneeHans Knöchel
Created2018-08-31T15:09:32.000+0000
Updated2019-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];
    }
}

Comments

  1. Hans Knöchel 2018-08-31

    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?
  2. Hans Knöchel 2018-09-01

    PR: https://github.com/appcelerator/titanium_mobile/pull/10302
  3. Samir Mohammed 2018-09-26

    *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)

       [ERROR] :  Could not configure remote backup: The file “fighters.sql” couldn’t be opened.
       
    *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
  4. JATIN JOSHI 2018-10-22

    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.
  5. Michael Gangolf 2018-10-22

    [~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
  6. Matthew Delmarter 2019-03-16

    I am still having this issue when using 8.0.0.GA
       Could not configure remote backup: The file “...” couldn’t be opened.
       

JSON Source