小编moh*_*acs的帖子

有没有一种简单的方法可以获取目前最流行的 SoundCloud 曲目?

我需要来自 SoundCloud 的“最流行”或“最热门曲目”,但我找不到任何方法来做到这一点。我可以从

http://api.soundcloud.com/tracks?filter=streamable&limit=100&order=created_at
Run Code Online (Sandbox Code Playgroud)

因为订单类型“最热门”不再存在。
我想要完全相同的歌曲

https://soundcloud.com/explore
Run Code Online (Sandbox Code Playgroud)

然后选择“流行音乐”。有没有办法做到这一点?

我想过获取大约 1000 首歌曲,而不是将播放次数最多和最喜欢的歌曲排序并仅显示它们,但我认为这不是最佳解决方案。

ios soundcloud

5
推荐指数
1
解决办法
9985
查看次数

Swift - 集成GameCenter以使用排行榜

我在斯威夫特做一个游戏.我希望能够使用GameCenter发布用户的分数,以便可以看到所有用户的分数.但是,我花了一天时间试图弄清楚如何做到这一点,但我没有找到任何有用的指示.

我对iOS编程和Swift都很陌生,而且关于这个主题的信息非常少,所有这些都是用Objective-C编写的.

任何人都可以帮我将GameCenter集成到我的应用程序中,这样我就可以将用户分数发布到排行榜上供人们查看吗?

编辑:我已经在iTunesConnect上创建了一个GameCenter排行榜.

编辑2:我尝试过以下教程:http://www.appcoda.com/ios-game-kit-framework/并将其转换为Swift.我转换了这个:

-(void)authenticateLocalPlayer {
    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

    localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){
        if (viewController != nil) {
            [self presentViewController:viewController animated:YES completion:nil];
        }
        else{
            if ([GKLocalPlayer localPlayer].authenticated) {
                _gameCenterEnabled = YES;

                // Get the default leaderboard identifier.
                [[GKLocalPlayer localPlayer] loadDefaultLeaderboardIdentifierWithCompletionHandler:^(NSString *leaderboardIdentifier, NSError *error) {

                    if (error != nil) {
                        NSLog(@"%@", [error localizedDescription]);
                    }
                    else{
                        _leaderboardIdentifier = leaderboardIdentifier;
                    }
                }];
            }

            else {
                _gameCenterEnabled = NO;
            }
        }
    };
}
Run Code Online (Sandbox Code Playgroud)

进入这个:

func …
Run Code Online (Sandbox Code Playgroud)

xcode ios game-center swift

5
推荐指数
1
解决办法
7495
查看次数

NSURLSession缓存在iOS8中不起作用

我有以下代码,它在iOS7中工作正常,但在iOS8中没有.在iOS8中,应用程序总是使用缓存,即使我已设置NSURLRequestReloadIgnoringCacheData:

NSURL *url = [NSURL URLWithString:k_Chapter_URL];
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];

NSURLSessionConfiguration *sessionConfig =
[NSURLSessionConfiguration defaultSessionConfiguration];
sessionConfig.requestCachePolicy = NSURLRequestReloadIgnoringCacheData;
NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig];

[[session dataTaskWithRequest:request
            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {

            }] resume];
Run Code Online (Sandbox Code Playgroud)

有没有人和我有类似的情况?

nsmutableurlrequest nsurlsession ios8

5
推荐指数
1
解决办法
735
查看次数

我们为什么需要数据仓库?

我想知道为什么以及何时需要数据仓库,我的意思是数据仓库的主要目标是从多维视图提供报告,但在某些情况下有一种方法可以使用DBMS构建报告,它可以生成报告从多维视图,关于数据库的大小,可以逐步增加大小,关于集成DBMS也可以从许多数据源进行集成,如果它们具有与许多数据源不同的密钥,dbms可以修复它(尽管我们'不使用数据仓库),从性能方面来说,从运营数据存储生成报告并从数据仓库生成报告需要多长时间,处理时间是否有很大差距?

对不起英语不好和奇怪的问题,我还在学习数据仓库.

data-warehouse

5
推荐指数
1
解决办法
7970
查看次数

如何使用NSNotificationCenter在类之间传递对象 - 无法传递对象

我的代码:

NSDictionary *dict = @{@"1": @"_infoView3",
                       @"2": [NSNumber numberWithFloat:_showSelectionView.frame.size.height]
                       };

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(keyboardWillShow:)
                                             name:@"UIKeyboardWillShowNotification"
                                           object:dict];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(keyboardDidHide:)
                                             name:@"UIKeyboardDidHideNotification"
                                           object:dict];
Run Code Online (Sandbox Code Playgroud)

并且:

- (void) keyboardWillShow:(NSNotification *)note {
    NSDictionary *userInfo = [note userInfo];
    CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

    // move the view up by 30 pts
    CGRect frame = self.view.frame;
    frame.origin.y = -kbSize.height;

    [UIView animateWithDuration:0.3 animations:^{
        self.view.frame = frame;
    }];
}

- (void) keyboardDidHide:(NSNotification *)note {

    // move the view back to the origin
    CGRect frame = self.view.frame;
    frame.origin.y …
Run Code Online (Sandbox Code Playgroud)

objective-c nsnotificationcenter ios

4
推荐指数
1
解决办法
9210
查看次数

如何使用IOS 8 XCode 6 beta从Popover中的按钮关闭UIPopover

我设法显示popover使用,UIPopoverPresentationController因为UIPopoverController在IOS 8中已弃用,但现在我想从popover中关闭按钮上的popover.

怎么可以被解雇?

xcode objective-c ios

4
推荐指数
1
解决办法
6966
查看次数

UIImageJPEGRepresentation收到内存警告

我在使用UIImageJPEGRepresentation时收到内存警告,有什么方法可以避免这种情况吗?它不会崩溃应用程序,但我想尽可能避免它.它间歇性地不运行[[UIApplication sharedApplication] openURL:url];

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage];
    NSData *imageToUpload = UIImageJPEGRepresentation(image, 1.0);

    // code that sends the image to a web service (omitted)
    // on success from the service
    // this sometime does not get run, I assume it has to do with the memory warning?
    [[UIApplication sharedApplication] openURL:url];
}
Run Code Online (Sandbox Code Playgroud)

memory-leaks uiimagejpegrepresentation ios

4
推荐指数
1
解决办法
3765
查看次数

[IOS SDK] - touchesBegan与特定对象?

当我触摸屏幕上的任何地方触摸触发事件时触发.但我无法管理如何像UIImageView一样触摸特定对象?

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

 UITouch *touch = [[event allTouches] anyObject];

 CGPoint location = [touch locationInView: touch.view];

 imageView.center = location;

}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

 [self touchesBegan:touches withEvent:event];

}
Run Code Online (Sandbox Code Playgroud)

xcode nsset touchesmoved touchesbegan ios4

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

在Swift中调用只具有类名的初始化程序

我想知道是否有办法只通过在Swift中拥有类名来调用初始化程序.

class Shape {
  let name: String
  var numberOfSides: Int?

  init(name: String) {
    self.name = name
  }
}
Run Code Online (Sandbox Code Playgroud)

伪代码:

let shapeClass = stringToClass("Shape")

let shape: Shape = shapeClass(name: "Something")
Run Code Online (Sandbox Code Playgroud)

initializer ios swift

3
推荐指数
1
解决办法
1057
查看次数

Supervisord:如何在启动命令中使用主机名

是否有可能以某种方式在supervisord启动脚本中使用本地主机名?我需要它将jmx主机传递给java程序.例:

command=HOSTNAME=foo.bar /usr/local/rvm/bin/jruby-1.7.1 script/trinidad.rb --threadsafe -f config/trinidad_user_production.rb
Run Code Online (Sandbox Code Playgroud)

到目前为止,我认为没有简单的选择

最好,

托比亚斯

supervisord

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