草庐IT

show-name

全部标签

ios - swift : println() doesn't show anything into "View Device Logs" in "Devices" tab

我正在开发应用程序,当应用程序使用AdHoc配置文件运行时,我需要在其中获取devicetoken。因为我无法使用AdHoc配置文件进行调试。我需要查看使用println()打印设备token的日志。但是,我没有表现出任何东西。 最佳答案 最后,我得到了解决方案。我们还可以将NSLog()用户使用到swift代码中。所以,在我们想要打印日志的地方,你可以使用NSLog()函数。例子,funcapplication(application:UIApplication,didRegisterForRemoteNotificationsW

swift - 为什么 NSImage.Name 存在?

我不明白为什么要创建UIImage我只是在构造函数中传递String但为了创建NSImage我必须传递构造函数中的NSImage.Name。这个解决方案背后的想法是什么?代码:iOSletimage=UIImage(named:"name")Mac操作系统letimage=NSImage(named:NSImage.Name("name"))谢谢。 最佳答案 期望您有一个集中的位置,您可以在其中使用定义所有图像名称的静态常量扩展NSImage.Name。然后,您的所有代码都引用这些单个成员,而不是重复魔术字符串。extensionN

ios - XCode6 Beta 中的编译器警告 - “Shorthand External Parameter Names”

我在Xcode6Beta上玩Swift,当我在函数定义“#”中使用时,就像在苹果的Swift编程指南中一样,我收到以下编译器错误:参数中的无关“#”:“characterToFind”已经是关键字参数名称//thiscodeisacopy-pastecodefromapple'sSwiftlanguageprogramingguidefunccontainsCharacter(#string:String,#characterToFind:Character)->Bool{forcharacterinstring{ifcharacter==characterToFind{returnt

ios - UIAlertController 的 UIAlertView show() 行为

在以前的iOS版本中,我可以在AppDelegate的UIAlertView上调用show。更具体地说,show被调用于:funcapplicationDidBecomeActive(application:UIApplication)由于UIAlertView在大多数情况下忽略了View层次结构,因此无论用户在应用程序中的哪个位置,此解决方案都有效。随着UIAlertController的引入,这个问题变得有点棘手了。UIAlertController现在是UIViewController的子类,需要像任何其他UIViewController一样呈现。从keyWindow的rootV

ios - 当我在控制台中引入 pod install 时,出现错误 (NoMethodError - undefined method `to_ary' for #<Pod::Specification name ="Parse">)

我正在尝试将pod安装到我的项目文件夹中,但此错误继续出现。NoMethodError-#的未定义方法“to_ary”我无法运行我的iOS应用程序来尝试解析和我的应用程序之间的连接。预先感谢您的帮助。 最佳答案 这个问题特别是在使用ruby-2.3.0版本时出现,查看以下link有关更多信息。请按照以下说明修复执行podinstall或podupdate时收到的错误消息:卸载CocoaPodsgemuninstallcocoapods安装ruby​​-2.2.1:rvminstall2.2.1设置之前安装的ruby-2.2.1版本为

处理 Code:516. Authentication failed: password is incorrect or there is no user with such name.

 在测试ClickHouse分布式表时,创建分布式表成功,但是查询数据时报错,如下:Receivedexceptionfromserver(version22.2.2):Code:516.DB::Exception:Receivedfrom192.168.38.101:9000.DB::Exception:Receivedfrom192.168.38.103:9000.DB::Exception:default:Authenticationfailed:passwordisincorrectorthereisnouserwithsuchname.(AUTHENTICATION_FAILED)排

Error creating bean with name ‘esUtils‘ defined in file

 报错异常: 背景:esUtils在common服务中、启动media服务时候、报这个异常、后排查esUtils在启动时候发生异常引起的、在相关bean中加入try{}catch{}即可解决问题String[]split=url.split(",");HttpHost[]httpHosts=newHttpHost[split.length];try{if(split.length>0){for(inti=0;ihttpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider)).build();client=new

swift - NS_SWIFT_NAME 用于将 C 函数导入为类扩展

我有两个C函数:externUIColor*LNRandomDarkColor();externUIColor*LNRandomLightColor();作为练习,我尝试将它们作为UIColor的扩展方法导入到Swift中。以下是Apple在WWDC2016上的“Swift新功能”演示文稿示例:voidCGContextFillPath(CGContextRef)NS_SWIFT_NAME(CGContext.fillPath(self:));我试图以类似的方式注释我的函数:externUIColor*LNRandomDarkColor()NS_SWIFT_NAME(UIColor.r

ios - UITabbarItem : - Downloaded image does not show up at Tabbar Item.

我正在从服务器获取json响应中的图像url,并使用下载正常的SdWebimage框架下载图像。但是当我将这个下载图像对象设置为tabbaritem时,它不显示图像而是在那里显示灰色方框。此外,尝试将图像大小调整为30*30像素,通过将图像url放入浏览器来检查url中的图像。我用来将图像设置为tabbaritem的代码......myImgView.sd_setImageWithURL(url!,placeholderImage:pImage,options:.HighPriority,completed:{(image,error,cahce,url)intabbarItem.im

objective-c - Objective-C 有对应的 CF_SWIFT_NAME() 吗?

有没有办法固定在Swift中为Objective-C实现的方法的名称?一个Swift方法staticfuncconvert(foo:Foo)->Bar在Objective-C中变为+(Bar*)convertWithFoo:(Foo*)foo;当一个想要的名字是+(Bar*)convertFoo:(Foo*)foo;//without`With`从Objective-C到Swift,我会使用CF_SWIFT_NAME()或NS_SWIFT_NAME()宏。 最佳答案 是的,您可以使用@objc属性实现:@objc(convertFo