我尝试写入/读取值[NSUserDefaults standardUserDefaults],但似乎不起作用.我的代码是:
[[NSUserDefaults standardUserDefaults] setObject:@"sampleString" forKey:@"sampleKey"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSString *defaultsValue = [[NSUserDefaults standardUserDefaults] objectForKey:@"sampleKey"];
return defaultsValue;
Run Code Online (Sandbox Code Playgroud)
nil对于Xcode 8.0 beta和iPhone 6s(10.0)模拟器,此代码返回.然而,它返回sampleStringXcode 8.0 beta和iPhone 6s(9.1)模拟器
我正在用新系统测试我的应用程序.难道我做错了什么?或者有解决方法吗?或者它只是一个"测试版"问题?
我正在尝试将Swift 2.3迁移到3.0并且转换后面临此问题.有什么建议我做错了.
override func setValue(_ value: AnyObject?, forKey key: String) {
let uppercasedFirstCharacter = String(key.characters.first!).uppercased()
let range = key.startIndex...key.index(key.startIndex, offsetBy: 0)
let selectorString = key.replacingCharacters(in: range, with: uppercasedFirstCharacter)
let selector = NSSelectorFromString("set\(selectorString):")
let responds = self.responds(to: selector)
if !responds {
return
}
Run Code Online (Sandbox Code Playgroud)
错误:
let selectorString = key.replacingCharacters(in:range,with:uppercasedFirstCharacter)
Run Code Online (Sandbox Code Playgroud)Cannot convert value of type 'ClosedRange<Index>' (aka 'ClosedRange<String.CharacterView.Index>') to expected argument type 'Range<Index>' (aka 'Range<String.CharacterView.Index>')
override func setValue(value: AnyObject?, forKey key: String) {
let uppercasedFirstCharacter = String(key.characters.first!).uppercaseString
let range …Run Code Online (Sandbox Code Playgroud) 我将Facebook SDK(Swift)添加到我的项目中.现在我更新了Xcode 8和Swift 3.我的构建时间有误
Module compiled with Swift 2.3 cannot be imported in Swift 3.0
Run Code Online (Sandbox Code Playgroud)
非常奇怪,不支持.有人有过类似的问题吗?
我在Xcode 7.3中使用swift 2.2版本进行了工作.现在我已经更新了Xcode 8并迁移到swift 3.现在我的项目包含特别针对像afnetworking成功块这样的块的错误.
这给出了错误
Cannot convert value of type '() -> ()' to expected argument type '((URLSessionDataTask, Any?) -> Void)?'
Run Code Online (Sandbox Code Playgroud)
根据swift 3,我不明白如何解决这个问题.
Facebook登录也有同样的错误.
这给出了错误
Cannot convert value of type '(FBSDKLoginManagerLoginResult!, NSError!) -> Void' to expected argument type 'FBSDKLoginManagerRequestTokenHandler!'
Run Code Online (Sandbox Code Playgroud)
和
Cannot convert value of type '(_, _, NSError!) -> Void' to expected argument type 'FBSDKGraphRequestHandler!'
Run Code Online (Sandbox Code Playgroud)
这个所有错误都与swift 3中的处理程序块有关.我不理解错误,因此无法解决.任何帮助将不胜感激.提前致谢.
我正在使用未本地化的字符串并低于警告
面向用户的文本应使用本地化的字符串宏
如何抑制此警告?
当我尝试将我的应用程序上传到应用程序商店时,我收到以下错误:"由于一般错误,无法在此时查找应用程序的提交设置".有没有人收到这条消息?这是由于Apple开发人员门户问题吗?
IDEDistribution.critical.log:
2017-01-06 15:32:14 +0000 The store submission configuration response failed with errors: (
"Error Domain=ITunesConnectionOperationErrorDomain Code=1614 \"Unable to lookup the settings for submission for the application at this time due to a general error\" UserInfo={NSLocalizedRecoverySuggestion=Unable to lookup the settings for submission for the application at this time due to a general error, NSLocalizedDescription=Unable to lookup the settings for submission for the application at this time due to a general error, NSLocalizedFailureReason=iTunes Store operation failed.}"
), warnings: (
), info …Run Code Online (Sandbox Code Playgroud) 我试图在Swift 3中创建一个我在Swift 2中已有的范围,但它一直给我这个错误:
String may not be indexed with 'Int', it has variable size elements
这是我的代码:
let range = expireRange!.startIndex.advancedBy(n: 7) ..< expireRange!.startIndex.advancedBy(n: 16)
Run Code Online (Sandbox Code Playgroud)
expiredRange是一个 Range<Index>?
在Swift 2中,我有:
let range = expireRange!.startIndex.advancedBy(7)...expireRange!.startIndex.advancedBy(16)
Run Code Online (Sandbox Code Playgroud) 在Xcode 8 beta 5中,初始化程序DispatchQueue已更改为接受qos(服务质量),属性和自动释放频率的单独参数.虽然我将代码转换为使用新的初始化程序时没有任何问题,但我不确定某些属性的含义,特别是自动释放频率.
例如,在Xcode 8 beta 3和Swift 3中,我能够创建一个序列DispatchQueue:
let serialQueue = DispatchQueue(label: "Concurrent Map", attributes: [.serial, .qosBackground], target: nil)
Run Code Online (Sandbox Code Playgroud)
在Xcode 8 beta 5和Swift 3中:
let serialQueue = DispatchQueue(label: "Concurrent Map", qos: .background, attributes: [], autoreleaseFrequency: .inherit, target: nil)
Run Code Online (Sandbox Code Playgroud)
我的问题是:
我正在使用TestFlight测试我的应用程序,但在更新到MacOS 10.12和Xcode 8.1后我无法上传我的存档.
当我存档我的应用程序时,单击"上传到App Store ...",选择我的开发,我收到此错误.
找不到"Applications/app.app"的匹配配置文件
没有任何有效的配置文件允许指定的权利:application-identifier,beta-reports-active,keychain-access-groups.
到目前为止我尝试过的:
xcode8 ×10
swift3 ×5
ios ×4
xcode ×3
facebook ×2
ios10 ×2
objective-c ×2
swift ×2
swift2 ×2
afnetworking ×1
alamofire ×1
cocoa ×1
iphone ×1
swift2.3 ×1
testflight ×1