Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Crashes on load #13

Closed
ptarjan opened this issue Sep 30, 2015 · 14 comments
Closed

Crashes on load #13

ptarjan opened this issue Sep 30, 2015 · 14 comments
Labels

Comments

@ptarjan
Copy link
Contributor

ptarjan commented Sep 30, 2015

I just got your plugin working, and now my app crashes on load with this:

Sep 30 16:42:24 Pauls-MBP Trimian[98961]: Error during update: Application build version is too low for this update
Sep 30 16:42:24 Pauls-MBP Trimian[98961]: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x003faa94 __exceptionPreprocess + 180
        1   libobjc.A.dylib                     0x036c1e02 objc_exception_throw + 50
        2   CoreFoundation                      0x002e9682 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 386
        3   CoreFoundation                      0x002fd8db +[NSDictionary dictionaryWithObjects:forKeys:count:] + 75
        4   Trimian                             0x0003b886 -[HCPContentConfig toJson] + 310
        5   Trimian                             0x0003b083 -[HCPApplicationConfig toJson] + 115
        6   Trimian                             0x0003f2d8 +[CDVPluginResult(HCPEvents) constructDataBlock:] + 88
        7   Trimian                             0x0003eee8 +[CDVPluginResult(HCPEvents) pluginResultForNotification:] + 568
        8   Trimian                             0x00038d20 -[HCPPlugin onUpdateDownloadErrorEvent:] + 304
        9   Foundation                          0x0336d0d2 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_2 + 40
        10  CoreFoundation                      0x003c2774 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
        11  CoreFoundation                      0x003c242a _CFXRegistrationPost + 458
        12  CoreFoundation                      0x003c2176 ___CFXNotificationPost_block_invoke + 54
        13  CoreFoundation                      0x0040e453 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1795
        14  CoreFoundation                      0x002a8e17 _CFXNotificationPost + 599
        15  Foundation                          0x032a7197 -[NSNotificationCenter postNotification:] + 131
        16  Trimian                             0x0004857e -[HCPUpdateLoaderWorker notifyWithError:applicationConfig:] + 286
        17  Trimian                             0x00047805 -[HCPUpdateLoaderWorker run] + 901
        18  Trimian                             0x00047084 __31-[HCPUpdateLoader executeTask:]_block_invoke + 68
        19  libdispatch.dylib                   0x04950a7f _dispatch_call_block_and_release + 15
        20  libdispatch.dylib                   0x0496e6fd _dispatch_client_callout + 14
        21  libdispatch.dylib                   0x049578ec _dispatch_root_queue_drain + 744
        22  libdispatch.dylib                   0x049575fd _dispatch_worker_thread3 + 108
        23  libsystem_pthread.dylib             0x04c89653 _pthread_wqthread + 724
        24  libsystem_pthread.dylib             0x04c86e0e start_wqthread + 30
@nikDemyankov
Copy link
Member

What value you used for min_native_version, and what is set in the CFBundleVersion?

@ptarjan
Copy link
Contributor Author

ptarjan commented Oct 1, 2015

I had min_native_version set as 1, and I'm not sure what CFBundleVersion would be. In my config.xml I have version = 0.38.0

@ptarjan
Copy link
Contributor Author

ptarjan commented Oct 1, 2015

I should not, the error message above doesn't matter. If I delete the chcp.manifest it gives me a different error message on the first line but still crashes with the same body.

@nikDemyankov
Copy link
Member

Strange. Will try to reproduce that and fix today.

@ptarjan
Copy link
Contributor Author

ptarjan commented Oct 1, 2015

Great thanks. It looks like one of those 4 values in my build is nil?

@nikDemyankov
Copy link
Member

Yes, something went nil. When download fails - plugin prepares and sends notification to JavaScript. And it seems, that some value is nil in the preparation stage.

@nikDemyankov
Copy link
Member

Most likely, you are missing some option in application config. Maybe content_url - it is either empty or doesn't exist in the configuration file.

I will add some additional checks for nil in that part of the plugin. But this will prevent app from crashing. If application config is wrong - plugin is not gonna load any updates.

@ptarjan
Copy link
Contributor Author

ptarjan commented Oct 1, 2015

Yes, I don't have the content_url option. How does it get inserted? From the config.xml? Is it the same?

But yeah, crashing is much worse than giving a good error message.

@nikDemyankov
Copy link
Member

content_url - is server url, where all your project files are located. From it updates are loaded on the device. So this is a required preference for the plugin to work.

content_url should be a part of the application config. Url to the application config you define in your config.xml in config-file preference. When application launched - plugin loads data from config-file, checks if anything new is available, and if it is - uses content_url as a base path to the files from the manifest.

Please, look into documentation for more details.

Later today I'll add some additional info in the readme, since there are questions regarding configuration files. Some sort of step-by-step manual.

@ptarjan
Copy link
Contributor Author

ptarjan commented Oct 2, 2015

So if I'm doing a Cordova app is my content_url file://whatever_path_i_have_to_figure_out? Or is it my remote website? And how is the manifest location deduced? Same as the application config but changing the path TJ the predefined name?

Sent from my iPhone

On Oct 2, 2015, at 12:39 AM, Nikolay Demyankov [email protected] wrote:

content_url - is server url, where all your project files are located. From it updates are loaded on the device. So this is a required preference for the plugin to work.

content_url should be a part of the application config. Url to the application config you define in your config.xml in config-file preference. When application launched - plugin loads data from config-file, checks if anything new is available, and if it is - uses content_url as a base path to the files from the manifest.

Please, look into documentation for more details.

Later today I'll add some additional info in the readme, since there are questions regarding configuration files. Some sort of step-by-step manual.


Reply to this email directly or view it on GitHub.

@nikDemyankov
Copy link
Member

All configs should be stored on the server, plus - your project files (www folder content).

You specify url to the application config by setting config-file preference in the config.xml of your application. Application config must have a content_url and release preferences.

content_url should point on the remote server. Manifest file location constructed like so: content_url/chcp.manifest. For example, if your content_url is https://mycooldomain.com, then manifest file url should be: https://mycooldomain.com/chcp.manifest.

When plugin detects changed files - it loads them from the server. Url to those files are constructed like so: content_url/path_to_file_from_manifest. More examples can be found in the documentation.

@ptarjan
Copy link
Contributor Author

ptarjan commented Oct 2, 2015

Ok, so how do config-file and content_url differ? Is config-file === conftent_url/chcp.json?

@nikDemyankov
Copy link
Member

Usually - yes, config-file === content_url/chcp.json. But there are several main differences:

  1. config-file is hard-coded into the config.xml of your application, while content_url can be changed at any time. You can even make it different for each new release.
  2. config-file can be a script, that generates data on-the-fly, not a static file, like content manifest.
  3. config-file and content_url can point on different servers. Why not? For example, your config-file is set to https://mydomain.com/mobile/release, and the content_url to https://storagedomain.com.

So, splitting them gives you a little more flexibility.

@nikDemyankov
Copy link
Member

Fixed in version 1.0.3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants