标签: xcode6-beta6

尝试使用Apple的KeychainItemWrapper"翻译"到Swift

叹了口气,整个下午我一直在努力......这是我的噩梦:

我正在尝试使用Apple制作的KeychainItemWrapper.但我将其Objective-C代码"翻译"为Swift:

import Foundation
import Security
class MyKeychainItemWrapper: NSObject {
var keychainItemData: NSMutableDictionary?
var genericPasswordQuery: NSMutableDictionary = NSMutableDictionary()

init(identifier: String, accessGroup: String?) {

    super.init()

    // Begin Keychain search setup. The genericPasswordQuery leverages the special user
    // defined attribute kSecAttrGeneric to distinguish itself between other generic Keychain
    // items which may be included by the same application.
    genericPasswordQuery.setObject(kSecClassGenericPassword, forKey: kSecClass)
    genericPasswordQuery.setObject(identifier, forKey: kSecAttrGeneric)

    // The keychain access group attribute determines if this item can be shared
    // amongst multiple apps whose …
Run Code Online (Sandbox Code Playgroud)

keychainitemwrapper swift ios8 xcode6-beta6

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

UITableViewCell在使用xcode6 beta6接口构建器的iOS7和iOS8模拟器中表现不同

请看下面3个表视图单元格在同一个应用程序中,单元格的高度在界面构建器中为54,边框是在代码中使用CAShapeLayer创建的,高度为44.由于我在项目开发期间从xcode5切换到xcode6,所以uitableviewcell的一部分在xcode5中创建,部分在xcode6中创建,并且有一些单元在xcode5中创建,后来在xcode6中更改.

此搜索.使用xcode5创建,所需的样式 uitableviewcell内置在xcode5界面构建器中

图像2.使用xcode6 beta6创建,在iOS8模拟器中显示,disclosure indicator放错地方,并且文本是offseted uitableviewcell内置xcode6 beta6,显示在iOS8模拟器中

图像3.使用xcode6 beta6的image2的相同单元格,但在iOS7.1设备中运行,disclosure indicator放错地方 uitableviewcell内置xcode6 beta6,显示在iOS7.1设备中

我比较了界面构建器中uitableviewcell的所有设置,并找到了NO差异.

我比较了xxx.storyboard的源文件,最后得到了不同的观点:

case1:'tableViewCell'标签,xcode5版本是:

<tableViewCell contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="xxCell" rowHeight="54" id="far-Kn-fRP" customClass="xxCell">
  <rect key="frame" x="0.0" y="119" width="320" height="54"/>
Run Code Online (Sandbox Code Playgroud)

case2:'tableViewCell'标签,xcode6 beta6版本在下面,注意,创建新的uitableviewcell时缺少<rect key ="frame"...>

<tableViewCell contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="xxxCell" rowHeight="54" id="eav-sl-Yrd" customClass="xxxCell">
Run Code Online (Sandbox Code Playgroud)

case3:image2和image3中的场景是在xcode5中创建的uitableviewcell ,默认高度为44,并在xcode6 beta6中修改,将高度更改为54,源为:

<tableViewCell contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="xxxCell" rowHeight="54" id="eav-sl-Yrd" customClass="xxxCell">
  <rect key="frame" x="0.0" y="119" width="320" height="44"/>
Run Code Online (Sandbox Code Playgroud)

作为结论,似乎xcode6 beta6不处理.storyboard文件中的<rect …

uitableview ios xcode6-beta6

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

ios8 unwind segue无法使用UINavigationBarController和UITabBarController(在iOS 8.1中已修复)

我刚开始使用Xcode 6(beta 6)在iOS8上测试我的iOS7应用程序.我知道iOS 8已经弃用了"推"和"模态"segue,但我很高兴地发现我所有的segue都工作了......除了一个.

我构建了一个演示应用程序,以显示如果您的应用程序使用带有UINavigationController的UITabBarController,则从模态segue展开似乎会被破坏.(我看到了另一个放松的segue帖子,但是它使用的是swift,我的演示应用程序使用的是obj-c).

以下是我更具体的看法:[UITabBarContoller] - > [UINavigationController] - > [SomeViewController] - (模态Segue) - > [此ViewController无法解除]

有趣的是,你可以放松,如果你做另一个模态segue:[UITabBarContoller] - > [UINavigationController] - > [SomeViewController] - (模态Segue1) - > [这个ViewController不能放松] - (Modal Segue2) - > [这个ViewController可以放松]

我还发现如果我删除UITabBarController或UINavigationController我可以放松,但我不打算改变我的整个应用程序UI架构:)

从我所看到的,根视图控制器永远不会收到对canPerformUnwindSegueAction的调用:fromViewController:withSender:它在iOS7中执行.

我的问题:我是否应该采用不同的方式让我放松工作?

谢谢阅读.

演示代码在这里:https://github.com/nmsasaki/UnwindDemo

UPDATE

这个问题似乎已经被iOS8.1修复了.(iOS 8.0解决方法是创建UINavigationController的自定义子类继续工作.)

objective-c ios8 xcode6-beta6 unwind-segue

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

Xcode Beta 6 - 使用未声明类型'CLLocationManagerDelegate'

我刚刚从Xcode 6 Beta 3升级到Xcode 6 Beta 6.在Beta 3中,一切正常并且编译得像我想要的那样.

现在,我无法让CLLocationManagerDelegate工作,即我总是得到使用未声明的类型'CLLocationManagerDelegate' - 错误消息.

这是我的文件的样子:

import UIKit
import CoreLocation

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, CLLocationManagerDelegate {
Run Code Online (Sandbox Code Playgroud)

附加信息:

  • 我添加了CoreLocation Framework(尝试直接在Xcode中添加它,也可以通过从文件夹中拖放实际文件,无需更改)
  • 在开始运行之前,我不得不重新安装Xcode 6 Beta 6(运行OSX 10.9.4,在首次启动时总是崩溃)
  • 如您所见,我将CoreLocation导入到我的文件中.
  • CLLocationManagerDelegate不会自动完成,它会一直到CLLocationManager

有任何想法吗?我假设这里没有正确的链接.

xcode cllocationmanager swift xcode6-beta6

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

iOS 8 iCloud容器更改

关于iOS8中的iCloud,我有几个问题.

  1. 我正在浏览我的开发人员个人资料,与我的个人资料相关联的iCloud容器已从我更改${TeamIdentifer}{Bundle Name}iCloud.{Bundle Name}.目前,我的应用程序仅在iOS7设备上运行.那么,如果我使用这个iCloud.{Bundle Name}容器,那么存在的内容是否会${TeamIdentifier}.{Bundle Name}被复制到用户的新容器中?

  2. 此外,我正在使用xCode 6 beta 6,它无法识别我的${TeamIdentifier}.{Bundle Name}iCloud容器.这很可能是因为我的开发人员资料.我打算为iOS7和iOS8部署应用程序.那么,有没有办法将iCloud容器更改为${TeamIdentifier}.{Bundle Name}

ios icloud xcode6 ios8 xcode6-beta6

6
推荐指数
1
解决办法
699
查看次数

AnyObject?没有名为'objectAtIndex'的成员

如果尝试获取字符串对象,则(Xcode6 BETA 6)出错:

let jsonString : String = "[{\"name\":[\"Fred\",\"John\"],\"age\":21},{\"name\":\"Bob\",\"age\":35}]"

let myData:NSData? = jsonString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)

var jsonResult:NSArray = NSJSONSerialization.JSONObjectWithData(myData!, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSArray

println(jsonResult.objectAtIndex(0).objectForKey("name").objectAtIndex(0))
Run Code Online (Sandbox Code Playgroud)

print永远不会被调用,导致错误.有人有想法吗?

swift xcode6-beta6

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

Xcode 6 beta 6 - 主要故事板上的项目已消失/禁用

我在Xcode 6 Beta 6上遇到过这个问题.当我选择主故事板视图,我可以看到我的应用程序的所有视图与所有组件(按钮,列表等),我只能看到视图本身但没有组件在他们事件,虽然我已经把它们放在那里.当我在模拟器中构建并运行应用程序时,所有组件都是可见的,但是当我开发时,我看不到它们.在主故事板的用户界面视图的左侧列出了所有控制器,当我展开它们时,我可以看到应该在视图上显示的组件,但它们就像被禁用(淡出).

编译器不显示任何错误或警告.有没有人知道发生了什么以及如何解决这个问题?

编辑:我现在安装了最新版本,但我仍然遇到同样的问题.没有人有这个问题吗?

xcode ios swift xcode6-beta6

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

SKNode.removeFromParent()EXC_BAD_ACCESS

我注意到我的Swift项目中有一个奇怪的行为,并在一个空的SpriteKit项目上重现它:

class GameScene: SKScene {
    override func didMoveToView(view: SKView) {

        let sprite = SKSpriteNode(imageNamed:"Spaceship")
        self.addChild(sprite)
        //sprite.removeFromParent()

        let sprite2 = SKSpriteNode(imageNamed:"Spaceship")
        self.addChild(sprite2)
        sprite2.removeFromParent()
    }
}
Run Code Online (Sandbox Code Playgroud)

它在应用程序启动之前崩溃,我只能看到: xCode的屏幕截图

我的配置是xCode6-Beta6,iPad Mini Retina,iOS8-Beta5和OSX 10.9.4.我还复制了模拟器中的bug; 使用xCode6-Beta5; 并在touchesBegan方法中移动代码

取消注释该行sprite.removeFromParent()会使错误消失.

ios sprite-kit swift xcode6-beta6

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

SWIFT Apple Mach-O链接器错误"_OBJC_CLASS _ $ _ BFExectur"

尝试使用Parse与X代码和目标C.弹出4个不同的错误.建议?

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_BFExecutor", referenced from:
    objc-class-ref in Parse(BFTask+Private.o)
    l_OBJC_$_CATEGORY_BFExecutor_$_Background in Parse(BFTask+Private.o)
  "_OBJC_CLASS_$_BFTask", referenced from:
    objc-class-ref in Parse(PSObject.o)
    objc-class-ref in Parse(PFFile.o)
    objc-class-ref in Parse(PFNetworkCommandRunner.o)
    objc-class-ref in Parse(PFQuery.o)
    objc-class-ref in Parse(PFRetryingCommandRunner.o)
    objc-class-ref in Parse(PFTaskQueue.o)
    objc-class-ref in Parse(PFUser.o)
    ...
  "_OBJC_CLASS_$_BFTaskCompletionSource", referenced from:
    objc-class-ref in Parse(PFObject.o)
    objc-class-ref in Parse(PFCommandCache.o)
    objc-class-ref in Parse(PFFile.o)
    objc-class-ref in Parse(PFNetworkCommandRunner.o)
    objc-class-ref in Parse(BFTask+Private.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

ios parse-platform swift xcode6-beta6

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

向UIBarButtonItem Swift添加动作

按钮是在故事板中创建的,我想添加一个动作.

self.cancel.action = NSSelectorFromString("cancel:")

func cancel(sender: UIBarButtonItem) ->() {
}
Run Code Online (Sandbox Code Playgroud)

这不起作用.谢谢

uibarbuttonitem swift xcode6-beta6

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