当我测试时,ForgeLog
s 和s都没有出现在我的 Safari Web Inspector 中。NSLog
我做错了什么还是故意的?
[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];
}