iPhone Development Thread

Posted:
in iPhone edited January 2014
Post your iPhone Apps [screenshots] here! Source code should be at Google code or something? If you'd like to share.



My take on Hello World. Inspired by www.theleetworld.com



Comments

  • Reply 1 of 17
    fuzz_ballfuzz_ball Posts: 390member
    Have you got your app to run on your device? I can run in the simulator, but every time I try to change the SDK target, I get an error from XCode telling me "No device is connected". When I look in the Organizer, my iPhone is listed, but I can't add any apps (using bottom pane). So do I simply have something setup incorrectly?
  • Reply 2 of 17
    mydomydo Posts: 1,888member
    If I develop and app for me and my coworkers to use do I have to distribute through iTunes? Sorry if this is off topic.
  • Reply 3 of 17
    lundylundy Posts: 4,466member
    I'm glad you started this thread. I spent the weekend trying to port my Jumble Helper Cocoa app to the iPhone SDK - it ALMOST works. You can see from the screenshots that it accepts input, and changes the input to all caps. All the Cocoa code is ported over, very easy to just change the way it gets the input.



    But I have one part that I am stuck on. I have two instance methods, both of the same class (the app only has one class in it), and one instance method loads the dictionary from the bundle. That works.



    Then when the other method (that is invoked by the "Unscramble" button) executes, it has a null pointer to the dictionary instance variable that the first method loaded. I thought all instance variables of the same class were available to all instance methods of that class. This one has me stumped for 18 hours now.



    In the desktop version it was not a problem - I loaded the dictionary in the "Awake from Nib" handler and then it was visible to the "Solve:" method that was triggered by End Editing of the text field on the app's window.



    Also, I found that Xcode's debugger, when using the iPhone SDK, would not display the values of the variables - under the "Summary" column, so I was forced to use NSLog() statements and that showed that the pointer to the dictionary became nil in the second method (the one triggered by the "Unscramble" button).
    image
    image
    image
  • Reply 4 of 17
    physguyphysguy Posts: 915member
    Quote:
    Originally Posted by lundy View Post


    I'm glad you started this thread. I spent the weekend trying to port my Jumble Helper Cocoa app to the iPhone SDK - it ALMOST works. You can see from the screenshots that it accepts input, and changes the input to all caps. All the Cocoa code is ported over, very easy to just change the way it gets the input.



    But I have one part that I am stuck on. I have two instance methods, both of the same class (the app only has one class in it), and one instance method loads the dictionary from the bundle. That works.



    Then when the other method (that is invoked by the "Unscramble" button) executes, it has a null pointer to the dictionary instance variable that the first method loaded. I thought all instance variables of the same class were available to all instance methods of that class. This one has me stumped for 18 hours now.




    The instance variables exist for each member of a class but a distinct for each member. Only methods are shared. From Apples Objective C overview.



    "All instances of a class have the same set of methods, and they all have a set of instance variables cut

    from the same mold. Each object gets its own instance variables, but the methods are shared.

    "



    You'll have to specify the instance variable of the particular object your trying to get at.



    Quote:
    Originally Posted by lundy View Post


    In the desktop version it was not a problem - I loaded the dictionary in the "Awake from Nib" handler and then it was visible to the "Solve:" method that was triggered by End Editing of the text field on the app's window.



    Also, I found that Xcode's debugger, when using the iPhone SDK, would not display the values of the variables - under the "Summary" column, so I was forced to use NSLog() statements and that showed that the pointer to the dictionary became nil in the second method (the one triggered by the "Unscramble" button).



  • Reply 5 of 17
    How long do you have to wait to get a developer certificate - I tried to sign-up an pay my $99 on Sunday, but the site said basically - "we will get back to you"?
  • Reply 6 of 17
    lundylundy Posts: 4,466member
    Quote:
    Originally Posted by physguy View Post


    The instance variables exist for each member of a class but a distinct for each member. Only methods are shared. From Apples Objective C overview.



    "All instances of a class have the same set of methods, and they all have a set of instance variables cut

    from the same mold. Each object gets its own instance variables, but the methods are shared.

    "



    You'll have to specify the instance variable of the particular object your trying to get at.



    Thanks for the reply. This is really simple so let me outline the methods and I hope you can tell me what the problem is.



    I am using the "Hello World" example as a template. The main() function calls UIApplicationMain() with the delegate @"HelloWorldClassicAppDelegate";. This is similar to a Cocoa app where main() calls NSApplicationMain() which stays running until the app is quit.



    In the delegate "HelloWorldClassicAppDelegate" class (the only class in the project), there are only 3 instance methods:



    - (void)addControlsToContentViewUIImageView *)aContentView;



    Uses the UIKit's window, button, etc. API to construct the size and properties of the elements (text field, button).



    - (void)solveid)sender;



    This one I added - it is triggered by the "Unscramble" button. The triggering works fine, but in its code it does not know about the dictionary (see next method below).



    - (void)applicationDidFinishLaunchingUIApplication *)application;



    This one is where the app initializes everything - it is invoked by the OS and is one of the hooks into the launch process. This is where I added my code to read the dictionary (a plist) into the "jumbleDictionary" NSDictionary instance variable. The reading works fine - my problem is that the above method "Solve:", when I reference the jumbleDIctionary, gets a null pointer.





    Summary:



    1. Instance method "ApplicationWillFinishLaunching" allocs and inits an NSDictionary instance variable "jumbleDictionary" from a plist in the app's bundle. This works.



    2. When the button is clicked (tapped), the instance method "Solve:" of the same class is invoked and when it tries to reference the above jumbleDictionary, it gets a null pointer.



    Any ideas?
  • Reply 7 of 17
    physguyphysguy Posts: 915member
    Quote:
    Originally Posted by lundy View Post


    Thanks for the reply. This is really simple so let me outline the methods and I hope you can tell me what the problem is.



    I am using the "Hello World" example as a template. The main() function calls UIApplicationMain() with the delegate @"HelloWorldClassicAppDelegate";. This is similar to a Cocoa app where main() calls NSApplicationMain() which stays running until the app is quit.



    In the delegate "HelloWorldClassicAppDelegate" class (the only class in the project), there are only 3 instance methods:



    - (void)addControlsToContentViewUIImageView *)aContentView;



    Uses the UIKit's window, button, etc. API to construct the size and properties of the elements (text field, button).



    - (void)solveid)sender;



    This one I added - it is triggered by the "Unscramble" button. The triggering works fine, but in its code it does not know about the dictionary (see next method below).



    - (void)applicationDidFinishLaunchingUIApplication *)application;



    This one is where the app initializes everything - it is invoked by the OS and is one of the hooks into the launch process. This is where I added my code to read the dictionary (a plist) into the "jumbleDictionary" NSDictionary instance variable. The reading works fine - my problem is that the above method "Solve:", when I reference the jumbleDIctionary, gets a null pointer.





    Summary:



    1. Instance method "ApplicationWillFinishLaunching" allocs and inits an NSDictionary instance variable "jumbleDictionary" from a plist in the app's bundle. This works.



    2. When the button is clicked (tapped), the instance method "Solve:" of the same class is invoked and when it tries to reference the above jumbleDictionary, it gets a null pointer.



    Any ideas?



    Sorry, I mis-read your original post. I thought you said instances but you said instance methods which I then believe you are correct. Do you have only 1 instance of your HelloWorldClassicAppDelegate class?
  • Reply 8 of 17
    FYI - Last night I found a Google Group for iPhone app development. So far there are like only 7 people, but if we all take our conversations there we can help it grow. In the process we'll probably get more answers to our questions.



    http://groups.google.com/group/iphoneappdev



    PS - If anyone knows of a different discussion group dedicated to iPhone native-app dev, please post in this thread so we can all benefit.
  • Reply 9 of 17
    dfilerdfiler Posts: 3,420member
    Quote:
    Originally Posted by fuzz_ball View Post


    PS - If anyone knows of a different discussion group dedicated to iPhone native-app dev, please post in this thread so we can all benefit.



    How about the official apple ones ... lists.apple.com
  • Reply 10 of 17
    akacakac Posts: 510member
    Quote:
    Originally Posted by mydo View Post


    If I develop and app for me and my coworkers to use do I have to distribute through iTunes? Sorry if this is off topic.



    Yes. Either using the retail program or private enterprise program.
  • Reply 11 of 17
    akacakac Posts: 510member
    Quote:
    Originally Posted by fuzz_ball View Post


    Have you got your app to run on your device? I can run in the simulator, but every time I try to change the SDK target, I get an error from XCode telling me "No device is connected". When I look in the Organizer, my iPhone is listed, but I can't add any apps (using bottom pane). So do I simply have something setup incorrectly?



    You can't because your iPhone is not running iPhone OS 2.0.
  • Reply 12 of 17
    akacakac Posts: 510member
    Quote:
    Originally Posted by dfiler View Post


    How about the official apple ones ... lists.apple.com



    As much as I agree and think its stupid:



    Quote:

    Date: Thu, 6 Mar 2008 16:35:34 -0800

    From: Scott Anguish

    Subject: [moderator] Re: Presumably iphone does Objective-C 2.0?

    Cc: [email protected]



    Folks,



    Please remember that this is not public information. Even the

    documentation requires an NDA and login to get access.



    Succinctly, the iPhone can't be discussed here.



    WWDR does have more information forthcoming.



    and



    Quote:

    The SDK is subject to NDA, so you should not discuss it in public.



    mmalc



    and



    Quote:

    iPhone 2.0 SDK is entirely covered by NDA, including the

    documentation. All of it requires login to access it at the iPhone

    Dev Center.



    Items specifically discussed in the announcement are public. But even

    still, they're not appropriate for discussion on this list.



    Please stay tuned for more details.



    Comments, complaints, etc to [email protected]



    Thanks for you cooperation.




  • Reply 13 of 17
    dfilerdfiler Posts: 3,420member
    Hmmm, looks like they haven't got around to updating their website. At least that's what I hope is going on.



    Now that the SDK is public, I'd assume that the NDA would be lifted.



    Edit: Wait, I just re-realized that it's still a beta release. Please disregard the above.
  • Reply 14 of 17
    i was going to design my own app.. but ic ouldn't find the iPhone simulator
  • Reply 15 of 17
    mydomydo Posts: 1,888member
    Quote:
    Originally Posted by Akac View Post


    Yes. Either using the retail program or private enterprise program.



    Naw that can't be. So anything I want to develop and give to any other person can only go through iTunes and is available to everyone publicly? That can't be.
  • Reply 16 of 17
    lundylundy Posts: 4,466member
    Well, I've got my Jumble Helper app ported to the iPhone 2.0 OS. Still looks messy, as Apple's documentation is too general and doesn't tell you how to do things like change the appearance of a list.



    But it works. I had to start over from scratch and it was an issue with (d'oh) not properly instantiating the dictionary class.



    Click thumbnails for bigger images.



    I don't remember signing any NDA so I don't know where this idea came from. All my colleagues could download the SDK and the documentation without pay or paid membership.
    image
    image
  • Reply 17 of 17
    physguyphysguy Posts: 915member
    Quote:
    Originally Posted by lundy View Post


    Well, I've got my Jumble Helper app ported to the iPhone 2.0 OS. Still looks messy, as Apple's documentation is too general and doesn't tell you how to do things like change the appearance of a list.



    But it works. I had to start over from scratch and it was an issue with (d'oh) not properly instantiating the dictionary class.



    Click thumbnails for bigger images.



    I don't remember signing any NDA so I don't know where this idea came from. All my colleagues could download the SDK and the documentation without pay or paid membership.



    Nice work on the app. Re NDA you should read the iPhone SDK agreement you 'signed' via clickthrough when you downloaded the SDK. It has some interest/confusing language such as the terms of the agreement is itself are confidential, which I guess I'm violating by stating as its somewhat reentrant and since you need to be able to tell someone that its terms are confidential as part of reasonable response, its somewhat non-sensical.
Sign In or Register to comment.