My App craches after launching

Discussion in 'iOS Development' started by Untitled, Apr 2, 2009.

  1. Untitled

    Untitled New Member

    Joined:
    Apr 1, 2009
    Messages:
    4
    Likes Received:
    0
    Hi
    I am a beginner in Iphone programming.

    I am trying to make a very simple application to start (found in this site, but the Makefile. thx a lot), but it fails.

    Here are my Code :
    Code:
    $ ls -l MyApp/
    total 32
    -rw-r--r--   1 david  david   627 Apr  2 11:52 Makefile
    drwxr-xr-x   4 david  david   136 Apr  2 11:12 MyApp.app
    -rw-r--r--   1 david  david   441 Apr  2 12:00 MyApp.h
    -rw-r--r--   1 david  david  1008 Apr  2 12:00 MyApp.m
    -rw-r--r--   1 david  david   463 Apr  2 11:53 main.m
    
    Code:
    $ ls -l MyApp/MyApp.app
    total 24
    -rw-r--r--   1 david  david   612 Apr  2 11:54 Info.plist
    -rw-r--r--   1 david  david  4420 Mar 28 17:06 icon.png
    
    main.m
    Code:
    /* Import the UIKit header and our app header, so the app can tell its a UIApplication */
    
    #import <UIKit/UIKit.h>
    #import "MyApp.h"
    
    /* This tells that when launched the app goes the the application's main function */
    
    int main(int argc, char *argv[])
    {
    	NSAutoreleasePool* pool = [ [ NSAutoreleasePool alloc ] init ];
    	int AppReturn;
    	AppReturn = UIApplicationMain( argc, argv, @"WindowApp", @"WindowApp" );
    	return AppReturn;
    	[ pool release ];
    }
    
    MyApp.h
    Code:
    /* Import our headers */
    
    #import <Foundation/Foundation.h>
    #import <CoreFoundation/CoreFoundation.h>
    #import <UIKit/UIKit.h>
    #import <UIKit/UIHardware.h>
    #import <UIKit/UIWindow.h>
    #import <UIKit/UIView.h>
    
    /* Define what objects and selectors will be in the application  class */
    
    @interface WindowApp : UIApplication
    {
    	UIWindow* window;
    	UIView* mainView;
    	CGRect rect;
    }
    
    /* Always end the class with @end */
    
    @end
    
    
    MyApp.m
    Code:
    /* Import our app header we created */
    
    #import "MyApp.h" // we can use "quotes" to import this header, as it's in the same directory
    
    /* Create our implementation of the app class */
    
    @implementation WindowApp
    
    /* This is what happens when the application is launched */
    
    - (void)applicationDidFinishLaunching:(id)unused
    {
    	/* Create our rectangle, the size of the screen */
    	
    	rect = [ UIHardware fullScreenApplicationContentRect ];
    	
    	/* Make sure the rectangle is aligned correctly */
    	
    	rect.origin.x = 0.0f;
    	rect.origin.y = 0.0f;
    	
    	/* Create our window */
    	
    	window = [ [ UIWindow alloc ] initWithContentRect: rect ]; // This made it the size of our full screen rectangle
    	[ window makeKeyAndVisible ]; // Set up the window
    	
    	/* Create our View, which all our content can be later displayed upon */
    	
    	mainView = [ [ UIView alloc ] initWithFrame: rect ];
    	
    	/* Set the windows content view to our view we just created */
    	
    	[ window setContentView: mainView ];
    	
    }
    
    /* Again, end with @end */
    
    @end
    
    Makefile
    Code:
    CC=arm-apple-darwin9-gcc
    LD=$(CC)
    LDFLAGS= 	-lobjc \
    			-multiply_defined suppress \
    			-framework UIKit \
    			-framework Foundation \
    			-framework CoreFoundation \
    			-framework CoreGraphics \
    			-L"/usr/lib" \
    			-F"/System/Library/Frameworks" \
    			-F"/System/Library/PrivateFrameworks" \
    			-bind_at_load
    
    CFLAGS=-I/var/include
    
    App= MyApp
    
    all: $(App)
    
    $(App): main.o MyApp.o
    	$(LD) $(LDFLAGS) -o $@ $^
    	ldid -S $(App)
    
    
    %.o: %.m
    	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
    
    clean:
    	rm -f *.o $(App)
    	rm -f ./MyApp.app/MyApp
    	rm -rf /Applications/MyApp.app
    
    package:
    	cp MyApp ./MyApp.app/MyApp
    	cp -r MyApp.app /Applications/
    
    Info.plist
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
     "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>CFBundleDevelopmentRegion</key>
            <string>English</string>
            <key>CFBundleExecutable</key>
            <string>MyExample</string>
            <key>CFBundleIdentifier</key>
            <string>__identifier__MyApp</string>
            <key>CFBundleInfoDictionaryVersion</key>
            <string>6.0</string>
            <key>CFBundlePackageType</key>
            <string>APPL</string>
            <key>CFBundleSignature</key>
            <string>????</string>
            <key>CFBundleVersion</key>
            <string>1.0</string>
    </dict>
    </plist>
    
    Then, I compile in my Iphone :
    Code:
    scp -r MyApp root@iphone:/my/path
    ssh root@iphone
    cd /my/path/
    make
    make package
    
    And I go to my Iphone, BossPrefs -> fast respring.
    The Icon appears, but when I launch it, it craches 2 seconds after.

    Where is the problem ?
    Thx a lot
  2. dragoy

    dragoy New Member

    Joined:
    Feb 7, 2009
    Messages:
    21
    Likes Received:
    0
    Device:
    2G iPod touch
    Did you signed it and/or put the folder's permission to 775 or 777 ?
  3. Untitled

    Untitled New Member

    Joined:
    Apr 1, 2009
    Messages:
    4
    Likes Received:
    0
    Not exactly, but I had the right to execute :
    Code:
    $ cd /Applications/MyApp.app
    $ ls -l
    -rw-r--r-- 1 root wheel   612 Apr  2 18:09 Info.plist
    -rwxr-xr-x 1 root wheel 14128 Apr  2 18:09 MyApp*
    -rw-r--r-- 1 root wheel  4420 Apr  2 18:09 icon.png
    
    I tried with "chmod 777 MyApp", but it crashes anyway.
    Same with the whole folder's permission to 777.

    I have also try "ldid -S MyApp".
    And finaly, I have change the identifier from /Application/MyApp/Info.plist and "ldid" again. Nothing happens.
  4. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Open cydia and install syslodg and reboot your phone. Next, run your app and let it crash. Once it does, open /var/log/syslog and search for your app. When you find it, post the error in this thread.
  5. Untitled

    Untitled New Member

    Joined:
    Apr 1, 2009
    Messages:
    4
    Likes Received:
    0
    Ok, thx, the problem is very simple :
    Code:
    Apr  2 18:58:08 Iphone-David SpringBoard[25]: The __identifier__MyApp1 bundle at /Applications/MyApp.app does not have an executable path. Please check the bundle's Info.plist file.
    Apr  2 18:58:08 Iphone-David SpringBoard[25]: Couldn't activate <SBApplication: 0x49a990> __identifier__MyApp1 activate: animated  deactivate:
    Apr  2 18:58:08 Iphone-David SpringBoard[25]: Error getting job dictionary for label UIKitApplication:__identifier__MyApp1[0xf8a]. Error: No such process
    Apr  2 18:58:08 Iphone-David SpringBoard[25]: Unable to delete job with label UIKitApplication:__identifier__MyApp1[0xf8a]. Error: No such process
    
    What is an executable identifier ?
    Thx a lot
  6. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    Either you don't have an executable, or you haven't said in the Info.plist what your executable is called.
  7. Untitled

    Untitled New Member

    Joined:
    Apr 1, 2009
    Messages:
    4
    Likes Received:
    0
    You were rigth, I forgot to change the <key>CFBundleExecutable</key>.
    Now it works.

    Thanks a lot
  8. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S

Share This Page