There is not so much information in Russian about developing for jailbreak iOS, so I hope this information will be useful to someone.
For writing applications for jailbroken devices, many frameworks and toolkits have been invented. For example,
iOSOpenDev or
Theos almost all of them allow you not only to create applications, install them on devices, but also upload them to the Cydia repository.
In the article I will tell you how to create Hello World - an application using Theos (by @DHowett)
So, we need the iOS SDK, but if you are interested in this topic, I guess that you already have it, if not, download
developer.apple.com/devcenter/ios/index.actionFirst, let's set the environment variable, thanks to which we will know where theos is set. In the terminal we type:
export THEOS=/opt/theos
then download the latest version of theos with git:
git clone git://github.com/DHowett/theos.git $THEOS
or svn:
svn co http://svn.howett.net/svn/theos/trunk $THEOS
Next, we need the ldid utility. It simulates the process of signing binaries. You can find it in many places, for example, download @DHowett from the dropbox of a friend's folder:
curl -s http://dl.dropbox.com/u/3157793/ldid > $THEOS/bin/ldid chmod +x $THEOS/bin/ldid
We also need the dpkg utility, it can be supplied from any ports for poppy, for example
brew install dpkg
So, the preparatory work is over, proceed.
')
Create a new project using the utility new instance creator, select 1 - iphone / application:
$THEOS/bin/nic.pl NIC 1.0 - New Instance Creator< ------------------------------ [1.] iphone/application [2.] iphone/library [3.] iphone/preference_bundle [4.] iphone/tool [5.] iphone/tweak Choose a Template (required): 1 Project Name (required): HelloWorld Package Name [com.yourcompany.helloworld]: com.code.monkey Author/Maintainer Name [Max]: Max Instantiating iphone/application in helloworld/... Done.
This will create a subfolder of helloworld in the current folder with an application template. In it you can find the Resources folder, which contains the info.plist of our application. So here is the control file, with the description of the application in the Cydia repository
Package: com.code.monkey Name: HelloWorld Depends: Version: 0.0.1 Architecture: iphoneos-arm Description: An awesome application! Maintainer: Max Author: Max Section: Utilitie
Sources of our program - files
HelloWorldApplication.m
RootViewController.h
RootViewController.mm
main.m
Also, the nic utility will create a simlink in the project folder on the installed theos. And, actually, the Makefile, with the help of which we will build and upload our program.
Generated Makefile Content
include theos/makefiles/common.mk APPLICATION_NAME = HelloWorld HelloWorld_FILES = main.m HelloWorldApplication.mm RootViewController.mm HelloWorld_FRAMEWORKS = UIKit CoreGraphics include $(THEOS_MAKE_PATH)/application.mk
Where
APPLICATION_NAME is the name of our application. Without need it is better not to change it.
[applicationName] _FILES - a list of our sources. Here you will need to add all * .m and * .mm files.
[applicationName] _FRAMEWORKS - here we add a list of all the frameworks that our program uses, for example, UIKit Foundation CoreGraphics QuartzCore
We try to build our HelloWorld with the help of the make command, we should have something like this:
make Making all for application HelloWorld... Compiling main.m... Compiling HelloWorldApplication.mm... Compiling RootViewController.mm... Linking application HelloWorld... Stripping HelloWorld... Signing HelloWorld...
In order to install our application on the device and test on it, we need to set 3 environment variables:
export THEOS=/opt/theos/
To build a package with our application we type in the terminal
make package.
after which the deb-package com.code.monkey_0.0.1-1_iphoneos-arm.deb appears in the project folder. it can already be copied to the device using sftp and delivered using a mobile terminal
dpkg -i com.yourcompany.fooproject_0.0.1-1_iphoneos-arm.deb
but you can make it easier by typing in the terminal
make package install
During the installation, you will be prompted to enter an SSH password.
After that, you need to restart the springboard on the device, for example by clicking “Respring” in SBSettings. Or reboot the device, after which we will see our program and will be able to launch it.
In principle, this is all that is needed to write an application. There are downsides - no interface builder and simulator