小编Ema*_*uel的帖子

Xcode 7测试不运行但报告成功

我想测试目标添加到我的项目,然而,当我进行的测试,好像不被执行的实际测试,而不是Xcode的报道总是成功,但小方这表明,如果测试通过与否遗体明确.

我只有一个测试目标和一个类:

@implementation Tests

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // This is an example of a functional test case.
    // Use XCTAssert and related functions to verify your tests produce the correct …
Run Code Online (Sandbox Code Playgroud)

unit-testing xctest xcode7

32
推荐指数
6
解决办法
6846
查看次数

Youtube API搜索自动完成

我正在使用Youtube API,我想拥有一个搜索自动完成功能,就像在YouTube上一样,当您在搜索输入框中输入内容时,它会为您提供搜索建议.我已经阅读了文档,但仍然缺少,这是否可以使用API​​?

youtube search autocomplete youtube-api

22
推荐指数
2
解决办法
1万
查看次数

AVPlayer:当按下主页按钮时,背景音频停止,但在锁定屏幕时播放

好的,所以我的应用程序播放视频,我希望声音继续在后台播放.但是当我点击"Home"按钮时播放停止.我正在使用iOS 5.0.1测试iPhone 4s

什么工作?

  • 如果视频正在播放并且我锁定屏幕,它会一直播放,
  • 我可以通过锁定屏幕控制来控制播放:下一个,上一个,播放,暂停.
  • 如果我按" home ",然后从多任务栏转到" 遥控器 ",它就可以了.

怎么了?

  • 当我按"主页"按钮时,我希望应用程序继续播放,因为当我这样做时,音频会停止.

我做了什么:

  • 在我的app.plist中将"audio"添加到"Required background modes"

在app delegate的应用程序中添加了以下代码:didFinishLaunchingWithOptions:

NSError *setCategoryErr = nil;
NSError *activationErr  = nil;
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error:&setCategoryErr];    
[[AVAudioSession sharedInstance] setActive:YES error:&activationErr];
Run Code Online (Sandbox Code Playgroud)

在我的视图控制器中,我实现了接收远程控件的方法:

- (BOOL)canBecomeFirstResponder {
    return YES;
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
    [self becomeFirstResponder];
}
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    //End recieving events
    [[UIApplication …
Run Code Online (Sandbox Code Playgroud)

video background avplayer ios5

7
推荐指数
1
解决办法
3868
查看次数