Showing posts with label subversion. Show all posts
Showing posts with label subversion. Show all posts

Sunday, August 2, 2009

Compatible code for OS 2.2.1 and 3.0

Recently, the itts apple server has a number of changes and one of my favourite opensource app AppSales Mobile failed to get the sales data. It is now updated and thanks to the developer for the updating

http://github.com/omz/AppSales-Mobile/


However, the project was set to compile for SDK3.0, there are only a few changes that need to bring this app to be compatible to OS 2.2.1 and 3.0 at the same time.

Here are the steps involved

(1) Base SDK set to iPhone Device 3.0
(2) In Project Settings, iPhone OS Deployment Target set to iPhone OS 2.2.1
(3) Change the source code in RootViewController.m that have setFont or setImage methods, there are about 18 such changes to be done.


This is how to change the source code by adding respondsToSelector: test before using the deprecated method



change from


  [footer.titleLabel setFont:[UIFont systemFontOfSize:14.0]];


to


  if ( [footer respondsToSelector:@selector(setFont:)] ) {
    [footer setFont:[UIFont systemFontOfSize:14.0]];
  }
  else {
    [footer.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
  }




change from

  cell.imageView.image = [UIImage imageNamed:@"Daily.png"];


to


  if ( [cell respondsToSelector:@selector(setImage:)] ) {
    cell.image = [UIImage imageNamed:@"Daily.png"];
  }
  else {
    cell.imageView.image = [UIImage imageNamed:@"Daily.png"];
  }


You may get warnings when build to actual 2.2.1 OS device, but this is normal. However, you cannot build to 2.2.1 Simulator.

The modified source is available here
http://code.google.com/p/apiexplorer/source/detail?r=20

Revision 20 is a modified source (as above) for version 2009/7

Revision 23 is the updated modification for version 2009/11/19

to checkout a revision

svn checkout -r 20 http://apiexplorer.googlecode.com/svn/branches/AppSalesMobile221 AppSalesMobile221r20
svn checkout -r 23 http://apiexplorer.googlecode.com/svn/branches/AppSalesMobile221 AppSalesMobile221r23



If you want to check out a previous version based on the commit hexdigit from the github repo, do this

git clone git://github.com/omz/AppSales-Mobile.git AppSales0731
cd AppSales0731
git checkout -b b0731 ff248e8e6c23386f867514c1c331a469b7d4cf45
git log






Friday, January 2, 2009

How-to create svn server (subversion) in iPhone

This guide shows you how to setup svn+ssh server in pwned iPhone

(1) Install subversion package in Cydia
apt-get install subversion

(2) create repository in iPhone (e.g. with the Project called UICatalog)

mkdir -p /var/root/Library/Subversion/Repository
svnadmin create /var/root/Library/Subversion/Repository/UICatalog
mkdir -p /tmp/UICatalog/trunk /tmp/UICatalog/branches /tmp/UICatalog/tags
svn import /tmp/UICatalog/ file:///var/root/Library/Subversion/Repository/UICatalog -m "Create Directory Structure"
rm -rf /tmp/UICatalog


(3) Import Project directory
import from iPhone
svn import UICatalog file:///var/root/Library/Subversion/Repository/UICatalog/trunk -m "Import project dir from iPhone"

import from Mac (assume iPhone IP is 10.0.2.2)
svn import UICatalog svn+ssh://root@10.0.2.2/var/root/Library/Subversion/Repository/UICatalog/trunk -m "Import project dir from Mac"

(4) Checkout Project directory
checkout to Mac (assume iPhone IP is 10.0.2.2)
svn checkout svn+ssh://root@10.0.2.2/var/root/Library/Subversion/Repository/UICatalog/trunk UICatalog

checkout a specific revision 5 to Mac (assume iPhone IP is 10.0.2.2)
svn co -r 5 svn+ssh://root@10.0.2.2/var/root/Library/Subversion/Repository/UICatalog/trunk UICatalogR2

checkout to iPhone to another dir
svn checkout file:///var/root/Library/Subversion/Repository/UICatalog/trunk UICatalog2

checkout a specific revision 5 to iPhone
svn co -r 5 file:///var/root/Library/Subversion/Repository/UICatalog/trunk UICatalog_v5


(5)Other useful svn commands
(change directory to the working copy that was checkout in iPhone)
cd UICatalog2
svn info
svn commit -m 'commit changes'
svn ls file:///var/root/Library/Subversion/Repository/UICatalog/trunk
svn log


(change directory to the working copy that was checkout in Mac)
cd UICatalog
svn add newfile.m
svn info
svn commit -m 'commit changes'
svn ls svn+ssh://root@10.0.2.2/var/root/Library/Subversion/Repository/UICatalog/trunk
svn log


(6) svn to googlecode.com
svn checkout https://<yourproject>.googlecode.com/svn/trunk/<yourprojectdirname> --username <your username without @gmail.com>

When prompted, enter your generated googlecode.com password.
The googlecode.com svn password is in the googlecode.com (it is not the same as the gmail password)

Profile -> Settings

cd <yourprojectdirname>
svn add newfile.m
svn commit -m 'commit changes: adding newfile.m'


import to a subdirectory
svn import <yourprojectdirname> https://<yourproject>.googlecode.com/svn/trunk/<yourprojectdirname>/ --username <your username without @gmail.com> -m 'commit changes: importing'

delete directory/files that were in the wrong place
svn delete -m "Deleting wrong place commit" https://<yourproject>.googlecode.com/svn/trunk/<directorytobedeleted> https://<yourproject>.googlecode.com/svn/trunk/<filetobedeleted> ....

(7) Others
The use of Xcode 3 and subversion is in Apple documentation here
http://developer.apple.com/mac/articles/server/subversionwithxcode3.html

You can make use of this to manage SCM for XCode project to google code, Mac or iPhone


(8) GIT
If you need git on leopard, here
http://code.google.com/p/git-osx-installer/
or use MacPorts (port install git-core)

or you can compile and install from source

mkdir ~/src
cd ~/src/
curl -O http://kernel.org/pub/software/scm/git/git-1.6.5.3.tar.bz2
tar -xjvf git-1.6.5.3.tar.bz2
cd git-1.6.5.3
./configure --prefix=/usr/local
make
sudo make install
git --version