Amazon.com Widgets How to tell a project where the files are
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 23, 2014, 02:57:36 PM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Newbie Corner
| | |-+ How to tell a project where the files are
Pages: [1] Go Down
Print
Author Topic: How to tell a project where the files are (Read 1250 times)
skronwith
Newbie
*
Posts: 17


Email




on: August 26, 2011, 05:15:35 PM

Let say I start a new project in Objective-C called proj1.  Through Xcode I create it and then create interface and implementation files by going in Xcode to the files menu.  Call them proj.h and proj.m

Now say I want to set up a new project, proj2,  and use these .h and .m files from project1.  How do I go about letting proj2 know where to find the proj.h and proj.m files.  The do not appear in the sidebar of proj2 as far as I can see.  Thanks.
Logged
seerex
Full Member
***
Posts: 177


Email




Reply #1 on: August 26, 2011, 09:28:45 PM

Just to make sure, your question lies in having 2 seperate projects and importing one into the other, right?

Havent tried myself, but maybe
Code: (Objective-C)
#import <adressOfFile>

You can drag-drop the file into "adressOfFile" from the desired project into the other. not sure if it works though as i havent tried, works when they are in same project atleast.
Logged

Best Regards -
J.B.J
If you think i helped you could return the favor Wink

Subscribe to my channel on youtube: http://www.youtube.com/user/JBJProgramming

My apps:
- iTap Fruits (all countries)
- Toilet-Quiz (Denmark only)
- Zoo Kids (Denmark only)
- Diablo Item Database (All countries)
skronwith
Newbie
*
Posts: 17


Email




Reply #2 on: August 26, 2011, 10:11:24 PM

I'll try that but I find it hard to believe that this sort of thing doesn't come up  a lot.  For example, if I had the fraction.h and fraction.m files described in the book and used them in a project to add fractions and later I wanted a separate project to, say multiply fractions together, I would want to use the same fraction.h and fraction.m files for the new main program to multiply.  I could always copy and paste  them into the new project but I still would think there would be a way to utilize the #import statement. 
Logged
fujilla
Global Moderator
Sr. Member
*****
Posts: 276


WWW




Reply #3 on: August 27, 2011, 12:39:04 AM

OK, lets put your question into the context of an iPhone app called MyApp1.

Then you create a new app called MyApp2.

You want to link a class or classes from MyApp1 into MyApp2 using the method you suggest (#import between apps/projects).

You then upload both apps to the app store (remember these are two separate entities).  Joe comes along and purchases MyApp1, and Mary purchases MyApp2.  If the means of linking between two projects as you suggest were possible then Mary would also have to purchase MyApp1 to get the functionality from that just to run MyApp2.

So basically, NO, it is not possible to link classes between projects by the means that you suggest.

As Seerex suggests, simply drag/drop the classes/files from one project to another, and make sure you choose the option to Copy the files to the project in the pop up window.

I hope this helps to answer your original question,
Nick
http://myfirstiphoneapp.co.uk
Last Edit: August 27, 2011, 12:40:46 AM by fujilla Logged
skronwith
Newbie
*
Posts: 17


Email




Reply #4 on: August 27, 2011, 10:13:52 AM

Nick,

What you say makes sense.  I did do an import into the second project and put in the full path to the first files and that seems to work but that doesn't help that hypothetical person buying the second app.  Could you please describe in a bit more detail how one drags and drops between projects.  When one project is open all I see in the left hand panel of Xcode is the files for that project.  I suppose I could open up two projects at once and do it that way.  Is that right?  Thanks.

Steve
Logged
fujilla
Global Moderator
Sr. Member
*****
Posts: 276


WWW




Reply #5 on: August 27, 2011, 10:57:02 AM

Yeah, you are right Steve:

Have two projects open
Make sure the project you wish to copy files from is on top, and that you can see the Navigator window (left hand panel) of both projects
Select the file(s)/class(es) you wish to copy from the top project
Drag them onto the project that is behind (you will get a + symbol in a green circle)
When you let got of the mouse button a window will appear, and make sure you choose the Copy option

I have attached a couple of screenshots which will hopefully make this clearer.
Nick

Logged
skronwith
Newbie
*
Posts: 17


Email




Reply #6 on: August 27, 2011, 01:43:00 PM

Nick -

Thanks very much.

Steve
Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.