Visualizzazione post con etichetta tipsandtricks. Mostra tutti i post
Visualizzazione post con etichetta tipsandtricks. Mostra tutti i post

domenica 24 maggio 2015

Disable log when you release an iOS version

NSLog is very useful during the development phase but it's not secure to have it enabled when you want to release your application on iTunes.
A quick solution, avoiding to change each class of your project, is the following (thanks again to Stackoverflow)
Put this 3 lines at the end of your application -prefix.pch file:
#ifndef DEBUG
  #define NSLog(...) /* suppress NSLog when in release mode */
#endif
You don't need to define anything into your project, because DEBUG is defined in your build setting by default when you create your project.

sabato 16 maggio 2015

MakeAppIcon: easily creation of your application icons

The service MakeAppIcon helps you when you need to create multiple sizes icons for your applications.

You can drag and drop your original image (preferably 1024x1024) in the toaster's home page and after few seconds you will have all the needed icons for your iOS (iWatch included) and Android application.

You can enter your email address to receive everything directly in your inbox.




mercoledì 13 maggio 2015

Find errors in your iOS project .strings files with Plutil

When you have an syntax error in your application's localization file and you try to build your project, Xcode will give you the follow error:

/Users/Emanuele/git/MyTeamManagerIPhone/MyTeamManagerIPhone/fr.lproj/Localizable.strings:0: Read failed: The data couldn’t be read because it isn’t in the correct format.

Often the error is a missed semicolon somewhere in the file but Xcode won't point it out and when the file is big, find the issue manually can be a timing consuming task.

I found on Stackoverflow a very useful response to a similar problem. The solution is using a utility of OS X called plutil, which allow to check the validity of a property file or convert a plist file to another format.

So if your run the command:

plutil -lint <yourpath>/Localizable.string

you can get a clearer message helping you to find immediately where your file has the problem:

2015-05-14 00:08:12.331 plutil[40933:3760056] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 99. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.
/Users/Emanuele/git/MyTeamManagerIPhone/MyTeamManagerIPhone/fr.lproj/Localizable.strings: Unexpected character / at line 1

venerdì 14 marzo 2014

@synthetize vs @dynamic in ObjectiveC

Since it's the second or third time that I find myself looking for a response to this question on Internet, I'd like to note it here and share with everyone who needs an explication of the difference between the to directives @dynamic and @syntethize in Objective C.

The response is posted by Alex Rozanski in a Stackoverflow thread

Some accessors are created dynamically at runtime, such as certain ones used in CoreData's NSManagedObject class. If you want to declare and use properties for these cases, but want to avoid warnings about methods missing at compile time, you can use the @dynamic directive instead of @synthesize.
...
Using the @dynamic directive essentially tells the compiler "don't worry about it, a method is on the way."
The @synthesize directive, on the other hand, generates the accessor methods for you at compile time (although as noted in the "Mixing Synthesized and Custom Accessors" section it is flexible and does not generate methods for you if either are implemented).

giovedì 13 marzo 2014

ObjectiveC: Create a thread safe singleton

If you need to create a singleton keeping it thread-safe, Apple recommends to use the dispatch_once paradigm.

Below an example taken from a Stackoverflow thread (where a user mention this method is 2 times faster than using the classic synchronized paradigm):

+ (MyClass *)sharedInstance
{
    //  Static local predicate must be initialized to 0
    static MyClass *sharedInstance = nil;
    static dispatch_once_t onceToken = 0;
    dispatch_once(&onceToken, ^{
        sharedInstance = [[MyClass alloc] init];
        // Do any other initialisation stuff here
    });
    return sharedInstance;
}

domenica 28 aprile 2013

Manymo: test and share you android applications on different resolutions screens

Manymo is a cloud service that allows developers to launch their applications (or their mobile site) on an Android emulator embedded  in a web browser. It provides many different emulators and it is possible to choice among several resolution and several version of the OS.

You can easily embed the emulator on your website and you can also connect to it from your local computer to use the "dab" tool with the remote application.

Developers have only to upload their APKs and decide on which emulator they want to test their applications.
It would be useful to have the possibility to use the application simultaneously on many emulators: so far I haven't found this option. Besides that, having the possibility to keep the application data stored between a session and another will be appreciated.

Generally speaking, the utility is useful especially to test the look&feel of your activities (or mobile website) on different resolution and to embed the application on a website.



lunedì 22 ottobre 2012

Ground Control: a simple iOS library to control your remote for control

The needs to control your application from remote is becoming more and more important. Talking about iOS application you might want to hide or control some features during the Apple validation process or after the application has been launched.

Or maybe you'd like to show a specific message to the user under certain conditions that you can verify on server side.

Ground Control is an iOS library built on top of AFNetworking that makes easy to accomplish this task.

GroundControl asynchronously downloads and reads a remote plist file. This could be a static file or generated dynamically, like in the following examples

Few lines of code and you are ready to go. Discover more on GitHub

martedì 21 agosto 2012

Otto library for the communication inside an Android application

When an Android application become complex, the communication between the different parts of your code become difficult and in this complexity the risk of introducing bugs grows.

A tiny library called Otto and developped by Jack Warthon, helps to simplify your code and to update easily different parts of your application following an event produced by an action.

In fact you might need to update the status of several acitvities after a change in the settings. A deep explication of the communication problem and the example using Otto are published on the Square blog while the library is downloadable from GitHub and there you will find also a complete tutorial


venerdì 25 maggio 2012

Browse your Android SQLLite database from Eclipse

I think this is very useful tool for any Android developers. Sometimes you need to check what you store in your application database or SharedPreferences. Ok, you can always write a good test for it, but in some case you just need a quick check to verify the integrity of your stored data or the structure of your tables.

Since a lot of Android developers uses Eclipse to implement their application, it would be great to have a tool inside our IDE to explore our application Database.

SQLite & XML Browser is the tool that allow that. You can download it clicking here

After that you have downloaded the plugin you can:
  • Put the file in your Eclipse plugins folder (e.g. /usr/lib/eclipse/plugins)
  • Restart Eclipse
  • Start up an Android Emulator w/ Debugging in Eclipse
  • Switch to the DDMS Perspective in Eclipse
  • Go to the 'File Explorer' tab to locate your device's database file
  • Navigate to: e.g. 'data -> data -> com.myapplicationpackage -> databases -> myapplication
  • Click on the little Database icon at right top
  • Switch to the 'Questoid SQLite Browser' tab that appears
  • Switch to the 'Browse Data' sub tab
  • Select your table from the drop down menu
  • Browse data
 Here you are a video that show how it works:

mercoledì 25 gennaio 2012

The Blackberry Appworld guide

Any application store has a different way to manage application, versions, supported device and so on...This fragmentation might become a nightmare for people in charge of managing delivery and maintenance of multiple applications across different platform.
For that reason it is really useful to have always in hand a document that help in discovering all the different aspects of the application stores and how to manage them

Often Blackberry is not the best and friendly platform for developers and product managers that want to deliver a state-of-art application but at least they don't forget to provide a document to drive people inside their application store.

Check this out: Click for AppWorld administration guide

venerdì 20 gennaio 2012

The new website to design super Android application

Image from http://developer.android.com/design/index.html

The Android Developer Website launch a new section very full of best practices and tips to build Android applications at the top level, not only in terms of features but also in terms of user interface. The website Android Design is well organized and any developer gets a very complete overview of what is good and what is not in terms of graphic interface.

Very nice the pages where a lot of best practices about how to communicate with the user are given. An award is deserved by the page where it is suggested a "Pure Android" (underlining the differences with iOS and Windows Phone)






mercoledì 21 dicembre 2011

A very good initiative by Google: Android training

Some days ago, Google launched its initiative to help developers to build better Android application. Designing effective navigation, battery life and audio playback to begin but many others classes will come in the coming months.

It is for sure a good way to create a strong link between the Android OS and the developers!


Android training

giovedì 15 dicembre 2011

A Reto Maier presentation at Google I/O 2011

It worths a lot looking the video of the presentation that Reto Maier did at Google I/O 2011...

The link to his blog: here


martedì 21 dicembre 2010

The Blackberry devices different resolutions


Blackberry Torch

I found the table below on a nice website (MobiMadness) and I think it worths share it with you. It lists the screen resolutions of the different Blackberry families:

<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>
<><>

BlackBerry® 7100 Series

240 x 260 pixels

* Icon layout: 60 x 55 pixels
* Zen layout: 48 x 36 pixels

BlackBerry® Pearl™ 8100 Series

240 x 260 pixels

* Icon layout: 60 x 55 pixels
* Zen layout: 48 x 36 pixels

BlackBerry® Pearl™ Flip Series

240 x 320 pixels

46 x 46 pixels

BlackBerry® 8700 Series

320 x 240 pixels

* Icon layout: 53 x 48 pixels
* Zen layout: 48 x 36 pixels

BlackBerry® 8800 Series

320 x 240 pixels

* Icon layout: 53 x 48 pixels
* Zen layout: 48 x 36 pixels

BlackBerry® Curve™ 8300 Series

320 x 240 pixels

* Icon layout: 53 x 48 pixels
* Zen layout: 48 x 36 pixels

BlackBerry® Curve™ 8350i smartphone

320 x 240 pixels

52 x 52 pixels

BlackBerry® Curve™ 8520 smartphone

320 x 240 pixels

52 x 52 pixels

BlackBerry® Bold™ Series

480 x 320 pixels

80 x 80 pixels

BlackBerry® Curve™ 8900 smartphone

480 x 360 pixels

80 x 80 pixels

BlackBerry® Storm™ Series


portrait view: 360 x 480 pixels
portrait view with keyboard: 360 x 247 pixels
landscape view: 480 x 360 pixels
landscape view with keyboard: 480 x 156 pixels



73 x 73 pixels

BlackBerry® Tour™ 9630 smartphone

480 x 360 pixels

80 x 80 pixels

venerdì 12 novembre 2010

Blackberry: place a field at the bottom of a screen

When you need to place a field at the bottom of your application screen you can use the setStatus method in the Screen object.
That will keep your field anchored at the bottom even if the rest of the screen is scrolling.

See this question on Stackoverflow

giovedì 17 giugno 2010

Navigate the Blackberry screen stack

You need sometimes to know which screens are in the screens stack of your Blackberry application maybe because you want to remove all the screen below a specific screen because they are not needed anymore.

First of all you can get the active screen using the instruction:
UiApplication.getUiApplication.getActiveScreen();


Once you have the screen object you can call on it the method:

getScreenBelow()


you will get the screen object below. Generally you can move along the stack using also the method

getScreenAbove()


used together with the previous getScreenBelow method.

sabato 29 maggio 2010

Problem with HTC Desire and ADB driver? The solution is here.

If you try to connect your HTC Desire to your PC via USB having already installed the ADB driver for Android SDK, you will see that the driver is not working.

To fix the problem you need to install the USB driver coming with the HTC Sync (you can download here).

Thanks to James Giang for the tip.

martedì 25 maggio 2010

Android: when the debug certificate expires

Today morning, big surprise! Trying to build my Android application I get this error:
"Debug Certificate expired on....."
What a f..k? And now? What I'm supposed to do?

No worries....going to the default storage location for AVDs which is in 

- ~/.android/avd on OS X and Linux, 
- in C:Documents and Settings\.android on Windows XP, 
- in C:Users\.android on Windows Vista 

you can delete the file debug.keystore and the next build of the projects will generate again a new valid 
debug certificate

giovedì 4 febbraio 2010

Android: Get events when an edit text content changes

This is a problem not very well documented by Google but it is a common task the developers have to do often.

The solution is use a TextWatcher object that will receive event when the text in the EditText changes:

// Watcher to chage char counter when sms text changes
TextWatcher textWatcher = new TextWatcher() {
    @Override
    public void onTextChanged ( CharSequence arg0, int arg1, int arg2, int arg3 ) {
    }

    @Override public void beforeTextChanged ( CharSequence arg0, int arg1, int arg2,  int arg3 ) {
    }

    @Override
    public void afterTextChanged ( Editable arg0 ) {
         updateCharCounter(); }
    };

m_smsTextField.addTextChangedListener(textWatcher);

lunedì 11 gennaio 2010

Access android database from the shell

It is very important knowing what we save in the database of our application. To check easily the stored data you can access the database following these steps:

  1. Launch the emulator

  2. Launch the Windows command prompt and go under the "Tools" directory in the android sdk folder

  3. Type "adb shell"

  4. Type "cd data/data"

  5. You find the list of all applications. Enter in your application folder (for example "mypackage.myapp")

  6. Type "cd databases". You find all the databases. 

  7. Launch "sqlite3 <name_of_database>

Type ".help" to have all the instructions.
With the command ".tables" you can list all the database's tables.

Now you can write your query: select * from <name_of_table>.