小编Ros*_*son的帖子

NSURLConnection使用iOS Swift

我正在尝试按照本教程使用Swift和连接到JSON api NSURLConnection.我可以看到它正在击中网址,但connectionDidFinishLoading似乎没有开火.

import UIKit

class Remote: NSObject {

    var host = "http://localhost:3000"
    var query = String()
    var data: NSMutableData = NSMutableData()

    func connect(query:NSString) {
        self.query = query
        var url = self.document()
        var conn = NSURLConnection(request: url, delegate: self, startImmediately: true)
    }

    func endpoint() -> NSURL {
        var query = self.host + self.query
        return NSURL(string: query)
    }

    func document() -> NSURLRequest {
        return NSURLRequest( URL: self.endpoint() )
    }

    func connection(didReceiveResponse: NSURLConnection!, didReceiveResponse response: NSURLResponse!) { …
Run Code Online (Sandbox Code Playgroud)

nsurlconnection nsurlrequest ios swift

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

隐藏MacVim源代码工具提示

我使用Homebrew在MacOs X Yosemite上安装了MacVim 7.4-73_1 .当在ruby文件中悬停在某些单词上时会导致工具提示淡入.它似乎会减慢Vim的速度,导致工具提示加载时出现短暂的延迟,它们也会导致阻碍.所以,我的目标是将这些工具提示全部隐藏起来.我知道这可能是由我使用的插件引起的,但我似乎无法将其固定下来.

我在下面附上了一个显示另一个奇怪行为的gif.如果我从vim资源管理器开始编辑文件,则仅显示工具提示.

示例GIF http://f.cl.ly/items/0x0q2a083J392t412f2P/2014-11-06%2019_37_12.gif

下面是我正在使用的vim插件和我的列表 .vimrc

我所有的插件

ack.vim
mustache
nerdcommenter
sass-convert.vim
snipmate-mocha
snipmate-snippets
tabular
tlib_vim
vim-addon-mw-utils
vim-coffee-script
vim-css-color
vim-fugitive
vim-less
vim-rails
vim-rspec
vim-snipmate
Run Code Online (Sandbox Code Playgroud)

我的Vimrc文件

" Use Pathogen
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()

" ================
" Ruby stuff
" ================
syntax on                 " Enable syntax highlighting
filetype plugin indent on " Enable filetype-specific indenting and plugins

augroup myfiletypes
  " Clear old autocmds in group
  autocmd!
  " autoindent with two spaces, always expand tabs
  autocmd FileType ruby,eruby,yaml …
Run Code Online (Sandbox Code Playgroud)

vim homebrew macvim osx-yosemite

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