iPhone
Xml parsing and serialization for Mac OS X and iPhone OS
Apple provides the NSArchiver and NSUnachriver for object serialization / deserialization, but this can not handle any custom xml schema. So filling an object structure with the data of any custom xml schema has to be made manually. Since the iPhone developer community is rapidly growing, a lot of newbie programmer are despairing to deal with the available xml parsing possibilities.
The iPhone SDK only provides NSXmlParser for xml parsing, which is more useful to read certain parts of an xml file, than filling a whole object structure, which really is a pain.
The other possibility is the famous libxml library, which is written in ANSI C - not easy to use for someone who starts programming with objective-c and never learned proper C before. Event there are a lot of wrappers available, dealing with xml can be a pain for newbies.
And here my idea takes place. An XmlSerializer library which fills an object structure automatically could makes it a lot easier and increase the app quality for many programmers. My Idea should work like this:
The xml file:
<Test name="Michael" uid="28">
<Adress street="AlphaBetaGammastrasse 1" city="Zürich" postCode="8000" />
<Hobbies>
<Hobby describtion="blabla"/>
<Hobby describtion="blupblup"/>
</Hobbies>
</Test>
The business objects:
@interface Test : NSObject {
NSString *name;
Adress *adress;
NSArray *hobbies;
int uid;
}
@property (nonatomic, copy) NSString *name;
@property (nonatomic, retain) Adress *adress;
@property (nonatomic, retain) NSArray *hobbies;
@property (nonatomic, readwrite) int uid;
@end
@interface Adress : NSObject {
NSString *street;
NSString *city;
int postCode;
}
@property (nonatomic, copy) NSString *street;
@property (nonatomic, copy) NSString *city;
@property (nonatomic, readwrite) int postCode;
@end
How the xml serializer should work:
XMLSerializer *serializer = [[XMLSerializer alloc] init]; NSData *data = [NSData dataWithContentsOfFile:@"~/Documents/Test.xml"]; Test *test = [serializer deserializeWithData:data];
So I started a project for this idea. If you are interested in, the project can be found here. If you would like to join the project, so don’t hesitate to use the provided mailing list and ask for access.
IPhone SDK on G5 PPC
<!–adsense#Google Adsense-Banner–>Officially the iPhone SDK requires an Intel Mac with OSX 10.5. Since I have a four year old dual G5, which is still running like a young dear, I don’t want to buy a new Mac just for writing iPhone Applications.
After some research, I found out, that it’s possible to make it work on PPC since the iPhone SDK are universal binaries.
To share my knowledge, I write a small tutorial. Note, that I don’t take responsibility, for any defects cause somebody used my code!
How to get the iPhone SDK to work on PPC Macs
Most of the tutorials I found in the Web are not up to date, because there where no “Aspen” packages anymore. With the iPhone SDK for IPhone OS 2.1 (build 9M2517) you can follow these steps:
1. Download the official iPhone SDK here.
2. Mount the .dmg image and install the iPhone SDK (the iPhone SDK will be grayed out!).
3. After rebooting the Mac, mount the image again and go to the folder Package. Install all packages which have iphone in the name (e.g. Simulator, SDK, Documentation).
4. Go to the folder /Platforms on the local HD and copy the iPhone.platform and the iPhoneSimulator.platform folders to /Developer/Platform.
Don’t copy the whole platforms folder, Xcode will not run correctly anymore!
5. Now we come to the interesting part. Xcode has now access to the iPhone SDK, you can already create iPhone projects, but Xcode still wants to compile the sources for the Intel architecture. To change that, open the folder /Developer/Platforms/iPhoneSimulator.platform/Developer/
Library/Xcode/Specifications/ .
In this folder you will find the file iPhone Simulator Architectures.xcspec. Make a backup and open it in any text editor. The content should look something like this:
(
// 32-Bit
{ Type = Architecture;
Identifier = Standard;
Name = "Standard (iPhone Simulator: i386)";
Description = "32-bit iPhone Simulator architectures";
ListInEnum = YES;
SortNumber = 1;
RealArchitectures = ( i386);
ArchitectureSetting = "ARCHS_STANDARD_32_BIT";
},
// Old-style Debug
{ Type = Architecture;
Identifier = Native;
Name = "Native Architecture of Build Machine";
Description = "32-bit for build machine";
ListInEnum = YES;
SortNumber = 101;
ArchitectureSetting = "NATIVE_ARCH";
},
// Intel
{ Type = Architecture;
Identifier = i386;
Name = "Intel";
Description = "32-bit Intel";
PerArchBuildSettingName = "Intel";
ByteOrder = little;
ListInEnum = NO;
SortNumber = 105;
},
)
6. Change the line “RealArchitectures = ( i386);” to “RealArchitectures = ( i386, ppc);“.
7. Add the architecture configuration for G3, G4 an G5, the edited file should now look like this.
(
// 32-Bit
{ Type = Architecture;
Identifier = Standard;
Name = "Standard (iPhone Simulator: i386, ppc)";
Description = "32-bit iPhone Simulator architectures";
ListInEnum = YES;
SortNumber = 1;
RealArchitectures = ( i386, ppc7400 );
ArchitectureSetting = "ARCHS_STANDARD_32_BIT";
},
// Old-style Debug
{ Type = Architecture;
Identifier = Native;
Name = "Native Architecture of Build Machine";
Description = "32-bit for build machine";
ListInEnum = YES;
SortNumber = 101;
ArchitectureSetting = "NATIVE_ARCH";
},
// G3
{ Type = Architecture;
Identifier = ppc;
Name = "Minimal (32-bit PowerPC only)";
Description = "32-bit PowerPC ";
PerArchBuildSettingName = "PowerPC";
ByteOrder = big;
ListInEnum = No;
SortNumber = 201;
},
// G4
{ Type = Architecture;
Identifier = ppc7400;
Name = "PowerPC G4";
Description = "32-bit PowerPC for G4 processor";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 202;
},
// G5 32-bit
{ Type = Architecture;
Identifier = ppc970;
Name = "PowerPC G5 32-bit";
Description = "32-bit PowerPC for G5 processor";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 203;
},
// Intel
{ Type = Architecture;
Identifier = i386;
Name = "Intel";
Description = "32-bit Intel";
PerArchBuildSettingName = "Intel";
ByteOrder = little;
ListInEnum = NO;
SortNumber = 105;
},
)
Now you should be able to compile the iPhone project and run the app in the iPhoneSimulator. I never tried to put an App into the AppStore, but I think it should work.
Please let me know if my post could help you, or if you have any questions!
Further links to this issue:
- http://linuxclub.blogspot.com/2008/07/iphone-sdk-installtion-on-powerpc-g4.html
- http://forums.ilounge.com/showthread.php?t=223546
- http://www.iphoneatlas.com/2008/03/10/surprise-iphone-sdk-also-works-on-powerpc-macs/
Apple looses the NDA for IPhone
After months of protest, Apple has announced that they decided to drop the non-disclosure agreement (NDA) for released iPhone software.
Whatever that means exactly, Apple is working on the new terms and will send it to the developers within the next few days and we’ll see.
According to Apple, the NDA is in place to protect there inventions and innovations for the IPhone technology. Now, they think the NDA was too much burden for the developers, authors and others interested in helping further the iPhone’s success, so they are dropping it for released software.
2G Iphone works with basic Swisscom subscription.
In March I bought a 2G IPhone in Bangkok. The seller was very friendly and even hacked it for me. Now, almost a year later, Swisscom provides the IPhone in Switzerland.
First I installed the IPhone software 2.0 with the pwnage tool, it was very easy to hack it again. But Apple keeps updating the software (Actual 2.1) and I got tired to hack it each time again and I read that T-Mobile from Germany is going to sell the IPhone with prepaid card, so I just tried if my old 2G IPhone works with the unhacked software and my old Swisscom sim card and it really works without any problem.
Of course I don’t have any alternative installer like Installer or Cydia anymore, but I have less problems now.
So you guys who have an old hacked IPhone and a sim card of an official mobile provider, just update it, it works! ![]()