Beginning iPhone Programming Question

Discussion in 'iOS Programming' started by TechnoEagle, Feb 2, 2010.

  1. TechnoEagle macrumors newbie

    Jan 30, 2010
    I have just started trying to learn how to develop iPhone/iPad apps. I have been using the Stanford lecture videos on iTunes U, and have learned a lot so far. I did come across a problem while doing homework assignment 1B. I can't seem to figure out how to get it to work. Has anyone either watched these videos, or just knows a lot about Objective-C? If someone could post the code for the assignment so that I can figure out what I was doing wrong, that would be great! The homework assignment can be found at As I said before, it is assignment 1B that I cannot figure out.
    Thanks in advance! :D
  2. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    Exactly what can't you figure out about this assignment?
  3. TechnoEagle thread starter macrumors newbie

    Jan 30, 2010
    Here is my code for the implementation file:

    #import <Foundation/Foundation.h>
    void PrintPathInfo()
    	NSString *path=[@"~" stringByExpandingTildeInPath];
    void PrintProcessInfo()
    	NSString *infoAboutProcess=@"Process Name: ";
    	infoAboutProcess=[infoAboutProcess stringByAppendingFormat:[[NSProcessInfo processInfo] processName]];
    	infoAboutProcess=[infoAboutProcess stringByAppendingFormat:@" Process ID: "];
    	infoAboutProcess=[infoAboutProcess stringByAppendingFormat:[NSProcessInfo processInfo]];
    void PrintBookmarkInfo()
    void PrintIntrospectionInfo()
    int main (int argc, const char * argv[]) {
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    	[pool release];
        return 0;
    For the PrintPathInfo() method, I cannot figure out how to separate each part of the path directory onto a separate line. For the PrintProcessInfo(), I keep getting weird errors and cannot figure out what to do. I haven't even started to work on the PrintBookmarkInfo() and PrintIntrospectionInfo() yet, because I want to get the first two methods working, first.
  4. FarSeide macrumors 6502a


    Feb 17, 2008
    Earth Lane
    NSArray *pathComponents = [[NSArray alloc] init];
    pathComponents = [path pathComponents];

    for (NSString *pathComp in pathComponents)
    NSLog(@"%@", pathComp);

    [pathComponents release];

Share This Page