IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等

转载自:http://blog.csdn.net/xunyn/article/details/12144937

 

IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等

分类: IOS开发   270人阅读  评论(0)  收藏  举报

IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等

    NSLog(@"uniqueIdentifier: %@", [[UIDevice currentDevice] uniqueIdentifier]);
    NSLog(@"name: %@", [[UIDevice currentDevice] name]);
    NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]);
    NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersion]);
    NSLog(@"model: %@", [[UIDevice currentDevice] model]);
    NSLog(@"localizedModel: %@", [[UIDevice currentDevice] localizedModel]);

 

NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];

 CFShow(infoDictionary);

// app名称

 NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];

 // app版本

 NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];

 // app build版本

 NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];


  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您好!要实现在 iOS App 上录音从蓝牙设备的麦克风获取,您需要进行以下步骤: 1. 在 info.plist 文件中添加蓝牙权限: - NSBluetoothPeripheralUsageDescription:描述了应用程序需要使用蓝牙的原因。 - NSMicrophoneUsageDescription:描述了应用程序需要使用麦克风的原因。 2. 创建一个 AVAudioSession 实例并设置它的类别为 AVAudioSessionCategoryRecord: ``` let audioSession = AVAudioSession.sharedInstance() do { try audioSession.setCategory(AVAudioSessionCategoryRecord) } catch { print("Failed to set audio session category.") } ``` 3. 设置 AVAudioSession 实例的输入源和输出源: ``` do { let bluetoothInputs = audioSession.availableInputs?.filter { $0.portType == AVAudioSessionPortBluetoothHFP || $0.portType == AVAudioSessionPortBluetoothA2DP } if let input = bluetoothInputs?.first { try audioSession.setPreferredInput(input) } try audioSession.setPreferredOutput(audioSession.currentRoute.outputs.first!) } catch { print("Failed to set audio session input and output.") } ``` 4. 初始化 AVAudioRecorder 对象并开始录音: ``` let audioURL = // Specify the URL where you want to save the recorded audio. let audioSettings = [AVFormatIDKey: Int(kAudioFormatMPEG4AAC), AVSampleRateKey: 44100, AVNumberOfChannelsKey: 2] do { let audioRecorder = try AVAudioRecorder(url: audioURL, settings: audioSettings) audioRecorder.prepareToRecord() audioRecorder.record() } catch { print("Failed to initialize audio recorder.") } ``` 这样就可以从蓝牙设备的麦克风录制音频了。希望对您有所帮助!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值