UIImageNamed: Problems??

Jul 17 2009 Published by Prakash under Programming, iPhone Development Tips

I just bumped in to this blog post imagenamed is evil.

Actually i have been using imageNamed a lot but have’nt noticed any problem. Maybe i’ll face it if i try to load an image of couple of meg size?

anyway, for loading remote images i do use caching technique similar to the one described in that blog post. I will try to cache local images as well and publish the code soon..

No responses yet

iProgrammer Tip#7: springboard failed to launch application with error 7

Jun 22 2009 Published by Prakash under Tips, iPhone Development Tips

Today i had another  weird moment with xCode/iPhone Simulator.

I had couple of projects open for a while and switched to one of those and wanted to test on the Simulator,
but xcode was reporting

Error launching simulated application: SpringBoard failed to launch application with error: 7

The Console log was showing like:

Xcode[27865] Error launching simulated application: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 UserInfo=0x3fc3d80 "SpringBoard failed to launch application with error: 7"

When i switched the Active configuration to release, it was launching the app in simulator as usual. But Debug configuration seemed to have some issue. For next 10 minutes or so i was comparing the differences in Build settings/Target settings etc, nothing seems to be the problem.

Looking more attentively at Console logs shown the following lines were repeating everytime xcode fails to launch..

6/30/09 10:47:41 AM com.apple.launchd[55426] (com.apple.iPhoneSimulator:com.apple.installd[27624]) Exited: Terminated
6/30/09 10:47:41 AM com.apple.launchd[55426] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Unknown key for integer: JetsamPriority
6/30/09 10:47:41 AM com.apple.launchd[55426] (com.apple.iPhoneSimulator:com.apple.apsd) Path monitoring failed on “/var/mobile/Library/Preferences”: No such file or directory
6/30/09 10:47:41 AM com.apple.launchd[55426] (com.apple.iPhoneSimulator:com.apple.installd[27624]) Exited: Terminated
6/30/09 10:47:41 AM com.apple.launchd[55426] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Unknown key for integer: JetsamPriority
6/30/09 10:47:41 AM com.apple.launchd[55426] (com.apple.iPhoneSimulator:com.apple.apsd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory

When i googled, found there are quite close but the same trouble has been faced by many fellow xcoders.

  • Multiple Targets in Xcode: "Failed to launch simulated application: unknown error
  • iPhone: Failed to launch simulated application: unknown error
  • XCode error: failed to launch simulated application
  • and finally

    iPhone Simulator: SpringBoard failed to launch application with error no 7

    What worked for me finally:

    Reset Content and Settings didnt work either but Quitting the simulator and re-launching did it.

    I almost felt abused as i expected a complex solution to fix :)

    anyway, back to happy xCoding!!

    No responses yet

    iProgrammer Tip #6: “Weak linking” additional libraries

    Jun 20 2009 Published by Prakash under Apple, Tips, iPhone Development Tips

    Sure, first time when i learnt about frameworks,  i was really excited!  What interested me most was, a framework can be marked as “Weak” so that applications can still work using new features in new framework and when using old version of the framework,can ignore some functionality. But as much as i was excited, i didn’t know how to mark a framework as “Weak”.

    for instance, I was trying to support Compose Mail from within my application and while going through instructions below:

    3. Make MessageUI a weak framework (set its role to Weak)
    An application will fail to launch or proceed if it attempts to load a
    framework on devices where this framework is absent.
    With weak linking, an application does not fail, but proceeds when a symbol or
    framework is not present at runtime. All weak-linked symbols are set to NULL on
    devices without them.
    
    To designate MessageUI as weak-linked, select the target's Link Binary With
    Libraries build phase, then change MessageUI's role from Required to Weak in the
    detail view.

    Sounds simple, but for some reason i couldn’t figure out immediately how to do that. Maybe its common knowledge?

    But for those who dont know this, here’s a tip to get this done:

    To add new framework:

    1. select the Target and select the application name and pull down (either -> arrow or click on that arrow symbol)
    2. select Link Binary With Libraries
    3. Right click and select Add
    4. Choose Existing frameworks
      • Add framework
    5. Then click on the + in the next screen
      • Add
    6. Depends on your target SDK, you will get the option to choose the additional frameworks. For 3.0 it looks like below
      • list..
    7. After adding the framework, you can select the “Type” on the right and change to “Weak”
      • Picture 9

    Then Build as usual.

    Important to note:

    Check for the existence of APIs before calling them

    and

     Provide a workaround for non-existent APIs

    No responses yet

    iProgrammer Tip #2: Get around “Device could not support development..” error in Organizer

    May 31 2009 Published by Prakash under iPhone Development Tips

    All of a sudden the Organizer stated that my development device “could not support development”.

    Restarting XCode couple of times didnt help!

    Worked workaround: Reset the device and also restart xcode to be on safe side and everything would be back to normal!

    Apparently this seems to me a bug in xcode with some corrupted data in device maybe.

    No responses yet

    iProgrammer Tip #1: correcting __MyCompanyName__ in XCode Projects..

    May 30 2009 Published by Prakash under iPhone Development Tips

    When you choose XCode to generate the skeleton code, it places the header with your name and company name. Apparently there is no visible settings within xcode to set company name. Here’s one way to fix that.

    1. Open Terminal
    2. type
    defaults write com.apple.xcode PBXCustomTemplateMacroDefinitions '{ ORGANIZATIONNAME = "My Great Company Name"; }'

    Thats it!!

    No responses yet