我正试图通过麦克风实时访问音量数据.我尝试过AVAudioPlayer,但它只监视来自mp3之类的声音,而不是麦克风.我也尝试了The SpeakHere应用程序,但事实证明用所有Objective C++语法(我是新手)理解起来要困难得多.是否有另一个类似于SpeakHere中的类,但仅在Objective C中编写?
在iOS中有使用ECC的示例吗?
我注意到Apple Developer Documents中的kSecAttrKeyTypeEC,但是我不能将它用于通用密钥对.
下面的代码是从示例CryptoExercise修改的
// Container dictionaries.
NSMutableDictionary * privateKeyAttr = [[NSMutableDictionary alloc] init];
NSMutableDictionary * publicKeyAttr = [[NSMutableDictionary alloc] init];
NSMutableDictionary * keyPairAttr = [[NSMutableDictionary alloc] init];
// Set top level dictionary for the keypair.
[keyPairAttr setObject:(id)kSecAttrKeyTypeEC forKey:(id)kSecAttrKeyType];
[keyPairAttr setObject:[NSNumber numberWithUnsignedInteger:keySize] forKey:(id)kSecAttrKeySizeInBits];
// Set the private key dictionary.
[privateKeyAttr setObject:[NSNumber numberWithBool:YES] forKey:(id)kSecAttrIsPermanent];
[privateKeyAttr setObject:privateTag forKey:(id)kSecAttrApplicationTag];
// See SecKey.h to set other flag values.
// Set the public key dictionary.
[publicKeyAttr setObject:[NSNumber numberWithBool:YES] forKey:(id)kSecAttrIsPermanent];
[publicKeyAttr setObject:publicTag forKey:(id)kSecAttrApplicationTag];
// See …Run Code Online (Sandbox Code Playgroud) 我有NSDate变量,只想改变时间(不应该更改日期).可能吗 ?
例如:用户在DatePicker日期选择日期间隔(如果是开始日期我想将时间设置为00:00:00,如果是结束日期,我将时间设置为23:59:59)
感谢你的帮助.
问候,亚历克斯.
由于LLVM,可以实际编译SWIFT代码以在另一个平台上使用.
当然你不能使用仅限Apple的库,但只是为了通用代码,LLVM是否支持这一点,即使Apple不支持它?
我试图在XCode playground中显示配置了自动布局约束的视图,但它似乎不起作用.这就像游乐场完全忽略了约束,我无法在任何地方找到有关此问题的信息.
这是我试过的代码:
let view = UIView()
view.frame = CGRectMake(0, 0, 400, 200)
view.backgroundColor = UIColor.lightGrayColor()
let label = UILabel() // I can only see the label if I set a frame
// UILabel(frame: CGRectMake(0, 0, 200, 50))
label.backgroundColor = UIColor.greenColor()
label.text = "I am a label"
label.setTranslatesAutoresizingMaskIntoConstraints(false)
view.addSubview(label)
let views = ["label":label]
let options = NSLayoutFormatOptions(0)
let cs1 = NSLayoutConstraint.constraintsWithVisualFormat(
"H:|-[label]-|", options: options, metrics: nil, views:views )
let cs2 = NSLayoutConstraint.constraintsWithVisualFormat(
"V:|-[label]-|", options: options, metrics: nil, …Run Code Online (Sandbox Code Playgroud) 2015-08-01 22:30:43.893 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.896 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.899 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.912 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.913 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.913 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.914 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.914 MyApp[2425:284133] …Run Code Online (Sandbox Code Playgroud) 我正在使用Xcode版本7.1.1(7B1005)
我正在尝试构建的iOS应用程序是通过复制现有的Mac版本的应用程序,并更改相关的目标操作系统设置而生成的.我在成功使用其他应用程序之前完成了此操作,没有任何重大问题.但是,此应用程序的Info.plist文件(直接从工作应用程序复制)可能会导致某种问题.
以下是我的问题产生的错误:
replacing existing signature
bundle format unrecognized, invalid, or unsuitable
Command /usr/bin/codesign failed with exit code 1
Run Code Online (Sandbox Code Playgroud)
我通过添加--deep到codesign标志来解决第一个错误.添加之后我会收到此错误:
Validate /Users/me/Library/Developer/Xcode/DerivedData/long string of characters/Build/Products/Debug-iphoneos/my\ app\ name.app
cd /Users/me/Perforce/workspace/project/Platforms/OSX
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PRODUCT_TYPE=com.apple.product-type.application
builtin-validationUtility /Users/me/Library/Developer/Xcode/DerivedData/long string of characters/Build/Products/Debug-iphoneos/my\ app\ name.app
error: Failed to read Info.plist of app /Users/me/Library/Developer/Xcode/DerivedData/long string of characters/Build/Products/Debug-iphoneos/my app name.app (Couldn't load Info dictionary for <DVTFilePath:0x7f97125bb4b0:'/Users/me/Library/Developer/Xcode/DerivedData/long string of characters/Build/Products/Debug-iphoneos/my app name.app'>)
Run Code Online (Sandbox Code Playgroud) 为了填充整个页面的高度,我使用height: 100%;html和body标签,并且在关闭浏览器并重新打开之前,它可以正常工作。(由于移动设备上的问题,我不使用100vh https://nicolas-hoizey.com/2015/02/viewport-height-is-taller-than-the-visible-part-of-the-document-in -some-mobile-browsers.html)
重现步骤:
在以下情况下,页面将自行修复:
为什么会发生?如何解决此问题?
先感谢您!
我在使用Swift进行字符串插值时检测到内存泄漏.使用"泄漏"工具,它将泄漏的对象显示为"Malloc 32字节",但没有负责的库或框架.这似乎是由字符串插值中的选项使用引起的.
class MySwiftObject
{
let boundHost:String?
let port:UInt16
init(boundHost: String?, port: UInt16)
{
if boundHost {
self.boundHost = boundHost!
}
self.port = port
// leaks
println("Server created with host: \(self.boundHost) and port: \(self.port).")
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我通过附加片段简单地构建String来替换字符串插值,则不会发生内存泄漏.
// does not leak
var message = "Server created with host: "
if self.boundHost
{
message += self.boundHost!
}
else
{
message += "*"
}
message += " and port: \(self.port)"
println(message)
Run Code Online (Sandbox Code Playgroud)
上面有什么我做错了,或者只是一个Swift bug?
ios ×8
swift ×4
xcode ×3
autolayout ×1
css ×1
height ×1
html ×1
ip-address ×1
iphone ×1
llvm ×1
microphone ×1
nsdate ×1
objective-c ×1
public ×1