Making a "background" application

Discussion in 'iOS Development' started by ipodtouchmaster05, Jun 28, 2008.

  1. ipodtouchmaster05

    ipodtouchmaster05 Well-Known Member

    Joined:
    Sep 30, 2007
    Messages:
    1,787
    Likes Received:
    41
    Device:
    iPhone 5 (Black)
    Ok so my idea is to make an application that lets you choose to restart, respring, or set language by pressing the status bar at anytime. Now to do this I am using a LaunchDaemon to execute a background application (which means that nothing show up on springboard and you can do other stuff well it "runs") and im having that app detect for whenever you touch the status bar. Now my problem is this part of the application, so here is the code i have for it and what happens is when i put the "application" in the correct path and i set permissions and reboot my ipod then a black screen appears after the apple goes away and it stays like that. So any help would be great.

    I know a lot of the code in the .m (below) isnt neccessary but im trying to get it right by trying a few different things at once. Any bit of help would be nice.

    Code:
    #import "App.h"
    
    @implementation TouchView
    
    - (id)initWithFrame:(CGRect)rect
    {
    	if((self == [ super initWithFrame: rect ]) != nil)
    		{
    			
    		}
    	return self;
    }
    
    - (void)mouseDown:(struct __GSEvent*)event
    {
    	UIAlertSheet* sheet = [ [ UIAlertSheet alloc ] init ];
    	[ sheet setTitle:@"Options" ];
    	[ sheet setBodyText:@"Please choose an option" ];
    	[ sheet addButtonWithTitle:@"Respring" ];
    	[ sheet setDelegate: self ];
    	[ sheet popupAlertAnimated:YES ];
    	
    	return [ super mouseDown: event ];
    }
    
    - (void)alertSheet:(UIAlertSheet*)sheet buttonClicked:(int)button
    {	
    	if(button == 1)
    		{
    			[ [ Jay alloc ] respring ];
    		}
    }
    
    @end
    
    
    
    @implementation TouchApp
    
    - (void)applicationDidFinishLaunching:(id)unused
    {
    	CGRect fullScreenRect = [ UIHardware fullScreenApplicationContentRect ];
    	fullScreenRect.origin.x = 0.0f;
    	fullScreenRect.origin.y = 0.0f;
    	
    	CGRect rect = CGRectMake(0.0f, 0.0f, fullScreenRect.size.width, 20.0f);
    
    	window = [ [ UIWindow alloc ] initWithContentRect: rect ];
    	[ window _setHidden: false ];
    	[ window makeKey: self ];
    	[ window orderFront: self ];
    	
    	tView = [ [ TouchView alloc ] initWithFrame: rect ];
    }
    
    - (void)statusBarMouseDown:(struct __GSEvent *)event
    {
    	UIAlertSheet* sheet = [ [ UIAlertSheet alloc ] init ];
    	[ sheet setTitle:@"Options" ];
    	[ sheet setBodyText:@"Please choose an option" ];
    	[ sheet addButtonWithTitle:@"Respring" ];
    	[ sheet setDelegate: self ];
    	[ sheet popupAlertAnimated:YES ];
    	
    	return [ super statusBarMouseDown: event ];
    }
    
    - (void)mouseDown:(struct __GSEvent*)event
    {
    	UIAlertSheet* sheet = [ [ UIAlertSheet alloc ] init ];
    	[ sheet setTitle:@"Options" ];
    	[ sheet setBodyText:@"Please choose an option" ];
    	[ sheet addButtonWithTitle:@"Respring" ];
    	[ sheet setDelegate: self ];
    	[ sheet popupAlertAnimated:YES ];
    	
    	return [ super mouseDown: event ];
    }
    
    - (void)alertSheet:(UIAlertSheet*)sheet buttonClicked:(int)button
    {	
    	if(button == 1)
    		{
    			[ [ Jay alloc ] respring ];
    		}
    }
    
    
    @end
    Code:
    #import "Jay.h"
    
    @interface TouchView : UIView
    {
    
    }
    
    - (void)mouseDown:(struct __GSEvent*)event;
    
    @end
    
    
    @interface TouchApp : UIApplication
    {
    	UIWindow* window;
    	TouchView* tView;
    }
    
    - (void)applicationDidFinishLaunching:(id)unused;
    
    @end
  2. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    u + Jay == me + credit =D


    lol when i get back from gabby's later, i'll mess around with this some more. I think i may know what's wrong.
  3. ipodtouchmaster05

    ipodtouchmaster05 Well-Known Member

    Joined:
    Sep 30, 2007
    Messages:
    1,787
    Likes Received:
    41
    Device:
    iPhone 5 (Black)
    bump bump bumpy bump
  4. eric_chaos

    eric_chaos Well-Known Member

    Joined:
    Nov 4, 2007
    Messages:
    3,746
    Likes Received:
    35
    Device:
    iPhone 4 (Black)
    Would this conflict with safari's feature where you tap the status bar and it scrolls all the way up? I use that too often.
  5. ipodtouchmaster05

    ipodtouchmaster05 Well-Known Member

    Joined:
    Sep 30, 2007
    Messages:
    1,787
    Likes Received:
    41
    Device:
    iPhone 5 (Black)
    hmmm im not sure havent tested that yet, but I need to get this to work first before I test it. and if it works ill add a feature to turn it off
  6. vieestchien

    vieestchien New Member

    Joined:
    May 7, 2008
    Messages:
    43
    Likes Received:
    1
    You get a black screen after rebooting because there were some errors with your "application" (a dylib I suppose?). You should log the error messages in a file instead of printing it to the console. That way you will be able to debug it easier.
  7. hyperforcegoku

    hyperforcegoku New Member

    Joined:
    Dec 22, 2007
    Messages:
    341
    Likes Received:
    5
    David get on aim. i know the problemo.
  8. ipodtouchmaster05

    ipodtouchmaster05 Well-Known Member

    Joined:
    Sep 30, 2007
    Messages:
    1,787
    Likes Received:
    41
    Device:
    iPhone 5 (Black)
    whats your aim?? please pm me what the problem is, thanks a ton!
  9. PAEz

    PAEz New Member

    Joined:
    Jan 29, 2008
    Messages:
    201
    Likes Received:
    10
    or maybe you could put the answer here so that everybody could benefit and learn?

Share This Page