Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
djreyes
Posts: 35
Registered: ‎11-13-2010
My Device: Torch 9810
My Carrier: Orange

Signed app doesn't work but unsigned does

I'm having a weird issue with an app. When I run the unsigned version it works fine but once signed it doesn't work as it should do.

 

Any ideas as to why this is the case?

DJ Reyes
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Signed app doesn't work but unsigned does

The most common cause by far is that the developer mistakenly thought she could write to the app/ folder in the released/signed version, the same as we can during development... We can write to app/native and elsewhere in there in a "devmode" app, deployed via debug token, but it's merely as a convenience to speed up deployment of very large apps.

If you've got data included in your app's assets (or anywhere else in the .bar) that you want to change at runtime, you must copy them to the data/ folder during the first launch of your app (or, at least, the first time any changes will be made).

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
New Contributor
nhuang
Posts: 8
Registered: ‎09-27-2012
My Device: BB 10 Dev Alpha
My Carrier: Roger

Re: Signed app doesn't work but unsigned does

I have the same problem. Runs well on Device-Release. But cannot work on Export-Release.

I put my data into assest, maybe this is the reason why it can't work. 

I will try to move it to data and check it again.

 

Thanks.

Please use plain text.
Contributor
djreyes
Posts: 35
Registered: ‎11-13-2010
My Device: Torch 9810
My Carrier: Orange

Re: Signed app doesn't work but unsigned does

Peter, what data would I need to move? Sorry, bit of noob here.

DJ Reyes
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Signed app doesn't work but unsigned does

djreyes, if you're referring to my comment about needing to move data the first time your app launches, you probably don't need to worry about that. I was talking about apps which ship with, for example, "starter" data such as some sample images, but then the user is allowed to modify those. They couldn't be modified in the same location they're initially installed, so the app would need to copy them to the data/ folder first, then modify them.

If you're just asking "what data can't be in the app/ folder", then: anything that may change.

Not sure I caught the gist of your question though, sorry.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Contributor
djreyes
Posts: 35
Registered: ‎11-13-2010
My Device: Torch 9810
My Carrier: Orange

Re: Signed app doesn't work but unsigned does

Apologies Peter, I don't think I explained it well enough. My niece had been working on an app based on a sample but she made a new project and just tweated the code adding things too. It seemed to work fine whenever she ran it on her Dev Alpha but when she exported a release build and we sideloaded the .bar file the app didn't work as she had planned. When installing an unsigned version, the app worked fine. Just not when it was signed.

 

Any reason why this would be?

DJ Reyes
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Signed app doesn't work but unsigned does

Best to read this page carefully and note that part about "read-only". http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.do...

If she simply tried writing to the same place where her code files or asset files are stored in the installed app, it will fail in a signed app because you can't do that... She'd need to change the path so any modifications to files occurs under data/ not app/.

If you unzip the .bar file (generally "unzip -t mybar.bar" would show the directory listing) you can see the arrangement of files in there. It exactly matches how the file is unpacked on the device when it's installed. This data/ folder I'm talking about doesn't exist there... it's *above* the app/ folder, as a sibling. When your app runs, the "current directory" is the parent of both folders, and the read-only folder ./app/ contains your code and assets, while the read/write folder ./data/ starts off empty, and is the only place you can write to files.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Contributor
djreyes
Posts: 35
Registered: ‎11-13-2010
My Device: Torch 9810
My Carrier: Orange

Re: Signed app doesn't work but unsigned does

When you say write, do you mean where it is saved?

 

The exported .bar ends up in the arm folder. Are you saying she should make the .bar file save somewhere outside the app folder?

 

I also couldn't unzip the .bar file.

DJ Reyes
Please use plain text.
Contributor
djreyes
Posts: 35
Registered: ‎11-13-2010
My Device: Torch 9810
My Carrier: Orange

Re: Signed app doesn't work but unsigned does

Ok, I managed to unzip it and I think I know what may be wrong. In the .cpp file there's a bit something is saving to app/native/tracks. app/native is where the code files are saved.

 

Could that be the issue?

DJ Reyes
Please use plain text.
Developer
Zymatic
Posts: 144
Registered: ‎12-18-2010
My Device: Limited Edition Z10 & Blackberry Playbook
My Carrier: Rogers Wireless

Re: Signed app doesn't work but unsigned does

Yes, that is the problem. As Peter stated previously signed app cannot save data to the folders app/foldername. All she would need to do it change the code to save to data/tracks and things should work as expected.
Playbook Apps:
Touch Painter, LinkShrink

BB10 Apps:
NoteToSelf , LinkShrink
Please use plain text.