2013-04-01 10 views
11

iCloudのドキュメントストレージを使用するOSXアプリケーションを作成しました。私は(ないライオンの)マウンテンライオンで開くたびに、iCloudのウィンドウには、それは次のようになります開きます:起動時に起きてからこれを防ぐ方法はOSX 10.8アプリの起動時にiCloudウィンドウが開かないようにする

enter image description here

ありますか?

更新:

1)I力がアプリを終了するとapplicationShouldOpenUntitledFile:は、それが開く次回、(はい、私は私の代理人に聞いていると確信している
2)と呼ばれる取得されていません。 、私はダイアログを取得しません。しかし、通常のQuitプロセスを経ると、それが表示されます。 (また、将来的にこの問題に遭遇する人々を助けるために、答えとして追加)

アップデート2:重複した質問から applicationShouldOpenUntitledFile:は働いていませんでした。たくさんの実験の後で、私はのキーと値をCFBundleDocumentTypes配列のInfo.plistから削除すると、ウィンドウが開かなくなったことを知りました。重複した質問にもその回答を追加しました。

+0

[この関連の質問はあなたのための答えを持っていますか?](http://stackoverflow.com/questions/13825228/icloud-enabled-stop-the-open-file-displaying-on-application-launch ?rq = 1) –

+0

いいえ - 症状は似ていますが、提案された解決策は機能しません。私のアプリで - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)送信者がシステムから呼び出されていません。 –

+0

あなた自身の質問に答えることをお勧めします。上記のアップデート2は本当に答えです。あなたはそれに答えることができ、この時点で、1日待ってからそれを受け入れることができます。 –

答えて

-1

applicationShouldOpenUntitledFile:iCloud enabled - Stop the open file displaying on application launch?は機能しませんでした。たくさんの実験の後に、私がNSDocumentClassのキーと値をInfo.plistCFBundleDocumentTypesの配列から削除すると、ウィンドウが開かなくなったことがわかりました。

+0

NSPersistentDocumentサブクラスのmakeWindowControllersを削除しても、まだ呼び出されません。 iCloudを無効にすると、そのウィンドウが非表示になり、makeWindowControllersが呼び出されます – coolcool1994

0

あなたのApp Delegateに以下のコードを入力すると、iCloudが新しいドキュメント画面をポップアップすることを回避できます。ハイシエラをテストしました。

-(void)applicationDidFinishLaunching:(NSNotification *)notification 
{ 
    // Schedule "Checking whether document exists." into next UI Loop. 
    // Because document is not restored yet. 
    // So we don't know what do we have to create new one. 
    // Opened document can be identified here. (double click document file) 
    NSInvocationOperation* op = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(openNewDocumentIfNeeded) object:nil]; 
    [[NSOperationQueue mainQueue] addOperation: op]; 
} 

-(void)openNewDocumentIfNeeded 
{ 
    NSUInteger documentCount = [[[NSDocumentController sharedDocumentController] documents]count]; 

    // Open an untitled document what if there is no document. (restored, opened).  
    if(documentCount == 0){ 
     [[NSDocumentController sharedDocumentController]openUntitledDocumentAndDisplay:YES error: nil]; 
    } 
} 
関連する問題