2009-11-13 106 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语句来调用方法。现在,这段代码是荒谬的。

相关问题