Updated September 23, 2011:

In order to submit your app to Cydia, you will need to do a few things:

Sign your app with ldid, build for iPhone OS, test your app in jailbreak world.

Dont have a MAC?

Before you read on, there is a very easy framework for building applications in iPhone OSwithout xCode created by genius Dustin Howett. With this framework, you can compile on your iPhone, iPod, iPad without the need for owning a MAC.
See this link for more details. If you want quick and easy install instructions for installing theos on your idevice to use via ssh, do this:

1) Fire up cydia, make sure you’re set as user type developer, and search “BigBoss Recommended”. This is a set of command line tools that also has a hidden installs script.
2) In ssh on idevice, type “installtheos3″. This will download over 100mb of data so make sure you have a stable Wi-Fi connection.
3) This will install theos to /var/theos. 
4) For further theos help, I recommend irc channel irc.saurik.com #theos or refer to the link above for more details.

If you want to compile for Cydia using xCode, read on.

Compiling on the MAC with xCode

Code signing from xcode will not work. You will need to sign your app with ldid. Here are the steps to test your app in jailbreak world, sign it, and make its icon show up on your iPhone:

1) Build your binary in xcode with iPhone OS 3.0 setting or build your app using iPhone GCC or toolchain. Xcode always defaults to building only for the latest firmware. This seems like Apple’s way to force everyone to always update. It’s silly. Unless you have a technical reason for it, build for iPhone OS 3.0 not 3.1, 3.1.3 etc. If your app requires a specific version of the OS, you must state this clearly in the submission form or your submission will be delayed while I ask you to rebuild your app.

For code signing, you can just use “don’t code sign” in the “info” section of your project. Search for “code signing” to find where to set this. You will use ldid in a step further down instead. Note: this option seems to only exist for the 2.0 SDK or 2.0 SDK build option.

For SDK 3.0, disabling code sign is a bit trickier. It requires editing your /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/SDKSettings.plist and making it look like this:

Pay special notice to CODE_SIGNING_REQURIED, CODE_SIGN_ENTITLEMENTS, and AD_HOC_CODE_SIGNING_ALLOWED. You must restart xcode to have changes take effect.

2) SSH your application bundle to /Applications folder on iPhone.

3) chmod 755 your app binary inside your app bundle. If your app name is Test.app and your binary is test, then you would use: chmod 755 /Applications/Test.app/test

4) ldid sign your binary. Using the test example: ldid -S /Applications/Test.app/test. You should run this as user root, not user mobile. If you don’t have ldid installed on your iPhone, ssh in as user root, apt-get install ldid, then you will have it. Note: if you are working in mobile terminal, make sure to su root first. Note #2: ldid requires a unique inode. If you are replacing your binary with another compiled version, you must delete the old one and copy the new one. If you simply overwrite it, ldid will either crash or not work.

Alternatively, you can ldid on OSX in xcode:

ldid for osx is here. You can do this on osx machine or add it as a build step in xcode:
* Under targets, your project, right click and select  Add, new build phase, New run script build phase.
* Type in /usr/bin/ldid -S FULLPATH_TO_YOUR_BINARY

5) Respring to show your app icon. You must respring using either my respring app or sbsettings respring function. These will rebuild the cache and your icon will show up. A simple “killall SpringBoard” will not do this.

6) Finally, make sure you leave all code signing authority out of your Info.plist. By default, this will not be present.

How to make 2 apps one for 3.0 and one for 4.0 into one package:

If you have an existing app that is 3.0 and you are updating it for 4.0 and you need two apps to exist, you should instead control this by a launch script. For this we will use Snapture as an example. Snapture 3.0 binary is named Snapture3, snapture 4.0 binary named Snapture4. Then we make a bash script as Snapture. All get 755′d and Info.plist points to Snapture. Inside snapture you have:

!#/bin/bash
Snapture=$(dirname “$0″)
SOMEFRAMEWORKONLYON3=/System/Library/Frameworks/GameKit.framework/GameKit
if [[ -f $SOMEFRAMEWORKONLYON3 ]]; then
exec “/Applications/Snapture.app/Snapture4″
else
exec “/Applications/Snapture.app/Snapture3″
fi

Now your app runs on both 3.0 and 4.0 even though it has 2 separate binaries.

How to make a single app bundle for iPad and iPhone using separate binaries:

Using the example above, we can make a small modification and you can have a single app submission that works for both iPad and iPhone/iPods. I used clockus app as an example. The binary for iphone is clockusiphone and for ipad is clockusipad. Here is your script: (gsc.wildcat.list should only exist on ipads).

#!/bin/bash
Clockus=$(dirname “$0″)
SOMEIPADONLYFILE=/var/lib/dpkg/info/gsc.wildcat.list
if [[ -f $SOMEIPADONLYFILE ]]; then
exec “${Clockus}”/clockusipad
else
exec “${Clockus}”/clockusiphone
fi

Lets say you have a mobile substrate dylib and you need 2 binaries for that. Here is how you can handle it:

Make a new dylib that has *only* this function in it. This will be loaded by mobile substrate and decide which dylib to load at runtime.

init()
{
char* dylibPath = NULL;

// Get the system version and the path to the real mobile substrate dylib
if([[UIDevice currentDevice] systemVersion] hasPrefix:@”2″])
{
dylibPath = “/Applications/myapp.app/mydylib2.dylib”;
}
else
{
dylibPath = “/Applications/myapp.app/mydylib3.dylib”;
}

void* libHandle = dlopen(dylibPath, RTLD_NOW);
if(libHandle != NULL)
{
// This assumes your dylib’s init function is called init, if not change the name in “”
void (*init)() = dlsym(libHandle, “init”);
if(init != NULL)
{
init();
}
dlclose(libHandle);
}
}

There are a couple other minor differences between a jailbroken app and an appstore app:

1) Appstore app runs in a sandbox at /var/mobile/Applications/GUID/folder. Jailbroken app runs in /Applications

2) Appstore app has a Documents folder that is created by the installation process. Jailbroken app does not. It is up to the app to create its own folder. Should you need this type of folder, you must create this with a simple mkdir command in your applicationDidFinishLaunching function. Just add a simple function: mkdir(“/var/mobile/Library/YOURAPPNAME”, 0755); If the folder already exists, no harm done. You want to do this because the install process runs as user root and the app runs as user mobile. If Cydia does this for you then the folder will have the incorrect permissions.

Compile For Cydia Submission Author: BigBoss Updated September 23, 2011的更多相关文章

  1. Warsaw U Contest Petrozavo dsk Summer 2011 Training Camp, Monday, September 5, 2011

    Warsaw U Contest Petrozavo dsk Summer 2011 Training Camp, Monday, September 5, 2011 Problem A.Chocol ...

  2. Marketplace Client- Download

    Marketplace是Java平台被广泛使用的IDE(集成开发环境)Eclipse的软件商店.上面有个有种牛X的插件,可根据自己需要下载. Eclipse Marketplace官网地址:http: ...

  3. How To Compile Qt with Visual Studio 2010

    This post is a step-by-step guide on how to compile Qt 4.x.x with MSVC 2010. Although we use Qt 4.7. ...

  4. How To Compile Qt with Visual Studio

    How To Compile Qt with Visual Studio FEBRUARY 1, 2011 This post is a step-by-step guide on how to co ...

  5. cross compile vlc 播放器

    上一篇文章介绍了如何交叉编译 FFmpeg ,继续介绍  VLC播放器  交叉编译 . 首先下载 vlc 源码  我用的是 2.2.6  地址 : http://mirrors.neusoft.edu ...

  6. Java性能提示(全)

    http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...

  7. C# 泛型List用法

    C# List Examples by Sam Allen - Updated September 6, 2009 Problem. You have questions about the List ...

  8. (转)The Road to TensorFlow

    Stephen Smith's Blog All things Sage 300… The Road to TensorFlow – Part 7: Finally Some Code leave a ...

  9. Thinking Clearly about Performance

    http://queue.acm.org/detail.cfm?id=1854041 The July/August issue of acmqueue is out now acmqueue is ...

随机推荐

  1. 动态切换数据库(EF框架)

             文章简略:本文测试项目为Silverlight+EF+RIA Service动态切换数据库的问题 通常,Ado.net EntityFramework的数据库连接字符串Connect ...

  2. cdoj1344卿学姐种美丽的花

    地址:http://acm.uestc.edu.cn/#/problem/show/1344 题目: 卿学姐种美丽的花 Time Limit: 8000/4000MS (Java/Others)    ...

  3. NGUI 3.50 UIButton使用

    在NGUI,3.X的版本中,取消了创建UIbutton这个选项,所以我们可以创建uisprite.uilabel等,然后在上面附加uibutton脚本,达到目的,具体步骤 1:在界面上键好2D或3D ...

  4. JavaScript delete用法,属性,特性,执行上下文,激活对象 综合篇

    一.问题的提出 我们先来看看下面几段代码,要注意的是,以下代码不要在浏览器的开发者工具(如FireBug.Chrome Developer tool)中运行,原因后面会说明: 为什么我们可以删除对象的 ...

  5. 服务端Job调度程序

    GIT地址:https://github.com/youbl/PlanServer

  6. 用户登录ajax局部刷新验证码

    用户登录的时候,登录页面附带验证码图片,用户需要输入正确的验证码才可以登录,验证码实现局部刷新操作. 效果如图: 代码如下: #生成验证码及图片的函数  newcode.py import rando ...

  7. awk分割列-【AWK学习之旅】

    ---===AWK学习之旅===--- awk 内置分割函数:split,将列按照指定分割符,分割成数组 用法:split(str1,array,"分隔符") 文件内容: [roo ...

  8. Jquery 动态生成的元素绑定事件

    使用 on方法 $("#id1").on("click","#id2",function(){}) 这里要注意的是#id1必须是原来就存在的 ...

  9. Java数据类型——面试题

    1.short s1 = 1; s1 = s1 + 1;有什么错? short s1 = 1; s1 +=1;有什么错? 答:对于short s1=1;s1=s1+1来说,在s1+1运算时会自动提升表 ...

  10. js里面如何才能让成员方法去调用类中其他成员

    function fun(){ var _this = this; //如果函数是用var定义的私有函数,如下 var func1 = function(){ } //那么类中其他函数都可以直接通过f ...