Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Mac OS X Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-17-2009, 01:57 PM   #1 (permalink)
Associate Producer
 
Join Date: Mar 2009
Location: Nevada
Posts: 33
Mich is on a distinguished road
Default Danger: Modifying pbxproj File

Greetings all. While this is related to iPhone development, I think I should post in this section of the forums. I'm still fairly new to developing on a Mac. The release of the iPhone SDK is what finally pushed me over the line to get a Mac and start using Xcode.

I've developed on Windows using Visual Studio for a number of years, so I have a good base understanding of what the do's and don'ts are for general development.

On to the question at hand. Let's say I have an Xcode project called MyGame.xcodeproj. Inside the package contents is a file called project.pbxproj. It took me a while to realize that the .pbxproj can be edited like a text file (sort of).

I would like to know what the dangers are for making small, manual edits to this file. I am aiming for a very specific change that has not produced any noticeable problems. In the Xcode source tree, I have a folder called "Resources". In there I have added references to a couple of folders. This includes all subfolders and files.

In the file, under /* Begin PBXFileReference Section */, I found the reference to the file path of this folder:

7DE38F670F6F18FC0033976F /* common */ = {isa = PBXFileReference; lastKnownFileType = folder; name = common; path = /Users/gamedevmich/MyGames/MyGame/common; sourceTree = "<absolute>"; };

Example Change: /Users/gamedevmich/TestGame/common

I've changed the file path text, which automatically updates the folder when viewing it from Xcode. No errors have occurred, but I do not want to rely on my own limited experience.

Thanks in advance for any help =)
Mich is offline   Reply With Quote
Old 03-28-2009, 01:57 PM   #2 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 1
costan is on a distinguished road
Default Modifying pbxproj: not so dangerous, tools available

Mich,

Your change will work. The Xcode project file is a serialized object graph (much like what you'd get by using NSKeyedArchiver). So, you can modify any string property, and it's unlikely that anything will break. By "unlikely", I mean it won't happen as long as you keep out of the Proxy objects. On the other hand, you have to be careful when deleting objects, or changing references (the long hexadecimal numbers). Xcode tries to 'heal' broken graphs, but it won't always succeed.

If you want a safety net when performing more involved changes, please look into the tool I wrote, at costan's zerg_xcode at master - GitHub -- it manages the object graph for you, so it's harder to break anything.

Last, I noticed you're storing your files with absolute paths in your project. If you collaborate with others, you'll probably want to convert to relative paths, because other devs won't have the project in /Users/gamedevmich/MyGames. This way, you can move around the project, and everything will still work.

Hope this helps,
Victor


Quote:
Originally Posted by Mich View Post
I would like to know what the dangers are for making small, manual edits to this file. I am aiming for a very specific change that has not produced any noticeable problems. In the Xcode source tree, I have a folder called "Resources". In there I have added references to a couple of folders. This includes all subfolders and files.

In the file, under /* Begin PBXFileReference Section */, I found the reference to the file path of this folder:

7DE38F670F6F18FC0033976F /* common */ = {isa = PBXFileReference; lastKnownFileType = folder; name = common; path = /Users/gamedevmich/MyGames/MyGame/common; sourceTree = "<absolute>"; };

Example Change: /Users/gamedevmich/TestGame/common

I've changed the file path text, which automatically updates the folder when viewing it from Xcode. No errors have occurred, but I do not want to rely on my own limited experience.

Thanks in advance for any help =)
costan is offline   Reply With Quote
Old 03-29-2009, 03:12 PM   #3 (permalink)
Associate Producer
 
Join Date: Mar 2009
Location: Nevada
Posts: 33
Mich is on a distinguished road
Default

Much thanks Victor! =)

That's exactly the kind of information I needed. Now, I will not be distributing the Xcode projects. Each user's absolute path will be unique to their machine, since the app modifying the project file is fed the path to their game.
Mich is offline   Reply With Quote
Reply

Bookmarks

Tags
xcode pbxproj iphone

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 470
15 members and 455 guests
alexeir, David-T, Dj_kades, foslock, iAppDeveloper, jeroenkeij, LunarMoon, Mijator, myach, pipposanta, QuantumDoja, robsmy, sacha1996, SLIC, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,129
Posts: 402,928
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:26 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0