标签: xcode7

如何在xcode 7中的Swift 2.0中使用NSRegularExpression

//错误在这里 let regex = NSRegularExpression(pattern: "(<img.*?src=\")(.*?)(\".*?>)", options: nil, error: nil)

//错误是:***

找不到接受类型参数的类型nsregularexpression的初始值设定项(pattern:string,ption:nil,error:nil)

regex ios xcode7 swift2

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

我们可以在XCode 6中使用NSAppTransportSecurity吗?

在WWDC 2015上,Apple宣布推出适用于iOS 9的"App Transport Security".为解决SSL错误并绕过App Transport Security,Apple推出了一个关键的NSAppTransportSecurity,将添加到info.plist中.我们可以在Xcode 6中使用这个键吗?

xcode6 ios9 xcode7 ios-9-beta3 app-transport-security

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

为什么在SceneKit中没有调用Contact Delegate?

我正在开发一款游戏,我在SceneKit中遇到了联系代表的问题.我在ViewController中声明了正确的委托,并使用它来设置委托:

    sceneView.scene?.physicsWorld.contactDelegate = self
Run Code Online (Sandbox Code Playgroud)

它应该工作,事实上,它确实,使用XCode 6.4,但它与beta XCode 7没有.相同的代码.我的问题是:这里有人能够知道它的临时修复吗?

beta ios scenekit swift xcode7

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

WatchKit didReceiveApplicationContext没有被调用

不敢didReceiveApplicationContext打电话。有任何想法吗?

InterfaceController

import WatchKit
import Foundation
import WatchConnectivity

class InterfaceController: WKInterfaceController, WCSessionDelegate {

    @IBOutlet var colorLabel: WKInterfaceLabel!

    private let session: WCSession? = WCSession.isSupported() ? WCSession.defaultSession() : nil

    override init() {
        super.init()
        session?.delegate = self
        session?.activateSession()
    }

    override func awakeWithContext(context: AnyObject?) {
        super.awakeWithContext(context)
    }

    func session(session: WCSession, didReceiveApplicationContext applicationContext: [String : AnyObject]){
        let colors : String = applicationContext["color"] as! String
        colorLabel.setText(colors)
        NSLog("session did receive application context")
    }

}
Run Code Online (Sandbox Code Playgroud)

我一直在跟随本教程:http : //www.kristinathai.com/watchos-2-how-to-communicate-between-devices-using-watch-connectivity/

NSLogcolorLabel …

swift watchkit xcode7 watchos-2

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

在Xcode 7中从Unity构建iOS时出错

我收到此错误,导致从Unity构建项目后Xcode中的构建失败:

fatal error: lipo: can't write to output file: /Users/applemac/Library/Developer/Xcode/DerivedData/Unity-iPhone-hdkycurnjlkvikcljdgvlfnbmsua/Build/Products/Release-iphoneos/spacegame.app.dSYM/Contents/Resources/DWARF/spacegame.lipo (Undefined error: 0)
Run Code Online (Sandbox Code Playgroud)

它是什么意思,我该如何解决?该应用适用于iPhone和iPad,如果它有任何区别.提前致谢.

error-handling xcode unity-game-engine ios xcode7

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

链接文本视图以一起滚动

我有两个并排的文本视图.我如何链接它们,以便如果一个向下滚动,其他自动滚动与swift 2中的第一个滚动相同.

uitextview ios xcode7 swift2

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

将动作点击分配给谷歌地图标记,swift 2

我有一个谷歌地图标记,我希望当我点击标记发送给我另一个viewController,或在我的地图上显示一个按钮,

let marker1 = GMSMarker()
marker1.position = CLLocationCoordinate2DMake(24.8236423, -107.4234671)
marker1.appearAnimation = kGMSMarkerAnimationPop
marker1.icon = UIImage(named: "flag_icon")
marker1.title = "Any title"
marker1.snippet = "Any text"
marker1.map = mapView
Run Code Online (Sandbox Code Playgroud)

google-maps-api-3 ios9 xcode7 swift2

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

使用editActionsForRowAtIndexPath删除行"UITableView内部错误"

我需要在editActionsForRowAtIndexPath中创建一个动作来删除表中的行.在互联网上进行一些研究之后,我来到了这段代码:

func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {


        let remove = UITableViewRowAction(style: UITableViewRowActionStyle.Destructive, title: "Remover", handler: { (action: UITableViewRowAction, indexPath: NSIndexPath) -> Void in
            self.tableData.removeObjectAtIndex(indexPath.row)
            tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)

        })

        return [remove]
    }
Run Code Online (Sandbox Code Playgroud)

但现在我收到了这个错误

UITableView内部错误:无法生成具有旧部分计数的新剖面图:1和新部分计数:0

uitableview ios swift xcode7

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

如何在swift操场上输入pi符号.选项+ p无法在我的MacBookPro键盘上运行......?

如何在swift操场上输入pi符号.选项+ p无法在我的MacBookPro键盘上运行......?在输入选项+ p时,它在编辑器中显示","(逗号).

ios swift swift-playground xcode7

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

UICollectionView重复单元格

我有一个UICollectionView,其中每个单元格中都有一个图像。这些图像通过URL加载。但是,当某个单元格滚动出视线时,它会在重新加载之前显示另一单元格的图像一秒钟。我不知道为什么会这样。

这是我的代码:

我的UIImageView扩展要从url加载:

extension UIImageView {
    public func imageFromUrl(urlString: String) {

        Alamofire.request(.GET, urlString).responseJSON{
            response in

            if let tilbudimage = UIImage(data: response.data!){
                self.image = tilbudimage

            }

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

UICollectionView:

func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        return 1
    }

    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {

        print(DealArr.count)

        return DealArr.count
    }

    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("DealCell", forIndexPath: indexPath) as! DealCell

        let deal = self.DealArr[indexPath.row]

        cell.backgroundColor = UIColor.whiteColor()

        cell.DealImage.imageFromUrl(deal["image"].string!)
        cell.DealLabel.text = deal["title"].string! + …
Run Code Online (Sandbox Code Playgroud)

uicollectionview uicollectionviewcell swift xcode7

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