2013-04-14 18 views
1

當我測試時,我的Safari Web Inspector中都沒有顯示ForgeLogNSLog。我做錯了什麼或者是故意的?未在Web檢查器中顯示日誌

[ForgeLog d:@"Playing file at..."]; 

編輯:下面是上下文的代碼的其餘部分。 (這次使用NSLog。)

#import "audio_API.h" 

static AVAudioPlayer* player = nil; 

@implementation audio_API 


+ (void)play:(ForgeTask*)task { 

    // parse the file url from the file object 
    ForgeFile* file = [[ForgeFile alloc] initWithFile:[task.params objectForKey:@"file"]]; 
    NSString* fileURL = [file url]; 

    NSLog(@"Playing file at %@", fileURL); 

    NSURL* url = [[NSBundle mainBundle] URLForResource:fileURL withExtension:@"m4a"]; 


    // TESTING 
    //url = [[NSBundle mainBundle] URLForResource:@"seconds" withExtension:@"m4a"]; 
    // END TESTING 

    NSAssert(url, @"URL is invalid."); 

    // create the player 
    NSError* error = nil; 
    player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; 
    if(!player) 
    { 
     NSLog(@"Error creating player: %@", error); 
    }; 

    [player play]; 

    [task success:nil]; 
} 
+0

你可以發佈你調用它的方法嗎? –

+0

@ChrisLoonam我按照你的要求編輯了我的文章:) – Garrett

回答

2

ForgeLogNSLog不登錄到Web控制檯檢查。在開發插件時,可以在XCode中看到此日誌輸出,將插件作爲應用程序的一部分使用時,此輸出將出現在Toolkit或命令行工具輸出中。

如果您希望通過插件在Web檢查器中顯示某些內容,您最好通過以下事件從本機代碼與JavaScript數據進行通信:http://docs.trigger.io/en/v1.4/modules/native/javascript_events.html並在事件偵聽器中使用console.log