2016-04-27 11 views
-3
// 
// AppDelegate.m 
// 

#import "AppDelegate.h" 
#import "MainViewController.h" 
#import "SetupViewController.h" 

#import <Cordova/CDVPlugin.h> 

#import "NSObject+Utils.h" 
#import "WebProjectSetupHelper.h" 
#import "WebProjectSetupHelperDelegate.h" 
#import "LoadingView.h" 

#import "AppDelegate.h" 
#import "MainViewController.h" 
#import "NSObject+Utils.h" 

#import "DeviceModelInfo.h" 
#import "UIDevice+System.h" 
#import "Alert.h" 

@interface AppDelegate() <WebProjectSetupHelperDelegate> 


@property (nonatomic, strong) WebProjectSetupHelper *helper; 
@property (nonatomic, strong) LoadingView *loadingView; 

@end 

@implementation AppDelegate 



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

    [self createItemsWithIcons]; 

    // determine whether we've launched from a shortcut item or not 
    UIApplicationShortcutItem *item = [launchOptions valueForKey:UIApplicationLaunchOptionsShortcutItemKey]; 
    if (item) { 
     NSLog(@"We've launched from shortcut item: %@", item.localizedTitle); 
    } else { 
     NSLog(@"We've launched properly."); 
    } 

    return YES; 
} 
私は私のアプリの委任ではなく、含まれている行にこのコードを使用しています

「[自己createItemsWithIcons];」、私は「『AppDelegate』の目に見える@interfaceは 『createItemsWithIcons』セレクタを宣言していません」というエラーを取得します。「App Delegate '...の表示されない@interfaceは何を意味しますか?

私が間違っていることは何ですか?私は、私のアプリに3Dタッチのクイックアクションを追加しようとしています。


更新!私はその問題を解決しました。今度は私のAppDelegateからの質問ですが、別のファイルにあるコードをどのように実行できますか? "www"フォルダには.jsで終わるファイルがあります。そのファイルには、実行したいjavascriptコードがあります。そのファイルを呼び出す方法に関するアイデア?

+1

'createItemsWithIcons'方法はどこにありますか? – rmaddy

答えて

0

createItemsWithIconsメソッドの実装を追加していません。あなたは、3Dタッチサンプルを使用している場合

https://github.com/versluis/3D-Touch/blob/master/3D%20Touch/AppDelegate.m

、その後、AppDelegateにこのコードを追加します。

- (void)createItemsWithIcons { 

    // create some system icons (doesn't work) 
// UIApplicationShortcutIcon *loveIcon = [UIApplicationShortcutIcon iconWithType:UIApplicationShortcutIconTypeLove]; 
// UIApplicationShortcutIcon *mailIcon = [UIApplicationShortcutIcon iconWithType:UIApplicationShortcutIconTypeMail]; 
// UIApplicationShortcutIcon *prohibitIcon = [UIApplicationShortcutIcon iconWithType:UIApplicationShortcutIconTypeProhibit]; 

    // icons with my own images 
    UIApplicationShortcutIcon *icon1 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"iCon1"]; 
    UIApplicationShortcutIcon *icon2 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"iCon2"]; 
    UIApplicationShortcutIcon *icon3 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"iCon3"]; 

    // create several (dynamic) shortcut items 
    UIMutableApplicationShortcutItem *item1 = [[UIMutableApplicationShortcutItem alloc]initWithType:@"com.test.dynamic" localizedTitle:@"Dynamic Shortcut" localizedSubtitle:@"available after first launch" icon:icon1 userInfo:nil]; 
    UIMutableApplicationShortcutItem *item2 = [[UIMutableApplicationShortcutItem alloc]initWithType:@"com.test.deep1" localizedTitle:@"Deep Link 1" localizedSubtitle:@"Launch Nav Controller" icon:icon2 userInfo:nil]; 
    UIMutableApplicationShortcutItem *item3 = [[UIMutableApplicationShortcutItem alloc]initWithType:@"com.test.deep2" localizedTitle:@"Deep Link 2" localizedSubtitle:@"Launch 2nd Level" icon:icon3 userInfo:nil]; 

    // add all items to an array 
    NSArray *items = @[item1, item2, item3]; 

    // add this array to the potentially existing static UIApplicationShortcutItems 
    NSArray *existingItems = [UIApplication sharedApplication].shortcutItems; 
    NSArray *updatedItems = [existingItems arrayByAddingObjectsFromArray:items]; 
    [UIApplication sharedApplication].shortcutItems = updatedItems; 

} 
+0

すみませんが、どうすればいいですか? –

+0

AppDelegate.mファイル内にコードスニペットをコピーして貼り付けます。 –

+0

ありがとうございます。その後、より多くの問題が発生しました。私は自分の画像を使用していないし、静的なボタンしか持っていない。だから私が必要とするのは、コードの最後のグループと最初の行です。他のすべてをコメントアウトすると、コードの最後のグループの2行目がエラーになります。 –