小编pic*_*ano的帖子

实时麦克风声级监控

我正试图通过麦克风实时访问音量数据.我尝试过AVAudioPlayer,但它只监视来自mp3之类的声音,而不是麦克风.我也尝试了The SpeakHere应用程序,但事实证明用所有Objective C++语法(我是新手)理解起来要困难得多.是否有另一个类似于SpeakHere中的类,但仅在Objective C中编写?

iphone microphone ios

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

如何在iOS中使用ECC

在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)

elliptic-curve ios

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

如何在NSDate变量中只设置时间?

我有NSDate变量,只想改变时间(不应该更改日期).可能吗 ?

例如:用户在DatePicker日期选择日期间隔(如果是开始日期我想将时间设置为00:00:00,如果是结束日期,我将时间设置为23:59:59)

感谢你的帮助.

问候,亚历克斯.

nsdate ios

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

目前是否可以将SWIFT交叉编译为另一个平台

由于LLVM,可以实际编译SWIFT代码以在另一个平台上使用.

当然你不能使用仅限Apple的库,但只是为了通用代码,LLVM是否支持这一点,即使Apple不支持它?

cross-platform llvm swift

10
推荐指数
0
解决办法
3418
查看次数

如何在Xcode游乐场中使用自动布局约束显示视图?

我试图在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)

xcode ios autolayout swift swift-playground

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

为什么我的Xcode控制台出现"握手失败"错误?

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 ios swift

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

如何获取设备的公共IP地址

我找到了这个示例代码来获取所有本地IP地址,但我找不到一个简单的解决方案来获取公共IP.

来自Apple 的传统课程允许这样做...但它的遗产......

public objective-c ip-address ios

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

如何解决"错误:无法读取应用程序的Info.plist(无法加载DVTFilePath的信息字典)"

我正在使用Xcode版本7.1.1(7B1005)

我正在尝试构建的iOS应用程序是通过复制现有的Mac版本的应用程序,并更改相关的目标操作系统设置而生成的.我在成功使用其他应用程序之前完成了此操作,没有任何重大问题.但是,此应用程序的Info.plist文件(直接从工作应用程序复制)可能会导致某种问题.

  • iOS版本的Xcode Build Settings中的"Info.plist文件"设置被设置为正确的路径.如果我将它设置为非工作路径,我会得到一个不同的错误(ProcessInfoPlistFile报告错误)
  • 我检查了构建的应用程序包,它确实包含一个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)

xcode ios

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

iOS Chrome计算出错误的文档高度

为了填充整个页面的高度,我使用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

重现步骤:

在以下情况下,页面将自行修复:

  • 更新页面
  • 将设备旋转到横向
  • 通过标签打开和关闭浏览器的导航
  • 关闭并重新打开浏览器,而无需在多任务导航中将其关闭

为什么会发生?如何解决此问题?

先感谢您!

html css height google-chrome-app

9
推荐指数
1
解决办法
122
查看次数

在字符串插值中使用选项时,内存泄漏

我在使用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 swift

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