Giter Site home page Giter Site logo

microsoft / code-push Goto Github PK

View Code? Open in Web Editor NEW
4.3K 125.0 471.0 12.05 MB

A cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users’ devices.

Home Page: https://microsoft.github.io/code-push/

License: Other

JavaScript 1.83% TypeScript 98.17%
react reactnative react-native cordova codepush

code-push's Introduction

appcenterbanner

Sign up With App Center to use CodePush

CodePush

CodePush is a cloud service that enables React Native developers to deploy mobile app updates directly to their users' devices. It works by acting as a central repository that developers can publish updates to (JS, HTML, CSS and images), and that apps can query for updates from (using provided client SDK for React Native). This allows you to have a more deterministic and direct engagement model with your userbase, when addressing bugs and/or adding small features that don't require you to re-build a binary and re-distribute it through the respective app stores.

To get started using CodePush, refer to our documentation, otherwise, read the following steps if you'd like to build/contribute to the project from source.

NOTE: If you need information about code-push management CLI, you can find it in v3.0.1.

Dev Setup

  • Install Node.js
  • Install Git
  • Clone the Repository: git clone https://github.com/Microsoft/code-push.git

Building

  • Run npm run setup to install the NPM dependencies of management SDK.
  • Run npm run build to build the management SDK for testing.
  • Run npm run build:release to build the release version of management SDK.

Running Tests

  • To run tests, run npm run test from the root of the project.
  • You can use debug mode for tests with .vscode/launch.json file.

Coding Conventions

  • Use double quotes for strings
  • Use four space tabs
  • Use camelCase for local variables and imported modules, PascalCase for types, and dash-case for file names

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

CodePush Management SDK (Node.js)

A JavaScript library for programmatically managing your CodePush account (e.g. creating apps, promoting releases), which allows authoring Node.js-based build and/or deployment scripts, without needing to shell out to the App Center CLI.

Getting Started

  1. Create a token to authenticate with the CodePush server using the following App Center CLI command:

    appcenter tokens create -d "DESCRIPTION_OF_THE_TOKEN"

    Please copy your API Token and keep it secret. You won't be able to see it again.

  2. Install the management SDK by running npm install code-push --save

  3. Import it using one of the following statement: (using ES6 syntax as applicable):

    • On commonjs environments:
    const CodePush = require("code-push");
    • Using ES6 syntax with tsconfig.json:
    import CodePush from "code-push";
  4. Create an instance of the CodePush class, passing it the API Token you created or retrieved in step #1:

    const codePush = new CodePush("YOUR_API_TOKEN");
  5. Begin automating the management of your account! For more details on what you can do with this codePush object, refer to the API reference section below.

API Reference

The code-push module exports a single class (typically referred to as CodePush), which represents a proxy to the CodePush account management REST API. This class has a single constructor for authenticating with the CodePush service, and a collection of instance methods that correspond to the commands in the App Center CLI, which allow you to programmatically control every aspect of your CodePush account.

Constructors

  • CodePush(accessKey: string) - Creates a new instance of the CodePush management SDK, using the specified access key to authenticated with the server.

Methods

Note: access key here refers to an AppCenter API Token.

  • addAccessKey(description: string): Promise<AccessKey> - Creates a new access key with the specified description (e.g. "VSTS CI").

  • addApp(name: string, os: string, platform: string, manuallyProvisionDeployments: boolean = false): Promise<App> - Creates a new CodePush app with the specified name, os, and platform. If the default deployments of "Staging" and "Production" are not desired, pass a value of true for the manuallyProvisionDeployments parameter.

  • addCollaborator(appName: string, email: string): Promise<void> - Adds the specified CodePush user as a collaborator to the specified CodePush app.

  • addDeployment(appName: string, deploymentName: string): Promise<Deployment> - Creates a new deployment with the specified name, and associated with the specified app.

  • clearDeploymentHistory(appName: string, deploymentName: string): Promise<void> - Clears the release history associated with the specified app deployment.

  • getAccessKey(accessKey: string): Promise<AccessKey> - Retrieves the metadata about the specific access key.

  • getAccessKeys(): Promise<AccessKey[]> - Retrieves the list of access keys associated with your CodePush account.

  • getApp(appName: string): Promise<App> - Retrieves the metadata about the specified app.

  • getApps(): Promise<App[]> - Retrieves the list of apps associated with your CodePush account.

  • getCollaborators(appName: string): Promise<CollaboratorMap> - Retrieves the list of collaborators associated with the specified app.

  • getDeployment(appName: string, deploymentName: string): Promise<Deployment> - Retrieves the metadata for the specified app deployment.

  • getDeploymentHistory(appName: string, deploymentName: string): Promise<Package[]> - Retrieves the list of releases that have been made to the specified app deployment.

  • getDeploymentMetrics(appName: string, deploymentName: string): Promise<DeploymentMetrics> - Retrieves the installation metrics for the specified app deployment.

  • getDeployments(appName: string): Promise<Deployment[]> - Retrieves the list of deployments associated with the specified app.

  • patchRelease(appName: string, deploymentName: string, label: string, updateMetadata: PackageInfo): Promise<void> - Updates the specified release's metadata with the given information.

  • promote(appName: string, sourceDeploymentName: string, destinationDeploymentName: string, updateMetadata: PackageInfo): Promise<Package> - Promotes the latest release from one deployment to another for the specified app and updates the release with the given metadata.

  • release(appName: string, deploymentName: string, updateContentsPath: string, targetBinaryVersion: string, updateMetadata: PackageInfo): Promise<Package> - Releases a new update to the specified deployment with the given metadata.

  • removeAccessKey(accessKey: string): Promise<void> - Removes the specified access key from your CodePush account.

  • removeApp(appName: string): Promise<void> - Deletes the specified CodePush app from your account.

  • removeCollaborator(appName: string, email: string): Promise<void> - Removes the specified account as a collaborator from the specified app.

  • removeDeployment(appName: string, deploymentName: string): Promise<void> - Removes the specified deployment from the specified app.

  • renameApp(oldAppName: string, newAppName: string): Promise<void> - Renames an existing app.

  • renameDeployment(appName: string, oldDeploymentName: string, newDeploymentName: string): Promise<void> - Renames an existing deployment within the specified app.

  • rollback(appName: string, deploymentName: string, targetRelease?: string): Promise<void> - Rolls back the latest release within the specified deployment. Optionally allows you to target a specific release in the deployment's history, as opposed to rolling to the previous release.

  • transferApp(appName: string, email: string): Promise<void> - Transfers the ownership of the specified app to the specified account.

Error Handling

When an error occurs in any of the methods, the promise will be rejected with a CodePushError object with the following properties:

  • message: A user-friendly message that describes the error.
  • statusCode: An HTTP response code that identifies the category of error:
    • CodePush.ERROR_GATEWAY_TIMEOUT: A network error prevented you from connecting to the CodePush server.
    • CodePush.ERROR_INTERNAL_SERVER: An error occurred internally on the CodePush server.
    • CodePush.ERROR_NOT_FOUND: The resource you are attempting to retrieve does not exist.
    • CodePush.ERROR_CONFLICT: The resource you are attempting to create already exists.
    • CodePush.ERROR_UNAUTHORIZED: The access key you configured is invalid or expired.

code-push's People

Contributors

alexandergoncharov-zz avatar alexnekrashevich avatar anatolypristensky avatar andreidubov avatar belemaire avatar bretjohnson avatar cjonsmith avatar daniel-beard avatar dependabot[bot] avatar dlebu avatar dmitriykirakosyan avatar dtivel avatar geof90 avatar iageoghe avatar itoys avatar kilihorse avatar lostintangent avatar mtunique avatar nicktoropov avatar patoroco avatar pfleidi avatar quentinyang avatar richardhuaaa avatar rub8n avatar ruslan-bikkinin avatar ryuyu avatar sergey-akhalkov avatar shishirx34 avatar yuri-kulikov avatar zakeelm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

code-push's Issues

Always logs "[CodePush] App is up to date" even after new release updates (iOS)

I've been trying to get CodePush to work but haven't gotten it to recognize any release updates I push for iOS (Haven't tried Android yet).

Here were my steps I took after successfully registering:

  1. Followed all the install instructions listed here: https://microsoft.github.io/code-push/docs/react-native.html#link-3 including adding CodePush.sync() in the javascript and "jsCodeLocation = [CodePush bundleURL];" in the objective-c while adding the correct CodePush deployment key to the plist.
  2. Build the new update with new JS changes:
    $ react-native bundle --platform ios --entry-file index.ios.js --bundle-output codepush.js --dev false
  3. Upload to Staging:
    $ code-push release codepush.js 2.2.2 -m

$ code-push deployment ls --format json
[
{
"name": "Production",
"package": {
"description": "",
"appVersion": "2.2.2",
"isMandatory": true,
"packageHash": "ac9c025...",
"blobUrl": "https://codepush.blob.core.windows.net/storagev2/44232...",
"size": 581785,
"releaseMethod": "Upload",
"uploadTime": 1453676143623,
"label": "v3"
}
},
{
"name": "Staging",
"package": {
"description": "",
"appVersion": "2.2.2",
"isMandatory": true,
"packageHash": "42b7402434fe6f...",
"blobUrl": "https://codepush.blob.core.windows.net/storagev2/12vUhcHefwef...",
"size": 581785,
"releaseMethod": "Upload",
"uploadTime": 1453675949367,
"label": "v5"
}
}
]

Then when I run the app from XCode with the plist version set to 1.0.0 I always get the following log message with no updates:

2016-01-24 15:07:38.754 [trace][tid:com.facebook.React.JavaScript] [CodePush] Checking for update.
2016-01-24 15:07:38.952 [trace][tid:com.facebook.React.JavaScript] [CodePush] App is up to date.

Is there a way to debug this further to see why its not recognizing any new releases I push?

"Talk to us" Reactiflux link is wrong on gh-pages

Hey there,
for linking Discord channels you have to create an Instant Invite instead of linking the channel link directly.
It's the up-facing arrow symbol. Make sure to go to Advanced Settings and set "Expire After" to "Never" before you generate one.

Connect to the server failed from China

Hi,
I'm using code-push in our new product. Unfortunately we found that the connection to the server is failed from China because of the server is deployed in USA, so how to solve this problem? Will Microsoft deploy the service in China later?

New Website Logo: Simple Contacts

Thanks! Love CodePush!

Please fill the following out:

Example:

Name: Microsoft
Homepage url: https://microsoft.com
Brand Guidelines/Licensing: https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/logo.aspx
Logo: https://news.microsoft.com/microsoft-news-center-photos/msft_logo_rgb_c-gray/

Android release: [Error] Not Found

Hey guys,
I can run the release script of iOS without any error, but when I run

code-push release fakemobileapp android 1.0.1

I get [Error] Not Found

After some debugging, it seems like it comes from this request:
Error: cannot PUT /apps/***/package (404)

About update layout after applied upgrade

Hi
My code is

  CodePush.sync({}).then((status) => {
    if (status === CodePush.SyncStatus.UPDATE_APPLIED) {

         // do something relayout my view and show loading spinner
    }
  })

But loading spinner is not shown. I guess whether sync() method block something about UI?

[release-react] Deployment "Staging," does not exist.

Command:

code-push release-react MyApp android -d "Staging" -des "some update"

Result:

Running "react-native bundle" command:

node node_modules/react-native/local-cli/cli.js bundle --assets-dest /var/folders/j8/0051f_yn62g5gvd5l2xz04lw0000gn/T/CodePush --bundle-output /var/folders/j8/0051f_yn62g5gvd5l2xz04lw0000gn/T/CodePush/index.android.bundle --dev false --entry-file index.android.js --platform android --sourcemap-output some update
bundle: Created ReactPackager
bundle: start
bundle: finish
bundle: Writing bundle output to: /var/folders/j8/0051f_yn62g5gvd5l2xz04lw0000gn/T/CodePush/index.android.bundle
bundle: Writing sourcemap output to: some update
bundle: Closing client
bundle: Copying 11 asset files
bundle: Done writing bundle output
bundle: Done writing sourcemap output
bundle: Done copying assets

Releasing update contents to CodePush:

Upload progress:[==================================================] 100% 0.0s
[Error]  Deployment "Staging," does not exist.

This doesn't seem to work. I'm on 1.10.0-beta. I also tried without the quotes around Staging, same result.

$ code-push -v
1.10.0-beta

Thanks!

Linker error from cocoapods install

Hi, I'm trying to integrate RN with code push to existing iOS app.

Integrating RN was successful (using cocoa pods).
Then I tried to add Code Push using cocoapods. pod install ran fine with code push, but when I tried to build the project, I get a linker error.

Here's the error message (truncated some paths)

duplicate symbol _OBJC_IVAR_$_SSZipArchive._zip in: ...libCodePush.a(SSZipArchive.o)
duplicate symbol _OBJC_IVAR_$_SSZipArchive._path in: ...libCodePush.a(SSZipArchive.o)
duplicate symbol _OBJC_CLASS_$_SSZipArchive in: ...libCodePush.a(SSZipArchive.o)
duplicate symbol _OBJC_METACLASS_$_SSZipArchive in: ...libCodePush.a(SSZipArchive.o)
duplicate symbol _OBJC_IVAR_$_SSZipArchive._filename in: ...libCodePush.a(SSZipArchive.o)

ld: 5 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

SSZipArchive was in already Podfile before adding code push.

Can you help me? Thanks.

code-push-cli 1.9.0-beta breaks with "[Error] Not Found"

After being forced to upgrade code push CLI from 1.6.0-beta we are not able to manage our existing apps. We used special characters in the code-push apps' names so I suspect that might cause the trouble.
Anybody else hitting the same problem? Any solutions/workarounds?

Release command should reject binary files

Currently, the release command will detect if a zip file is specified as the packager parameter and reject it. In order to reduce potential errors, we should also reject APK and ipa files (which are also zips), so that devs can't accidentally release binaries and get confused with why their app fails when trying to update.

False Update detection on first run

My CI server pushes every build to code-push (js) and other distr channels (for full ipa). I may have the following:

  • 1.0.0 (build 2) + code-push for js part only (1.0.2 version in package.json)
  • 1.0.0 (build 4) + code-push for js part only (1.0.4 version in package.json)
  • 1.1.0 (build 5) + code-push for js part only (1.1.5 version in package.json)
  • etc

After installing new [full] build on the device, first run of the code-push sync() reports that there is an update. In reality, there is no need for the update, because full build already has latest js bundle.

code-push packages have automatically generated label (v1, v2 etc). If I can have extra metadata, say, version of the package, and control version matching on client side, I can avoid false positive update check of first run.

Another approach I see is to silently download update and inspect package.json in downloaded main.jsbundle (I don't know if it is possible). That may help avoiding false positive too.

Any other ideas? May be I am missing something and using code-push not the way it was designed to work?

Thanks,
~Andrey

Rollback a first CodePush release after a binary release

Didn't see it in the docs:

Seems it is not possible to rollback the first CodePush release after you deployed a binary version in the store.
CodePush says

11:18:12-gunter~/mobile-app-dispatcher/android (feature/[email protected])$ code-push deployment history mobile-app-dispatcher-android Staging
┌───────┬───────────────┬─────────────┬───────────┬───────────────┬──────────────────────┐
│ Label │ Release Time  │ App Version │ Mandatory │ Description   │ Install Metrics      │
├───────┼───────────────┼─────────────┼───────────┼───────────────┼──────────────────────┤
│ v1    │ 2 minutes ago │ 2.3.2       │ No        │ Release 2.3.3 │ Active: 50% (1 of 2) │
│       │               │             │           │               │ Total: 1             │
└───────┴───────────────┴─────────────┴───────────┴───────────────┴──────────────────────┘
11:19:42-gunter~/mobile-app-dispatcher/android (feature/[email protected])$ code-push rollback mobile-app-dispatcher-android Staging
Are you sure? (Y/n): 
[Error]  Cannot perform rollback because there are no prior releases to rollback to.
11:20:44-gunter~/mobile-app-dispatcher/android (feature/[email protected])$ 

Well, its understandable, there is no previous CodePush release to rollback to.

But, technically it should be possible I think. The local installation could just forget about the local bundle update and revert to running the original version of the store.

Seems risky when you have significant changes in your first CodePush update after a binary release and not to be able to rollback.

Is it possible to implement our own service instead of use Microsoft one?

Since there is currently no server at China, the connection is not reliable enough for Production use.
So I'm thinking about write our own service implementation instead of use Microsoft one.
Since the request sent from code-push client is just HTTPS request, I guess it will be not hard to do this, write our own service and replace the url https://codepush.azurewebsites.net/ to url of ours.
Is this scenario you are going to support or I will have to investigate the client sdk code to guess what I should write, or I should never do this at all? Please give me some hints, thanks.

there is something concern me

our project really need code-push to update the logic where coding in react-native.
more and more user grow up in our App.
I am worry if someday code-push cannot bearer so many these user , you know ,more user , more network connection , I am worry code-push server will cannot response so fast , and the coding download server will be set in USA , the user who is my app almost from Asia , even now there's download speed is not satisfactory.

Is there any way to build project like git-lab can allowed people created code-push service in their own server machine ?
that's would be nice , that's would be more powerful download speed and code-push users can balanced load handle the large user login scene.

I am appreciate what the code-push team done , If there some solution for this needed , that's would be awesome

Update dialog isn't shown (but app is updated)

I'm using react-native 0.14 with code-push 1.2.2-beta

When I do a "Staging" deployment and re-open the app, there is no update dialog. When I close my app and re-open, the update is installed and my code is updated. Is this expected behaviour because I'm in staging? Do I need to change my release config for the update dialog to show?

The commands I use are:

react-native bundle --entry-file index.ios.js --platform ios --bundle-output ./ios/main.jsbundle

code-push release myabi ./ios/main.jsbundle 1.0.0

Let me know if you need help debugging this, and keep up the great work on this service!

code-push deployment ls myabi

│ Staging    │ xxx│ Label: v11                                                             
│            │                                      │ App Version: 1.0.0                                                     │
│            │                                      │ Mandatory: No                                                          │
│            │                                      │ Hash: 11e252cb25de4207ea417df2d5bd8a0c7b793dd7af6e98ab45cd66830ecd2215 │
│            │                                      │ Release Time: 5 minutes ago                                            │

code-push-cli@latest Path must be a string. Received ' +

Today we Got
[Error] Due to significant service improvements, your current CLI version is no longer supported.
Please upgrade to the latest version by running 'npm install -g code-push-cli@latest'.

and we run npm install -g code-push-cli@latest

Now when we're running this command code-push release headerlabs path/www 0.0.1 -d Staging via Terminal everything goes fine.

But we have an php app which release code-push update by exactly same command

and we're getting Error like this

"path.js:8", " throw new TypeError('Path must be a string. Received ' +", " ^", "", "TypeError: Path must be a string. Received undefined", " at assertPath (path.js:8:11)", " at Object.posix.join (path.js:479:5)", " at Object.<anonymous> (/usr/lib/node_modules/code-push-cli/script/command-executor.js:23 :27)", " at Module._compile (module.js:409:26)", " at Object.Module._extensions..js (module.js:416:10)", " at Module.load (module.js:343:32)", " at Function.Module._load (module.js:300:12)", " at Module.require (module.js:353:17)", " at require (internal/module.js:12:17)", " at Object.<anonymous> (/usr/lib/node_modules/code-push-cli/script/cli.js:4:26)", " at Module._compile (module.js:409:26)", " at Object.Module._extensions..js (module.js:416:10)", " at Module.load (module.js:343:32)", " at Function.Module._load (module.js:300:12)", " at Function.Module.runMain (module.js:441:10)", " at startup (node.js:139:18)"

[cordova] My app hangs in iOS simulator after implementing CodePush SDK (randomly)

Hi guys. I've followed the steps to implement CodePush in a blank Cordova app, and after adding the codePush.sync() call, my app hangs most of the times. I added the onStatusChange callback and confirmed that the function is called at least once before hanging.

    onDeviceReady: function () {
        codePush.sync(app.onStatusChange);
        app.receivedEvent('deviceready');
    },

I also found a workaround, which is to call the sync method from a setTimeout, a second before initialization.

    onDeviceReady: function () {
        setTimeout(function () {
            codePush.sync(app.onStatusChange);
        }, 1000);
        app.receivedEvent('deviceready');
    },

I'm deploying to the iOS simulator.

Any ideas?

Thanks,
Javier

update failed with image

When i push an image why update failed?
when i developing RN project on ios ,I use this "react-native bundle --parameter ios --entry-file index.ios.js --bundle-output ./bundles/xxxx.js --assets-dest ./bundles"
I see that the latest package has been downloaded,but restart app without any effect.

The CLI doesn't indicate why a release failed when specifying a non-semver compliant app version

The code-push release command displays helpful error messages when the specified app and/or deployment aren't valid, but if you specify a non-semver compliant app version label (e.g. 1.0 instead of 1.0.0), it just silently fails and displays the help output for the command. I'm assuming that means that the issue is actually with the parser, and that the request is never hitting the server.

The command's examples in its help output correctly displays the use of semver version strings, but we should make sure the CLI provides as much guidance as possible. To that end, it would be great if we could catch this scenario and clearly report the issue to the user so they would know how to respond (e.g. change 1.0 to 1.0.0).

Deployment ls command and empty deployments

When a deployment hasn't had an update released to it yet, it's respective Update metadata cell within the table outputted by the deployment ls command, should display a message that indicates this state, very similarly to what we did for the new Install Metrics feature/column.

I propose we display "No updates released", using the same magenta color that is used for the existing "No installs recorded" message.

ios react native switch bundle problem

CodePush.setDeploymentKey("firstkey")
jsCodeLocation = CodePush.bundleURLForResource("FirstApp")

first bundle loaded ok, and in FirstApp syncing is working fine as well.
when trying to e.g. click a button and load a second bundle as:

CodePush.setDeploymentKey("secondkey")
jsCodeLocation = CodePush.bundleURLForResource("SecondApp")

location is still pointing to the first one. how could I implement something like this?

[CLI Docs] It isn't clear whether release-react bundles with assets or not

The section in the CLI docs on react-release says:

It runs the react-native bundle command to generate the update contents in a temporary folder

The linked page then lists multiple prepare commands for react native, some of which build w/ assets and some of which don't.

I'm not sure (without digging into the code) whether the release-react command will bundle with assets for the specified platform (which is what I want), or whether I need to use the manual process of build and release.

Any chance you can clarify the intended behaviour here and in the docs? Or maybe even add an option to the release-react command controlling whether assets are included or not.

Otherwise, btw - thanks! Docs and setup experience have been great. Love your work.

Cordova iOS 3.9.2 crashes when installing update

I'm experiencing a crash in my Cordova 3.9.2 iOS app that occurs once CodePush has downloaded an update and then tries to install it. I'm running it on iOS 9.2.1.

This is the output from the Xcode console:

[CodePush] Package download success: ...
[CodePush] Installing update package ...
THREAD WARNING: ['File'] took '1799.862305' ms. Plugin should use a background thread.
[CodePush] First update: back up package information skipped. 
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[4]'
*** First throw call stack:
(0x1817ed900 0x180e5bf80 0x1816d6bcc 0x1816e2674 0x10008fb70 0x10008e6e4 0x1001413d8 0x100140ca4 0x100142260 0x1821afe20 0x1817a4efc 0x1817a4990 0x1817a2690 0x1816d1680 0x182be0088 0x186548d90 0x10004b3fc 0x1812728b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

This is the output from cordova plugin ls:

code-push 1.7.0-beta "CodePushAcquisition"
cordova-plugin-camera 1.2.0 "Camera"
cordova-plugin-code-push 1.5.1-beta "CodePush"
cordova-plugin-console 1.0.0 "Console"
cordova-plugin-crosswalk-webview 1.2.0 "Crosswalk WebView Engine"
cordova-plugin-device 1.0.0 "Device"
cordova-plugin-dialogs 1.2.0 "Notification"
cordova-plugin-email 1.0.0 "EmailComposer"
cordova-plugin-file 2.0.0 "File"
cordova-plugin-file-transfer 1.0.0 "File Transfer"
cordova-plugin-geolocation 1.0.0 "Geolocation"
cordova-plugin-globalization 1.0.1 "Globalization"
cordova-plugin-inappbrowser 1.0.0 "InAppBrowser"
cordova-plugin-network-information 1.0.1 "Network Information"
cordova-plugin-splashscreen 3.0.0 "Splashscreen"
cordova-plugin-urlhandler 0.7.0 "URLHandler"
cordova-plugin-whitelist 1.0.0 "Whitelist"
cordova-plugin-x-socialsharing 5.0.7 "SocialSharing"
cordova-plugin-zip 3.1.0 "cordova-plugin-zip"
phonegap-facebook-plugin 0.12.0 "Facebook Connect"
phonegap-plugin-barcodescanner 4.0.2 "BarcodeScanner"
phonegap-plugin-push 1.3.0 "PushPlugin"

The other non-standard Cordova change that I've made is to AppDelegate.m to fix some Facebook Connect plugin issues, I'm not sure if this could contribute to the crash though:

- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation
{
    if (!url) {
        return NO;
    }

    // iOS9 - https://github.com/ccsoft/cordova-facebook
    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 sourceApplication, @"sourceApplication", nil];
    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url userInfo:dict]];

    return YES;
}

edit: It seems to work fine on the Android version of the app with Cordova 4.1.1.

Any ideas what could be causing this crash?

Losing deployment after Application is "swiped up"

Hi there,

When I run CodePush's example app and I do an update, the update runs successfully on resume. However, if I swipe up and close the app, the build reverts to the one that was shipped with the binary. Is this by design? I can't get the build to stick after shutdown.

Thanks!

Newlines in a release description aren't handled correctly

If you add an "\n" to the description of a release, the slash will be escaped, and therefore, turned into "\n". When the description property is then displayed within the app or deployment history, the literal value "\n" is displayed as opposed to an actual newline.

Update prompt

code-push release mandatory flag (Using code-push-cli v1.6.0-beta)

I noticed if you use --mandatory false on code-push release it is still flagged as mandatory on the server even though it says it isn't mandatory from the CLI tool.

Example command to recreate:
code-push release MyApp ./release 1.0.0
--mandatory false
--deploymentName Staging

When the app does a "checkForUpdate" the response is always:
isMandatory: true,

The mandatory flag is also always set to true when you use the new "release-react" command as well.

code-push release progress

When release a 10M compressed resources, it takes about 10 Minutes or more in China, add a progress will much better.

App version vs target version

Hi. Thanks for CodePush! We did find one thing quite confusing though. On the homepage, the code-push release command is shown as follows:

code-push release <appName> <package> <appStoreVersion>

We took appStoreVersion to mean the new version, i.e. the version we are deploying with this release. It was only after reading the CLI help and other docs, that we realised this should be the target version (<targetBinaryVersion>), i.e. the versions we want to update.

Please could the homepage be updated so it is more in line with the CLI docs?

code-push release <appName> <updateContents> <targetBinaryVersion> ...

[Android] Images not loaded after releasing a new version

On android:

  1. I upload an APK to google play store, an image(png) is loaded in a specific place of the app
  2. nothing is changed to that very same image or code related to it, I code-push/release a new version of the app for some other changes
  3. app downloads the version, restarts properly; Then that image is not loaded, blank!

My code-push command tool version is 1.9.1-beta; My react-native app has the version of "react-native-code-push": "^1.8.0-beta" in package.json.

An example of the image:

Path in my React native app:
myapp/image/map/marker4_jp.png (140 × 180)

Code to show the image:

<Image source = {require('../image/map/marker4_jp.png')}  />

I can see in the generated bundle (for upload), it's located in:

myapp/release/drawable-mdpi/image_map_marker4_jp.png

Please notice that the name image_map_marker4_jp.png is different than the original file name, but I guess that's by design? Even more strange, I can see in the same myapp/release/drawable-mdpi/ folder, most of the other images do load in the newer version after restart. So it doesnot happen to every image.

I' ll see if I can provide more information, it's just hard for me to debug...

Update asset not working?

I built a cordova android of init version 1.0.0, released to code-push server and installed it to android emulator, then I updated the asset and use "code-push release MyDemo C:\MyDemo\platforms\android\assets\www 1.0.1 -d Production" to release a updated vertion to code-push server, but when I start app from android emulator, it says that the app is "Update to date" and cannot detect the new version on code-push server, what's I missed?

"Code Push" or "CodePush" or "code push"? Let's standardize.

Here are some examples:

"CodePush" is used here
https://github.com/Microsoft/code-push/blob/master/cli/script/command-parser.ts#L173

"Code Push" is used here
https://github.com/Microsoft/code-push/blob/master/README.md
https://github.com/Microsoft/code-push/blob/master/LICENSE.md

"code push" is used here
https://github.com/Microsoft/code-push/tree/master/cli#usage

I think we should use "CodePush". That's what our landing site uses and that's where our branding is the strongest.

A typo in the docs.

There is a typo on /docs/cordova.html line 706.
updatedialog should be updateDialog.

About appStoreVersion property?

Hi
About appStoreVersion, it confused me a lot. I did some test. Following is steps

  1. make my App's version is 1.0.0
  2. upload a js package which need version 2.0.0
  3. open my App, upgrade alert is shown

So in my mind, it should not have alert shown because my uploaded js package needs one App which version is 2.0.0. Is it right?

Rollback command should allow specifying a target release label

Currently, the rollback command only supports rolling back to the previous release. While this accommodates the most common use case, it's possible that a user tries to solve a bad release with another release, which also ends up having issues, only to realize that they wanted to just rollback to the release before the initial bad one. Currently that wouldn't be possible, and therefore, the dev would have to try to fix the release and update a new one again, which is an extremely error prone operation, especially during a fire drill situation

Since the goal of the rollback command is to provide a simple and reliable way to address fire drills associated with a bad release, we should accommodate rolling back to an arbitrary release. Even if that only accommodates a small percentage of scenarios, it would be worth it, so that devs aren't left hanging after trying to fix an issue.

We should add a new optional flag to the rollback command called "--targetRelease" (which is aliased as "-r"), that takes the release label (e.g. v23) that the user wants to rollback to. When this label isn't specified, the rollback command would behave the way it already does. Otherwise, the command should create a new release whose contents and metadata represent the target release.

If the target release flag is specified, and the specified release label is invalid or doesn't exist within the deployment, a clear error should be displayed in the CLI.

The provided resource is too large

error message "The provided resource is too large" shown when i code-push release to staging
and i cannot found size limit info in documentation.

Strange partial release issue

Apologies in advance that this is going to be a bit vague, but I thought I should post it anyway...

Back when we were confused about the app version , we made a release of our new app version 1.3.1, setting the target version (by mistake) to 1.3.1.

Strangely, my version 1.3.0 of the app (downloaded via HockeyApp, so unfortunately I couldn't debug locally) did still update to this 1.3.1 - but only partially! I saw one of our code changes come through, but not another. Even more strangely, both changes should have been within the same bundle.js JavaScript file. So I can't think why/how it could have only resulted in us seeing one, but not the other.

Afterwards, we released 1.3.2, setting the target version to 1.3.1, and we saw that come through fine (both changes).

Could there perhaps be a strange bug to do with setting an invalid target version...?

If this is not very helpful, I'd be happy to re-test again later, this time with a local development version of the app, and try to provide some more details!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.