我想要具有以下浮点值的整数值:
var floatingPointValue = NSDate().timeIntervalSince1970 * 1000
Run Code Online (Sandbox Code Playgroud)
我不在乎这个浮点数的整数值实际上是整数还是字符串.
嗨,我正在开发一个播放和录制的应用程序,我想知道是否可以使用带有AVAudioSessionCategoryMultiRoute的蓝牙设备,如果答案是肯定的,如何从内置麦克风和蓝牙麦克风等iphone两个设备进行录制?因为我找不到任何教程或示例来执行此操作.
我正在开发适用于iOS 8.1的iphone应用程序,它可与核心音频配合使用以生成频率并调整强度.在我生成频率的视图控制器中我需要控制耳机是否在某个时刻拔出,我已经控制了耳机是否已连接,然后使用以下功能进入我的频率发生器视图:
- (BOOL)isHeadsetPluggedIn {
AVAudioSessionRouteDescription* route = [[AVAudioSession sharedInstance] currentRoute];
for (AVAudioSessionPortDescription* desc in [route outputs]) {
if ([[desc portType] isEqualToString:AVAudioSessionPortHeadphones])
return YES;
}
return NO;
}
Run Code Online (Sandbox Code Playgroud)
这个功能在C中,因为我正在使用core-audio来生成频率,但是在视图控制器中使用swift所以需要一种方法来实现一个监听器来检测耳机插件事件并返回给用户以前的观点,我不知道我是否可以使用我的函数isHeadsetPluggedin()与事件监听器或我应该创建一个新的.在我的MenuViewController中,我控制是否使用以下功能插入耳机:
func isHeadsetPluggedIn() -> Bool {
return freqController.isHeadsetPluggedIn();
}
Run Code Online (Sandbox Code Playgroud) 我正试图UIKeyboardWillShowNotification在键盘出现时实现一个处理我的视图位置.我加上我的观察者:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow", name: UIKeyboardWillShowNotification, object: nil)
Run Code Online (Sandbox Code Playgroud)
然后我有这个keyboardWillShow功能:
func keyboardWillShow(notification: NSNotification){
//Need to access to the notification here
}
Run Code Online (Sandbox Code Playgroud)
在keyboardWillShow我需要接收的函数中,NSNotification以获取对用户信息的访问权限,但是我收到此错误:
"无法识别的选择器发送到实例0x7fd993e7d020"