cs193p – Assignment #6 Part #1

cs193p – Assignment #6 Part #1

Please note, this blog entry is from a previous course. You might want to check out the current one.

You might have noticed that since the last post – finishing with the tasks of assignment #5 – nearly half a year has gone by. Partly, because I had to earn money … if you feel the need to help there, you are welcome to use the flattr or paypal buttons at the end of this post, or just buy one of my apps in the AppStore and write nice reviews. But mostly, I delayed this post because of the structure of this assignment … there is none … where all the other assignments were straight forward, and most of the tasks were separated from each other, the tasks of this assignment are interspersed with each other. I could not find a way to separate them in a sensible way. I tried, I failed …

I have got a couple of emails asking about the sixth assignment. My guilty conscience forces me to continue. WWDC starts any minute, I should try to finish before iOS 8 is available (to late … ).

… even without reasonable structure … let’s start … however, for the first seven tasks I will jump around quite a lot. I will call the individual posts “parts”, so please be patient …

Don’t forget this is a solution, not the solution. There not only might be, most likely there will be a better solution. Please feel free to send me your solutions, ask and discuss in the comments section at the end of each post …

… without further ado …

Copy and Rename a Project in XCode

Assignment #6 Task #1

Your application must work identically to last week except that where you are displaying the “top places” (as reported by Flickr), you are going to display the “top regions” in which photos have been taken. You will calculate the most popular regions from the data you gather periodically from the URLforRecentGeoreferencedPhotos.

The first step … which is actually not really required, but you could read it into this task as well as in hint #4 … is to create a copy of the project from assignment #5 and rename it to TopRegions.

cs193p – assignment #6 task #1 - renamed folder
renamed folder

Renaming the folder, does not influence the project itself. Next open the new (copied) project. In the project navigator select the current project name (TopPlaces) and click on the title a second time. Now you are able to change the project name. Once you have changed its title a view will appear asking to add some additional changes:

cs193p – assignment #6 task #1 - rename project title
rename project title

… but does not change everything, either:

cs193p – assignment #6 task #1 - renamed project title
renamed project title

You can change the groups the same way you changed the project title. However, this will only be a cosmetic change:

cs193p – assignment #6 task #1 - renamed groups
renamed groups

Open your project in finder and change the folder names:

cs193p – assignment #6 task #1 - renamed folders
renamed folders

… now your project should be broken. The original folders do not exist any more, the project does not know about the new ones (note the red file names):

cs193p – assignment #6 task #1 - broken references
broken references

Select a group with broken references, select the small folder icon in the File Inspector and choose the correct path for your new folders:

cs193p – assignment #6 task #1 - repaired paths
repaired paths

In the build settings of your project and targets search for the old folder names and replace them manually by the new ones:

cs193p – assignment #6 task #1 - changed build settings
changed build settings

… now your old project with the new project and folder names should work again …

You can change the scheme using “manage schemes”:

cs193p – assignment #6 task #1 - changed scheme
changed scheme

… and if you are really, really enthusiastic edit TopRegions.xcodeproj/project.pbxproj manually to weed out some additional occurrences of TopPlaces.

The complete code for tasks #1 to #7 is available on github.


3 thoughts on “cs193p – Assignment #6 Part #1”

  1. This is probably the most difficult thing I’ve done in CS193p 😉 What a nightmare! I found there were a few files where I had to do “absolute path” instead of relative. Thank you for posting these “how to”s to help fill in the blanks.

    1. Did you have a look at your TopRegions.xcodeproj/project.pbxproj file using a text editor? When you have changed the path of your project files you might need to adjust them manually to the new path …

Leave a Reply

Your email address will not be published.