Archive for the ‘SDK Tools’ category

How to install apps on devices without certificate

September 28th, 2009

As you know to distribute the applications in App Store or even to debug them on real device according to Apple you have to pay $99 to achieve the provisiong and distribution certificate.

But of course as you know, there are always other ways to achieve the similar result. But 1st. your device has to be jailbroken and 2nd. you can distribute your app only among jailbroken devices via Cydia, Icy or less friendly through SSH. It has advantages and disadvantage. Not all iPhones and iPod touches are jailbroken (I guess maybe 10% are), but you don’t have to obey the rules from Apple about submitted apps and you don’t have to wait at least one week for the review result.

Tasks you need to do only once (for developer):

  1. Jailbreak your iPhone
  2. Install LDID (Link Identity Editor), Mobile Termial and OpenSSH from Cydia
  3. Go to /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.sdk/
    I personally tested in on 3.0 that’s why I put that in bold, if you are going to built your app on a higher SDK, go to the appropriate directory.
  4. Open the SDKSettings.plist in your favorite editor (I recommend Property List Editor in Utilities) and in Root -> DefaultProperties set CODE_SIGNING_REQUIRED = NO. BTW check if AD_HOC_CODE_SIGNING_ALLOWED equals NO and CODE_SIGNING_ENTITLEMENTS is blank.
  5. Save the file.

sdksettings

Please remember: modification of above .plist file simply allows you to build the package without signing it, so from now, you are able both to built package for Cydia and AppStore submission. Of course for App Store submission you provide a Distribution profile, for Cydia “Don’t Code Sign” in your project info under Build, Code Signing, Code Signing Identity, Any iPhone OS Device.

build

Tasks you need to do for every package (developer):

  1. Build your project without signing it (Don’t Code Sign).
  2. SSH your bundle to /Applications on your device. You can use Fugu for Mac or  WinSCP for Windows.
  3. Now you have to fake-sign it to make it working. Open Mobile Terminal and type:
    su root
    you will be asked for password, by default: alpine. Next:
    ldid -S /Applications/My\ Project\ Name.app/My\ Project\ Name
    make sure every space in name comes with the backslash before
  4. If any error occurs, it means that you have provided wrong file path or didn’t built it with “Don’t Code Sign”.
  5. Now you can test your application, how it works on real device with full touch control, accelerometer and device’s performance, it’s really different from the Simulator.
  6. If everything works correctly download the file that you modified with ldid – it’s the file named exactly the same as your project without any extensions, and replace it with original from your bundle.
  7. Now you can distribute it in your own way.

Instruments

May 5th, 2009

instrumentsscreenshot

dev_instrumentsmediumInstruments is the great tool to measure the performance of your application, problems, object allocations, memory leaks and more.

I personally don’t use it quite often. Why? I don’t have problems with memory leaks, because I know where I have to release some objects, where to keep them. How about performance? I measure the performance by debugging my application on the real device. Please remember, that iPod touch 2nd gen offers better performance because of it’s faster CPU. If your app runs smoothly on iPhone it will run even better on iPod touch but not vice versa!

OK, so far I told you my atitude to Instruments, but I’ve never said that I don’t use this tool at all. Of course I use. The goal of your application/game should’t be only the metter of how much fun or usability it provides, but also how long it takes to load, during gameplay not to show Loading screen every minute, uses as much memory as possible and cleans after app terminates.

Using the information from Instruments you have the great opportunity to improve your application. Use your application and track the graphs Instruments provides, optimize methods and delete any objects that has been allocated, but no longer needed.

In fact it’s difficult to describe, how you should use Instruments. The results are different for each application and differently interpreted by each developer. It’s up to you how Instruments can help you in development. If you can’t self-learn how to use this tool, I recommand you to read Instruments’ help.

Interface Builder

April 26th, 2009

interfacebuilder

dev_interfacemedium

Interface Builder is a great utility for new developers. As you might know, it’s used to design your user interface.

In fact, everything you create in Interface Builder you can also programmatically in Xcode. What is more Xcode given you more possibilities of customization any objects like sliders, toolbars, switches, images, text fields and more.

So what are advantages and disadvantages of using Interface Builder?

Disadvantages? None. Advantages? A lot of!

Interface Builder is a great utility that allows you to visually create an interface, not to guess what is the proper width, height and placement using X and Y coordinates. You can create almost every 2D game and application faster if using Interface Builder. It makes your code shorter – you don’t have to create the outlets manually, they are already created for you.

I will show you an example. How to create programmatically in Xcode a label:

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 50.0, 70.0, 30.0);];
label.textColor = [UIColor blueColor];
label.backgroundColor = [UIColor brownColor];
[label setText:@"My Text"];
label.textAlignment = UITextAlignmentCenter;
[self.view addSubview:label];

You will obtain the same result dragging & dropping the label from the I.B. Library to the view. Customization – like changing the text or background colour can be chosen from it’s menus, and while doing this, you track the changes and have full control if the new look matches the interface. But, customization is limited to keep I.B. window clear. You can’t rotate an label for example, but once you created an object and connected it to the right outlet Xcode can do the rest.

That was only an example. Interface Builder is really helpful and being a good programmer doesn’t mean the you have to use only Xcode. Relax, and play with I.B. every static content can be loaded from .xib files I.B. creates for you. Xcode will be necessary usually only if there is unknown number of objects to be displayed in the application.

Xcode

April 24th, 2009

xcode

dev_xcodemediumXcode is the main tool you will use during your apps development. It has a variety of settings and can be customized in the way it suits you, but it’s not as difficult it appears to be.

The difficult may be the code, programming language you will enter to write your application. Xcode is not only used to built iPhone apps but as well for Mac and other environments.

As you see on the Xcode screenshot above, its window has 3 major parts.

  1. Toolbar
    1. Active Target
      Here you can choose what is the active target. In most cases there will be only one position. Targets are useful if you won’t to create two similar version of your application, full and lite for example, although for beginners it’s much easier to create a new copy of the project for each version.
    2. Active SDK
      Here you can select for which environment and firmware version you are going to compile your application. It’s the best to compile for the lowest possible version. If you want to debug your application on iPhone Simulator choose Simulator – iPhone [version], if run on real device, choose Device – iPhone [version]. To run your code on iPhone using official way you have to be an iPhone Developer (and pay $99).
    3. Active Build Configuration
      Choose Debug for simulator, Release for real device and Distribution (will be available later) to send it later to App Store.
    4. Action
      Never mind, most of this option are available in ctrl-click menus.
    5. Build & Build and Go
      Compiles (and runs) your application.
    6. Tasks
      Terminates / kills application.
    7. Info
      Never mind.
    8. Editor
      Never mind.
    9. Search
      Ask your brother.
  2. Left part of the window
    When you create a new project, Xcode makes many files for you, so it saves your time because the main part of your application usually is the same. As you see files in project are organized into folders (groups), by default: Classes, Other Sources, Resources,Frameworks and Products. You can organize it in a way you like. I will explain what each file does in one of next lessons.
  3. Right part of the window
    Right part is divided into two sub-parts. Upper part shows the list of contents in selected folder / group / project / framework. Lower part displays a place where finally you can put some code.

That’s all. Not so difficult I guess.

iPhone Simulator

April 24th, 2009

simulator1simulator2simulator3

dev_simulatormediumiPhone Simulator is a tool that allows you to quick debug your applications. It’s almost the perfect copy of the real device, but it has some major and minor differences. The main advantage of using the simulator is that applications get loaded within few seconds. You can/should use simulator on the early stage of development.

Differences:

  • although there is almost the same environment, iPhone simulator doesn’t run as much system application as the real devices, so the bigger applications can run smoothly on simulator bot do not on real device
  • internet access to simulator is only passed via computer and treated like WiFi a, you cannot test how your application is using 3G or other cellular data transfer
  • you can’t control acceleration, you can turn the iPhone landscape and portrait mode, but you cannot tilt it to controls the games using accelerometer
  • you can’t use GPS feature to get location or track its changes
  • you can “touch” the simulator using one “finger” or two (hold the option key), but it’s impossible to use most of multi touch gestures or touch simulator with more “fingers”
  • you can’t use vibration alert
  • many sounds or musics won’t play on simulator, what is more some frameworks and classes to hold the sounds cannot be compiled to run on simulator
  • you can’t use a camera
  • you don’t risk damaging the real device if you get frustrated
  • iPhone simulator cannot be jailbroken, or I don’t know how
  • you can’t put any case on it

iPhone Simulator has almost the same functionality as a real device. You terminate an application by pressing the home button, you can turn it left, right, toggle in-call status bar, simulate memory warning and lock it. When installed you have access to apps like: Photos (with some albums), Settings (General, Safari and Photos settings), Safari and Contacts. To install your own app on simulator, in Xcode set Simulator – iPhone OS [firmware version] as Active SDK an Debug as Active Build Configuration.