草庐IT

nly-work

全部标签

ios - AVAudioSession : Some Bluetooth devices are not working properly on my App

我正在使用AVAudioSession开发一个快速的音频/视频和文本聊天iOS应用程序。每当我选择使用某些蓝牙设备时,设备上播放的声音不是App音频流。每当发送/接收消息时,它们只播放文本聊天库发送的系统声音。它不会在所有蓝牙设备上发生,在其中一些设备上一切正常。在内置麦克风和扬声器上,该应用程序也能正常工作。以下是我类用于管理设备的最重要的方法:classMyAudioSession{privatevarmAudioSession:AVAudioSession;init!(){self.mAudioSession=AVAudioSession.sharedInstance();do{

ios - swift 4 : UITableView dataSource isn't working

我正在尝试向UITableView对象添加一些数据。我的问题是在运行时没有调用我的数据源对象中的任何方法。我已经检查过UITableView本身是否显示。当我调用providerTable.reloadData()只是numberOfSections(intableView:UITableView)->Int和tableView(_tableView:UITableView,numberOfRowsInSectionsection:Int)->Int方法被调用,但从不调用tableView(_tableView:UITableView,cellForRowAtindexPath:Ind

iOS 8 : Autorotation is not working without storyboard

所以我试图开始一个没有Storyboard的项目,但我似乎无法弄清楚为什么UIWindow没有将自动旋转命令传递给RootViewController。使用Storyboard,自转有效。如果我以编程方式创建窗口,则自动旋转不起作用。这就是我在AppDelegate中实例化窗口的方式:window=UIWindow(frame:UIScreen.mainScreen().bounds)ifletwindow=window{window.backgroundColor=UIColor.whiteColor()window.makeKeyAndVisible()letnc:SignInVi

ios - xcodebuild no such module 'SwiftyJSON' while build in xcode works

在我的项目中,我使用的是CocoaPods,podfile如下所示:defshared_podsuse_frameworks!pod'SwiftyJSON','~>3.1.4'pod'Alamofire','~>4.3.0'pod'PromiseKit','~>4.4'endtarget'myop'doshared_podsend通过xcode构建工作正常,但如果我尝试通过命令行(xcodebuild工具)构建,我会收到以下错误:error:nosuchmodule'SwiftyJSON'importSwiftyJSON我尝试重新安装SwiftyJSON并将其升级到新版本。还尝试手动将

ios - 自动布局 : Update constraints on UICollectionViewCell doesn't work

我在尝试更新collectionViewCell上的UILabel约束时遇到问题。我的原型(prototype)单元看起来像:我的目标是:我需要编辑红色标签顶部约束的常量,具体取决于我是否隐藏绿色标签。我是如何进行的?我为红色标签(带有红色箭头的标签)上的约束添加了一个IBoutlet:@IBOutletweakvardescriptionTopToPrice:NSLayoutConstraint!然后:descriptionTopToPrice.constant=2self.contentView.setNeedsUpdateConstraints()但它不起作用,并且约束不更新。我

swift - 类型(: ) in Swift 3 does not seem to work with the is type check

这个问题在这里已经有了答案:Swiftdynamictypecheckingforstructs?(2个答案)关闭6年前。type(of:x)在Swift3中似乎不适用于is类型检查它只是给出了这个错误信息:Consecutivestatementsonalinemustbeseparatedby';'代码示例:classTest:UIViewController{}lettest=Test()lettest2=Test()letisEqual=test2istype(of:test)//thisdoesnotcompile这里有什么问题?如何在Swift3中进行这样的动态类型检查?

iOS 9 : Gesture Recognizer was setup in a storyboard/xib to be added to more than one view (not working)

使用iOS9并遇到UITapGestureRecognizer问题。我有一个带有UITableView的ViewController-A。我添加了一个带有textLabel的tableViewCell。我想在textLabel上实现点击。因此,如果我点击textLabel——它应该在控制台上打印或执行任何其他操作问题:TapRecogniser不工作。出现以下错误:以下是我所做的:1)在textLabel(来自StoryBoard)上添加了一个“UITapGestureRecognizer”。为textLabel启用了用户交互(现在仍然是错误)2)下面是IBAction:@IBActi

swift - 值(forKey :) for NSObject not working in Swift 4

在Xcode9Beta中试用Swift4。由于某些原因,在NSObject上使用键值访问器时我遇到了崩溃。有什么想法吗?importCocoaclassPerson:NSObject{varname=""varage=0}letalpha=Person()alpha.name="Robert"alpha.age=53alpha.value(forKey:"name")//error:Executionwasinterrupted,reason:EXC_BAD_INSTRUCTION(code=EXC_I386_INVOP,subcode=0x0). 最佳答案

ios - Swift 泛型 : IntegerType Version Works But Not FloatingPointType

我使用Swift泛型输入了两个版本的离散卷积算法。整数版本有效。但是浮点版本有乘法的问题:importFoundationimportSwiftfunclinconv(signal_Asignal_A:[T],signal_B:[T])->[T]?{//guardguardsignal_A.isEmpty==false&&signal_B.isEmpty==falseelse{returnnil}//reverseatleastoneofthearrays//letsignal_A_reversed=Array(signal_A.reverse())//sizeofnewarrayle

ios 网址(字符串 : ) not working always

lettesturl="http://akns-images.eonline.com/eol_images/Entire_Site/2018029/rs_1024x759-180129200032-1024.lupita-nyongo-angela-bassett-black-panther-premiere.ct.012918.jpg?fit=inside|900:auto"ifleturl=URL(string:testurl){print("valid")}else{print("invalid")}这将打印为无效的URL。但在网络浏览器中显示图像。我见过很多方法,但它会抛出Ap