草庐IT

attribute_exists

全部标签

swift - Xcode 11 测试版和 Mac OS Mojave : when I try to create a new project and/or open existing one it closes down with error

我刚刚在我的Mac上下载了Xcode11beta。当我尝试创建一个新项目和/或打开现有项目时,它因错误而关闭附言这是来自“问题报告”:Process:Xcode[1445]Path:/Applications/Xcode-beta.app/Contents/MacOS/XcodeIdentifier:com.apple.dt.XcodeVersion:11.0(14855.18)BuildInfo:IDEFrameworks-14855018000000000~13CodeType:X86-64(Native)ParentProcess:???1Responsible:Xcode[14

ios - swift : Append Characters in Attributed String

我想改变字符串中所有字符的颜色。但是我的代码只给出了字符串中的最后一个字符。我想在属性字符串中append字符。我该怎么做?我的代码:functest(){varstr:String="teststring"foriin0...count(str)-1{vartest=str[advance(str.startIndex,i)]varattrString=NSAttributedString(string:toString(test),attributes:[NSForegroundColorAttributeName:rainbowColors()])label.attributed

ios - 当我尝试在函数前添加 private 时,Xcode 报错 "attribute private can only be used in a non local scope"

当我尝试在函数前面添加private时,xcode提示“属性private只能在非本地范围内使用”。我认为“私有(private)”应该用于您想要保留本地权利的事情?有人可以告诉我如何处理错误消息吗?我仍然想将函数保密。 最佳答案 我是通过搜索这个错误attributeprivatecanonlybeusedinanonlocalscope到这里的。在我的例子中,这是由switch语句末尾缺少右括号引起的。希望这对某人有帮助。 关于ios-当我尝试在函数前添加private时,Xcode

ios - 无法通过在 <My App> 中打开共享表 : no file at the provided file URL exists 从 iOS 文件应用程序打开文件

我的iOS应用程序可以打开CSV文件,以便导入它们的数据。我可以通过UIDocumentPickerViewController从应用程序中打开文件,没有任何问题,选择文件应用程序中显示的文件。但是,当首先在"file"应用程序中查看文件,然后从那里打开我的应用程序(通过“打开方式”共享表)时,我的应用程序无法在传递给我的应用程序的URL上看到该文件。该文件似乎不存在。我将以下调试代码添加到我的AppDelegate中:funcapplication(_app:UIApplication,openurl:URL,options:[UIApplication.OpenURLOptions

ios - 如何检查方法 systemFontOfSize(fontSize : weight:) exist in iOS

我的应用程序部署目标是iOS7.0我想在装有iOS8+的设备上使用方法systemFontOfSize(fontSize:weight:)。iOS7不支持此方法(使用weight:参数)并且我的应用程序崩溃了。特别是对于iOS7,我想设置HelveticaLight字体而不是SystemFontLight。检查它的最佳方法是什么?我需要检查iOS版本还是可以检查方法?怎么办?我用swift并试过ifletfont=UIFont.systemFontOfSize(12,weight:UIFontWeightLight)或respondsToSelector方法。它对我不起作用。

ios - NSLayoutConstraint 没有成员 'Attribute'

我正在尝试转换下面的swift代码NSLayoutConstraint.Attribute.height我正在使用SkeletonView,它在执行时抛出错误。我找不到那个新的替换语法类型“NSLayoutConstraint”没有成员“Attribute” 最佳答案 这完全取决于您使用的Swift版本。NSLayoutConstraint.Attribute.height//Swift4.2NSLayoutAttribute.height//Swift3.0+NSLayoutAttributeHeight//Swift2?

ios - 由于未捕获的异常 'NSInvalidArgumentException' 而终止应用程序,原因 : Unknown layout attribute'

我正在尝试以编程方式向UIView中的按钮添加约束:letconstraint=NSLayoutConstraint(item:arrowButton,attribute:NSLayoutAttribute.LeadingMargin,relatedBy:NSLayoutRelation.Equal,toItem:self,attribute:NSLayoutAttribute.NotAnAttribute,multiplier:1,constant:10)arrowButton.addConstraint(constraint)我希望按钮的前边距距离View的左边距为10。此代码在V

swift - 核心数据 : How do I store a custom object as a transformable attribute?

目前我有一个名为Place的类定义如下:classPlace{letname:Stringletaddress:Stringletcoordinate:CLLocationCoordinate2Dlettype:StringvarphotoReference:String?varphoto:UIImage?/*functionsetc*/}在我的数据模型中,我有一个名为FoundPlaces的实体。它有一个属性place,类型为“transformable”。我快要发疯了,试图找到存储此对象的Swift解决方案。开头的数据模型是不是错了?任何指导表示赞赏。谢谢!

ios - 当 snapshot.exists() 返回 false 时怎么办?

我有一个ref,我使用observeEventType来查询数据。但由于用户删除,ref中可能没有数据。我使用snapshot.exists()测试它。在下面的情况下snapshot.exists()将返回false/no。因为它是假的,所以我想做点别的,但代码永远不会运行当snapshot.exists()返回false/no时,我该如何做其他事情?//thereisnodataatlevelTwosothere'snothingtoobserveletlevelTwoRef=dbRef.child("players").child("uid").child("levelTwo")l

swift - Vapor PostgreSQL 错误 : invalidSQL ("ERROR: relation\"pages\"already exists\n")

我正在尝试使用Vapor命令还原PostgreSQL数据库:vaporrunprepare--revert-y我把这个放出来了:Runningmist...Areyousureyouwanttorevertthedatabase?y/n>yesRevertingPostRevertedPostRemovingmetadataReversioncomplete如果您想知道,我已尝试多次执行此操作,所以Post类已准备好,但其他类没有。此命令恢复所有模型的表,除了一个(总共有四个)。由于某些原因,“页面”表不会恢复。当我在还原数据库后尝试运行应用程序时,出现此错误:invalidSQL("