SymbianGotchas
From NRCwikis
Contents |
[edit] Symbian Gotchas
Random list of "what the...", "gotchas", and "ahas" encountered while learning to program in Symbian on S60. Disclaimer: some of these may be wrong.
[edit] Development Gotchas
I seem to have successfully installed the sis file, but no icon appears in the "Installed" folder.
or
I compile the thing for the emulator and it doesn't appear in the "Installed" folder on the emulator.
You forgot to build and install the .rss file. The .rss file usually lives in the /data directory, and looks something like this:
#include <appinfo.rh>
UID2 KUidAppRegistrationResourceFile
UID3 0xA00001F6
RESOURCE APP_REGISTRATION_INFO
{
app_file="App";
embeddability=KAppNotEmbeddable;
newfile=KAppDoesNotSupportNewFile;
}
It gets built into a .rcs file using the following command in the .mmp file:
SOURCEPATH ..\data
START RESOURCE App_reg.rss
TARGETPATH \private\10003a3f\import\apps
END
It is then installed on the phone by putting the following command in the .pkg file:
$(EPOCROOT)\epoc32\data\z\private\10003a3f\import\apps\App_reg.rsc" -"!:\private\10003a3f\import\apps\App_reg.rsc
This usually happens if you try to use Carbide's console app wizard which forgets to make this file for you.
I run my application and it just quits on me
You've just encountered your first Symbian SEGFAULT. In release mode a segfault causes Symbian app to just quietly quit. Compile your app for the emulator and run it through the debugger. If you are brave, compile your app using Phone Debug mode and use on-device debugging.
I run my app and it just quits on me and I swear there is no way I can have a segfault, I am just allocating a bunch of memory here...
You are probably running out of heap by allocating too much memory. In theory, Symbian should give you an out of memory error, which you should trap in your main, and exit gracefully. That doesn't always happen. The default amount of heap allocated to an application is 2MB. You can increase this by using the EPOCHEAPSIZE directive in your mmp file, which you can set using the Carbide mmp wizard, or just adding the following line (this sets max heap to around 8MB):
EPOCHEAPSIZE 0x1000 8000000
I run my app and it just quits on me and I swear I am not running out of heap, I just have this recursive function here...
If you have a very deeply nested recursion you can run out of stack. You can change the amount of stack by using the EPOCSTACKSIZE directive in your mmp file.
I want to build my project from source on the command line.
Really? You sure? Well, ok then. Here are some of the gotcha's.
1. Most symbian build scripts assume that you have your SDK directory aliased to S:. To do this, type
subst S C:\Symbian\9.2\S60_3rd_FP1
2. Many symbian makefiles and build scripts also assume that your source directory lives somewhere inside the SDK. For example, I make a src directory inside S: and put everything I want to compile there.
3. Usually after these two steps you can cd into the source dir, type
bldmake bldfiles abld gcce urel (or armv5 or udeb)
and things will "work". (This of course assumes that you have the SDK and perl setup correctly and have C:\Symbian\9.2\S60_3rd_FP1\Epoc32\tools in your path. This should be automatic if you are using a SymSee DOS shell.)
[edit] Installation Gotchas
"Cannot install" error when installing sis file to the phone.
Make sure you didn't accidentally bulid your project for the emulator. The .pkg compiler will happily build you a sis file with the emulator's executable. Right click on the project in Carbide, select "Active build configuration", and select one of the phone builds (GCCE or ARM).
"Access denied" when installing file to the phone
Check the package file and make sure the .dll or executable is going into /sys/bin directory, they cannot go anywhere else.
"Permission denied" when trying to run an application, or KErrPermisionDenied when tyring to load a dll
Your app was signed with a certificate that has different capabilities than the CertProvisioner you have installed on your device. This usually happens when you sign the file with a cert and forget to install the corresponding CertProvisioner to the phone. The CertProvisioner needs to be installed before any apps that were signed with it.
or
You are loading a dll that has different capabilities than the capabilities of the application that is loading it. A good rule of thumb is that all your dlls and applications should have the same capabilities, be signed by the same certificate that is granted these capabilities, and that certificate should be installed on your phone.
I try to install something and get an error "Unable to install signed application from an untrusted source."
This means the CertProvisioner you have installed on your phone does not match the certificate that was used to sign the app you want to install. Remember that
1. CertProvisioner needs to be installed before the application
2. CertProvisioner does not like to be installed on top of another CertProvisioner. If you had one on your phone already, you need to remove it (Tools->AppManager), and then install the new one.
And this is different from the error above, when the capabilities of the certificate didn't match the capabilities of the application.
Application not compatible with the phone. Continue anyway?
Say yes :) The Device ID is wrong in the mmp file, but it's harmless.
I try to install something and it says "Update error"
The app you are trying to install had its UID changed. It's fine, just uninstall the old app first (Tools->App Mgr), and install the new one.
I try to install a sis file and it says "No memory card" even though I told it to install to main memory
A sis file may actually contain multiple files to install. The installation path for some of them may have been hard-coded in the pkg file used to generate the sis file, and it may have specifically said that certain files are to go to the memory card.
[edit] Python Gotchas
I click on the python icon and nothing happens.
You probably have different versions of Python and PythonScriptShell installed. The versions need to match, if you update one, you must update the other.
