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

Cordova iOS HCP fails if you add a png to your project #10181

Closed
RealHandy opened this issue Aug 24, 2018 · 15 comments

Comments

@RealHandy
Copy link

@RealHandy RealHandy commented Aug 24, 2018

I've just confirmed that adding a PNG to a project causes iOS hot code push to fail, even though it works fine on Android. See https://forums.meteor.com/t/hot-code-push-worked-on-android-not-on-ios/45279 for this problem related the following iPhone log message, There's an error message for the meteor-webapp plugin, but that seems like it shouldn't be the cause of iOS-only HCP failing:

Download failure: Could not link to cached asset: Error Domain=NSCocoaErrorDomain Code=516 ““circle_green.png” couldn’t be linked to “images” because an item with the same name already exists.” UserInfo={NSSourceFilePathErrorKey=/var/mobile/Containers/Data/Application/2DCB2EF6-0F63-4394-944E-6827262A0849/Library/NoCloud/meteor/PartialDownload/app/images/circle_green.png, NSUserStringVariant=(
Link
), NSDestinationFilePath=/var/mobile/Containers/Data/Application/2DCB2EF6-0F63-4394-944E-6827262A0849/Library/NoCloud/meteor/Downloading/app/images/circle_green.png, NSFilePath=/var/mobile/Containers/Data/Application/2DCB2EF6-0F63-4394-944E-6827262A0849/Library/NoCloud/meteor/PartialDownload/app/images/circle_green.png, NSUnderlyingError=0x1c02445f0 {Error Domain=NSPOSIXErrorDomain Code=17 “File exists”}}
ERROR: {"line":36,"column":30,"sourceURL":"http://localhost:12072/plugins/cordova-plugin-meteor-webapp/www/webapp_local_server.js"}
@crapthings

This comment has been minimized.

Copy link

@crapthings crapthings commented Aug 27, 2018

do you mean add a png is that you put a png file into public folder ?

you can remove all files from public folder and put those files to cdn

@RealHandy

This comment has been minimized.

Copy link
Author

@RealHandy RealHandy commented Aug 27, 2018

Yes, I added a png to /public/images and redeployed to Galaxy. Android HCP works fine, iOS fails with the error message shown in https://forums.meteor.com/t/hot-code-push-worked-on-android-not-on-ios/45279. Changing my app to use CDN as a workaround isn't something I've tried yet, and that'll probably solve this problem, but I want this bug to go on record, as it has also caused Xcode debugging problems.

@GeorgeCalvert

This comment has been minimized.

Copy link

@GeorgeCalvert GeorgeCalvert commented Aug 27, 2018

We're seeing something similar, a la the below. We're noticing the issue for both font and image files, though which file it is varies with each test. Furthermore, (1) there is no CFNetwork....tmp in our application and (2) the target folder is not part of the codebase we deploy to Cordova.

@abernix @benjamn -- you've been so helpful in the past, perhaps you can get this one prioritized? Hot codepush is essential for compensating for the lag time that Apple's app review process introduces.

We are actively digging into this, as it's jamming us up with a rollout for a big customer, and will offer up whatever we find. Thanks :-)

2018-08-27 12:37:38.730784 Medssenger[610:92524] Download failure: Could not move downloaded asset: Error Domain=NSCocoaErrorDomain Code=516 "“CFNetworkDownload_b38Uow.tmp” couldn’t be moved to “etl_load_users” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Containers/Data/Application/745CD66D-BA42-48C2-AE47-EE8CCEE96723/tmp/CFNetworkDownload_b38Uow.tmp, NSUserStringVariant=(
    Move
), NSDestinationFilePath=/var/mobile/Containers/Data/Application/745CD66D-BA42-48C2-AE47-EE8CCEE96723/Library/NoCloud/meteor/Downloading/app/subclassables/etl_load_users/add.png, NSFilePath=/private/var/mobile/Containers/Data/Application/745CD66D-BA42-48C2-AE47-EE8CCEE96723/tmp/CFNetworkDownload_b38Uow.tmp, NSUnderlyingError=0x1740593b0 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}
@RealHandy

This comment has been minimized.

Copy link
Author

@RealHandy RealHandy commented Aug 27, 2018

Okay, I've debugged the problem and opened a specific issue here: meteor/cordova-plugin-meteor-webapp#56 (as indicated in the reference above). @GeorgeCalvert your issue with moving an asset is very close to the same lines of code and very possibly the same issue.

@crapthings

This comment has been minimized.

Copy link

@crapthings crapthings commented Aug 29, 2018

we have same issue as @RealHandy , we just move all public files into cdn, rebuild then HCP works fine even from meteor 1.4.2.3 to 1.7.0.4

and don't forget to put COMPAT_VERSION before you build.

export METEOR_CORDOVA_COMPAT_VERSION_ANDROID='your old hash here'
export METEOR_CORDOVA_COMPAT_VERSION_IOS='your old hash here'

you can find your COMPAT_VERSION through

https://www.domain.com/__cordova/manifest.json

@hexsprite

This comment has been minimized.

Copy link
Contributor

@hexsprite hexsprite commented Aug 29, 2018

@crapthings so the COMPAT env vars are a must or HCP will break? My impression was that it would calculate the hash based on the cordova plugins in use so if they didn't change you didn't need to provide those env vars.

@RealHandy

This comment has been minimized.

Copy link
Author

@RealHandy RealHandy commented Aug 29, 2018

@hexsprite I haven't had any issues with HCP not working if the hashes don't change. I don't yet provide them to the build b/c they're staying the same.

@RealHandy

This comment has been minimized.

Copy link
Author

@RealHandy RealHandy commented Aug 30, 2018

@GeorgeCalvert I just accidentally repro'ed your error while trying to repro mine.

  1. meteor run ios-device --settings=settings-development.json
  2. attach iPhone and choose it to be the device in Xcode
  3. hit the go triangle to start debug on your phone
  4. add a file into the public directory (etl_load_users)
  5. the OS is doing the copy by creating a tmp file and then doing a rename. the error msg you get is the bug occurring with the tmp name of your add.png

Just FYI . . .

@GeorgeCalvert

This comment has been minimized.

Copy link

@GeorgeCalvert GeorgeCalvert commented Aug 31, 2018

Our diagnostics pinned down the error -- at least as we experience it -- to be caused when we rename a directory containing an image. In our case, these were ancestor directories in the source tree (i.e. outside public). And from @RealHandy's discovery -- thanks! -- adding a directory is also a problem. (It now looks as if any issue with font-files was a false positive.)

We renamed some directories in upgrading from 1.6 to 1.7. We telegraph upgrades to mobile by releasing the Cordova change early, allowing evergreen devices to update before we push all changes to the server (which then distributes the new functionality via HCP). This gave us a 1.7 client and a 1.7-based server with changes that included the renamed directories. That broke HCP -- but distributing a new 1.7 client, one with the new directory names, overcame the issue.

I'll see if we can't build on @RealHandy's work in cordova-plugin-meteor-webapp#56. It's a big headache if we're gonna see this bug for every new directory containing a PNG, even when those directories are outside the source we send to mobile devices.

@RealHandy

This comment has been minimized.

Copy link
Author

@RealHandy RealHandy commented Aug 31, 2018

Every non-js asset seems to be in the manifest twice. See meteor/cordova-plugin-meteor-webapp#56 (comment)

@RealHandy

This comment has been minimized.

Copy link
Author

@RealHandy RealHandy commented Sep 6, 2018

I made a pull request on cordova-plugin-meteor-webapp: meteor/cordova-plugin-meteor-webapp#59

The code change is just a band-aid and doesn't get to the root of the manifest and/or cached asset vs missing asset issue, but it might be useful.

@heberallred

This comment has been minimized.

Copy link

@heberallred heberallred commented Nov 14, 2018

Does anyone know if this issue will be resolved in Meteor 1.8.1?

@RealHandy

This comment has been minimized.

Copy link
Author

@RealHandy RealHandy commented Nov 16, 2018

@GeorgeCalvert The additional update made to the pull request yesterday (see meteor/cordova-plugin-meteor-webapp#59) may fix the problem you mentioned here.

@RealHandy

This comment has been minimized.

Copy link
Author

@RealHandy RealHandy commented Nov 16, 2018

Current activity for this issue is at #10277

@RealHandy

This comment has been minimized.

Copy link
Author

@RealHandy RealHandy commented Apr 18, 2019

Closing this, as it's fixed, but also #10277 ended up being where all the action was.

@RealHandy RealHandy closed this Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.