Tải bản đầy đủ (.pdf) (48 trang)

iphone hacks pushing the iphone and ipod touch beyond their limits phần 8 ppt

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (3.79 MB, 48 trang )

 
Install the UICatalog Sample on the Device

provisioning proleunique device
identiers





[Hack #11.08]

→



11.08:Hack
Self-Sign Your SDK Projects






chroot jail
[Hack #1.03]
code signing


provisioning




You need to install and run at least one app from the App Store before you try this, or these d
workarounds may fail. It can be a free or paid app—it just needs to be from the real App Store.
Code Signing with Self-Signed Certicates

self-signed certicate



Download at Boykma.Com
HACK
# 11.08






→



.Figure 11-32





ldid


-S
$ ldid -S <program file>
ldid

ldid




Download at Boykma.Com
 

[Hack #11.02]
/Developer/Platforms/iPhoneOS.platform/Info.plist


<key>NATIVE_ARCH</key>
<string>armv6</string>
<key>PLIST_FILE_OUTPUT_FORMAT</key>
<string>binary</string>
<key>PROVISIONING_PROFILE_ALLOWED</key>
<string>NO</string>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>NO</string>
<key>SDKROOT</key>
<string>iphoneos2.2</string>


Disable Provisioning Checks on the iPhone





javacom






[Hack #2.06]



Download at Boykma.Com
HACK
# 11.09

11.09:HACK 






scp


Your computer and your iPhone should be on the same Wi-Fi network. You’ll also need d
to make sure that SSH is installed and enabled on your phone, as scp uses the SSH

protocol to communicate with the phone. You can check this in BossPrefs as well.

.appscpscp

$ scp -r YourApplication.app :/Applications/
YourApplication.app192.168.0.101

alpine[Hack #9.04]


respring

respring[Hack #11.12]


install
$ make install
installldid
respringmakeinstall


Download at Boykma.Com
 
11.10:Hack
Use a Virtual Machine for Building
iPhone Apps























[Hack #2.06]
Downloading and Conguring the VM






Download at Boykma.Com
HACK
# 11.10
chapter 11

.Figure 11-33


toolchain
.Figure 11-34




$ ifconfig -a
eth0eth4eth

/etc/udev/rules.d/z25_persistent-net.rules
eth0
Download at Boykma.Com
 

dhclient
ifconfig
.Figure 11-35
dhclient

[Hack #9.04]

# ssh root@<IP address>
.Figure 11-36





# apt-get install cvs
Download at Boykma.Com
HACK
# 11.10

.Figure 11-37


/root
/root/SDK20PROJECTS/
-rw-r r 1 root root 1951 2008-10-19 09:46 README.txt
drwxr-xr-x 2 root root 4096 2008-12-28 09:45 respring
drwxr-xr-x 4 501 staff 4096 2009-01-04 00:10 UICatalog
drwxr-xr-x 2 501 staff 4096 2009-01-03 20:41 WinterBoard
respring
[Hack #11.12]



respring
respringrespring

respring
respring
IPHONE_IP=192.168.0.11


vim






# apt-get install joe
Download at Boykma.Com
 

# cd /root/SDK20PROJECTS/respring
# joe Makefile

# make
# make install

make install












Ready to Go





11.11:Hack
Develop iPhone Applications on Your iPhone



gccbuild its own applications

in situ
Installing the Toolchain


Download at Boykma.Com
HACK
# 11.11

GCC
 
Make
 
Link Identity Editor (ldid)
 
OpenSSH (ssh)
 




[Hack #2.06]


/usr/include



[Hack #11.10]


joe-3.7.tar.gz


# scp joe-3.7.tar.gz root@<iPhone IP address>:/var/root
# ssh root@<iPhone IP address>
# tar xvzf joe-3.7.tar.gz
# cd joe-3.7
./configuremake
make install

./configurecongure script

./configure



cross-compiling

 host
# ./configure host=arm-apple-darwin
Download at Boykma.Com
 







math.h
umath.c


sed

# sed -i.old '/[jy][01]/ d' umath.c

-i.oldsed.old
umath.c
'/[jy][01]/ d'sed

dsedsed
j0j1y0y1
m_j0
sed
make
# make

ldid

# ldid -S joe
# make install



# joe README

 host
ldid

Download at Boykma.Com
HACK
# 11.12



respring[Hack #11.12]





# apt-get install subversion
svn co
# cd ~
# svn co UICatalog

Makefile.iphone
Makefilemake
makemake install
# cd UICatalog
# mv Makefile.iphone Makefile
# make
# make install



11.12:HACK 









Download at Boykma.Com
 
.Figure 11-38

respring
respring
.Figure 11-39
respring
respring[Hack #1.04]

respring
respring

respring
respring/usr/bin

Download at Boykma.Com
HACK
# 11.13


.Figure 11-40
respring
respring
/usr/bin/
# cp /Applications/BossPrefs.app/Respring /usr/bin/respring

# cp /Applications/Respring.app/respring /usr/bin/respring
/usr/bin/
# ln -s /Applications/BossPrefs.app/Respring /usr/bin/respring

# ln -s /Applications/Respring.app/respring /usr/bin/respring
respring


11.13:HACK 















Download at Boykma.Com
 







Specify the Application Delegate Class


UIApplicationMainmain
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
Create the Main Window and Root Views



outlets


•
•

•



applicationDidFinishLaunching


// create window
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.backgroundColor = [UIColor blackColor];
// set up main view navigation controller
MainViewController *mainViewController = [[MainViewController alloc] init];
// create a navigation controller using the new controller
navigationController = [[UINavigationController alloc]
initWithRootViewController:mainViewController];
[mainViewController release];
// add the navigation controller's view to the window
[window addSubview: navigationController.view];
[window makeKeyAndVisible];

UINavigationControllerMainViewController
Download at Boykma.Com
HACK
# 11.13

UITabBarController










initWithCoder:

awakeFromNib


init


loadView

view
MainViewController loadView

UIView *contentView = [[UIView alloc]
initWithFrame:[[UIScreen mainScreen] applicationFrame]];
self.view = contentView;
[contentView release];
self.view.autoresizesSubviews = YES;
autoresizesSubviews


UITableView

myTableView = [[UITableView alloc] initWithFrame:self.view.bounds
style:UITableViewStylePlain];
myTableView.autoresizesSubviews = YES;
myTableView.autoresizingMask =
(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
[self.view addSubview: myTableView];
initWithFrame:UIView
initWithFrame:style:


Download at Boykma.Com
 
initWithFrame:

autoresizingMask

UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight


UIViewAutoresizingFlexibleTopMargin UIViewAutoresizingFlexibleBottomMargin
UIViewAutoresizingFlexibleLeftMargin
UIViewAutoresizingFlexibleRightMargin
addSubview:
[self.view addSubview: myTableView];
initWithFrame:autoresizesSubviewsautoresizingMask
addSubview:

Removing the NIB from Your Project


Info.plistNSMainNibFile

Info.plist
${PRODUCT_NAME}${EXECUTABLE_NAME}

IBOutlet
IBOutlet#defined
IBOutlet

IBAction#definedvoidvoid

IBAction
Explore More UIKit Controls





Download at Boykma.Com
HACK
# 11.14

11.14:HACK 









.Figure 11-41






.Figure 11-42


Download at Boykma.Com
 


.Figure 11-43




.Figure 11-44




Download at Boykma.Com
HACK
# 11.14
chapter 11
.Figure 11-45








$ svn checkout apiexplorer

→


[Hack #11.08][Hack #11.09]



[Hack #11.15]




Download at Boykma.Com
 
11.15:Hack
Access Private APIs








[Hack #11.14]


class-dump



id






[Hack #11.11]



# apt-get install class-dump


# mkdir -p ~/dump/Celestial
# class-dump -H -o ~/dump/Celestial \
/System/Library/PrivateFrameworks/Celestial.framework/Celestial
# cd ~/dump/Celestial
#import
"NSObject.h"

#import
NSObject.h
sed

# sudo sed -i.old '/NSObject\.h/ d' *.h
Download at Boykma.Com
HACK
# 11.15
chapter 11

#import


/usr/include/
# mv ~/dump/Celestial /usr/include


iPhoneIP
$ cd /toolchain/sdk20/sys/usr/include/
$ mv Celestial Celestial.220
$ scp -r root@iPhoneIP:~/dump/Celestial .







Library

/Developer/Platforms/
iPhoneOS.platform/Developer/SDKs/
iPhoneOS2.0.sdk/System/Library/
iPhoneOS2.1.sdk/System/Library/
iPhoneOS2.2.sdk/System/Library/
iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator2.0.sdk/System/Library/
iPhoneSimulator2.1.sdk/System/Library/
iPhoneSimulator2.2.sdk/System/Library/
LibraryFrameworksPrivateFrameworks
FrameworksPrivateFrameworks


Celestial

/Developer/Platforms/
iPhoneOS.platform/Developer/SDKs/
iPhoneOS2.2.sdk/System/Library/
PrivateFrameworks/Celestial.framework

CelestialHeaders
Headers

Download at Boykma.Com
 
Headers
Celestial.frameworkbash

#!/bin/bash
for PLAT in OS Simulator; do
for VER in 2.0 2.1 2.2; do
fwpath=/Developer/Platforms/iPhone${PLAT}.platform/Developer/SDKs\
/iPhone${PLAT}${VER}.sdk/System/Library/PrivateFrameworks/$2.framework
echo "Copy to framework: ${fwpath}"
cp -R $1 "${fwpath}/Headers"
done
done
~/install-framework-headers.sh

$ chmod 755 ~/install-framework-headers.sh






iPhoneIP
$ mkdir ~/dump
$ scp -r root@iPhoneIP:~/dump/Celestial ~/dump/Celestial
$ sudo ~/install-framework-headers.sh ~/dump/Celestial Celestial
sudo
sudo
root

Add a Private (or Public) Framework to Your Application


LDFLAGS

LDFLAGS += -framework Celestial
Frameworks
→
Download at Boykma.Com
HACK
# 11.15

.Figure 11-46

FrameworksPrivateFrameworks




.Figure 11-47




#import









Download at Boykma.Com
 






#import <Framework/Header.h>
#import "Framework/Header.h"
#import "Header.h"

Add a Private Method to Your Application





















[Hack #11.14]setApplicationBadge:

Download at Boykma.Com

×