2009-11-13 139 views
-1

我需要開發一個應用程序,需要調用另一個應用程序,它位於本地主機中。我已經在stackoverflow中發佈了相同的問題,它根據它。但我沒有得到在iPhone simulator.Guide的輸出中我的編碼是什麼錯誤,使得看上去在調試時從調試Objective-C編程從另一個應用程序調用應用程序

塊引用

錯誤:無法勞克模擬應用:iPhone Simulator未能安裝該應用程序。

#import "ModuleManagerAppDelegate.h" 
@implementation ModuleManagerAppDelegate 
@synthesize window; 

- (void)applicationDidFinishLaunching:(UIApplication *)application { 
NSURL *myURL = [NSURL URLWithString:@"backgroundcolor:backgroundcolor"]; 
[[UIApplication sharedApplication] openURL:myURL]; 
[window makeKeyAndVisible]; 
[myURL release]; 
} 
- (void)dealloc 
{  
[window release]; 
    [super dealloc]; 
} 

@end 

這是調用應用程序和我打電話的BACKGROUNDCOLOR作爲被叫application.I也於info.plist.This註冊BACKGROUNDCOLOR是我的info.plist

<?xml version="1.0" encoding="UTF-8"?> 
    <!DOCTYPE plist PUBLIC "-//Apple//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>CFBundleDisplayName</key> 
    <string>${PRODUCT_NAME}</string> 
    <key>CFBundleIconFile</key> 
    <string></string> 
    <key>CFBundleIdentifier</key> 
    <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string> 
    <key>CFBundleInfoDictionaryVersion</key> 
    <string>6.0</string> 
    <key>CFBundleName</key> 
    <string>${PRODUCT_NAME}</string> 
    <key>CFBundlePackageType</key> 
    <string>APPL</string> 
    <key>CFBundleSignature</key> 
    <string>????</string> 
    <key>CFBundleVersion</key> 
    <string>1.0</string> 
    <key>LSRequiresIPhoneOS</key> 
    <true/> 
    <key>NSMainNibFile</key> 
    <string>MainWindow</string> 
    <key>CFBundleURLTypes</key> 
    <array> 
     <dict> 
     <key>CFBundleURLName</key> 
     <string>com.xxx.backgroundcolor.xcodeproj</string> 
     <key>CFBundleURLSchemes</key> 
     <array> 
     <string>backgroundcolor.xcodeproj</string> 
     </array> 
     </dict> 
    </array> 
    </dict> 
    </plist> 

這是我的稱爲應用(BackgroundColor.m)

#import "BackgroundColorAppDelegate.h" 

@implementation BackgroundColorAppDelegate 

@synthesize window; 
@synthesize Orange,Green,Yellow,Blue,Red; 


- (void)applicationDidFinishLaunching:(UIApplication *)application {  

    // Override point for customization after application launch 
    [window makeKeyAndVisible]; 

} 
-(BOOL)application:(UIApplication *) application handleOpenURL:(NSURL *)url 
{ 
if([[url scheme] isEqualToString:@"backgroundcolor"]) 
{ 
-(IBAction)doOrange 
{ 
window.backgroundColor=[UIColor orangeColor]; 
} 
-(IBAction)doBlue 
{ 
window.backgroundColor=[UIColor blueColor]; 
} 
-(IBAction)doGreen 
{ 
window.backgroundColor=[UIColor greenColor]; 
} 
-(IBAction)doRed 
{ 
window.backgroundColor=[UIColor redColor]; 
} 
-(IBAction)doYellow 
{ 
window.backgroundColor=[UIColor yellowColor]; 
} 

}

- (void)dealloc { 
    [window release]; 
    [super dealloc]; 
} 


@end 

回答

0

首先要嘗試的是擺脫URL方案中的要點。使用backgroundcolor而不是backgroundcolor.xcodeproj

+0

感謝您的回覆。請也回答我的問題..請幫助我...... – suse 2009-11-17 08:35:02

1

BackgroundColor應用程序的代碼有問題。你已經在另一個方法實現(-application:handleOpenURL :)中包裝了一系列方法實現(-doOrange,-doBlue等)。編譯器應該給你關於這個的錯誤。您需要將這些方法實現移出其他方法,並使用switch語句來調用方法。現在,這段代碼是荒謬的。

相關問題