草庐IT

more-private

全部标签

ios - 无法将新创建的 cocoa pod 添加到私有(private) pod 规范

我正在学习以下教程-HowtoCreateaCocoaPodinSwift.我卡在了最后一步-使用你的新CocoaPodYoufirstneedtoaddyourPodspectoaprivatespecsrepo;thisletsCocoaPodsfindthepodwhenyoutrytoinstallit.Fortunately,you’vealreadycreatedaGitrepoforthis,sothisfinalstepisrelativelystraightforward.EnterthefollowinginTerminal,makingsureyou’restil

ios - "type of expression is ambiguous without more context"- 引用 appDelegate

我的appDelegate最初是用Obj-C编写的。我试图在一个新的Swift类中访问它,但我遇到了一个我认为具有误导性的奇怪错误,我正试图找到根源。在我的Swift文件中,我在以下位置设置了一个断点:varappDelegate=UIApplication.sharedApplication().delegate如果我只是po:poappDelegate我得到:PrintingdescriptionofappDelegate:Optional()一切都很好。但是,当我尝试:poappDelegate.navigationController在调试控制台中我得到:error::1:13

swift - 如何使用 Swift 的私有(private) iOS 框架?

我想通过Swift应用在iOS上使用私有(private)框架。我很清楚为什么这是个坏主意,但它在测试期间会很有用,因此AppStore的限制不是问题,我已经非常详尽地研究了替代方案。我想做的是类似这样的事情:dlopen("/Developer/Library/PrivateFrameworks/UIAutomation.framework/UIAutomation".fileSystemRepresentation,RTLD_LOCAL);leteventsclass=NSClassFromString("UIASyntheticEvents")as?UIASyntheticEve

swift - Swift 中的好友类(访问内部类的私有(private)成员)

我在两个不同的文件中有两个Swift类,它们都在同一个目标中。有没有一种方法可以让一个人访问另一个人的private成员,而不会将他们暴露为internal或public?(我本质上是在寻找类似于C++中的friend的东西。)动机:这对于在单独的“转换”类中实现UIViewControllerAnimatedTransitioning之类的东西很有用——通常需要对源ViewController和目标ViewController有深入的了解——而不需要这些ViewController公开privatesubview到目标的其余部分。 最佳答案

ios - 在 Swift 中将外部框架嵌入到自制的私有(private)框架中

我使用Xcode6和Swift构建了一个框架,我的框架使用SwiftyJSON作为依赖-通过Carthage添加.我存档了我的框架,并使用lipo创建了一个适用于模拟器和iOS设备的构建,当我尝试将我的框架用于一个空应用程序时,我在运行时遇到了崩溃:dyld:Librarynotloaded:@rpath/SwiftyJSON.framework/SwiftyJSONReferencedfrom:/Users/hd/Library/Developer/CoreSimulator/Devices/324FD1CD-4A06-459B-AE6D-318197B5697E/data/Cont

ios - swift 2 : Type of expression is ambiguous without more context

classExample:NSObject,UIViewControllerAnimatedTransitioning,UIViewControllerTransitioningDelegate{varaView:UIView!UIView.animateWithDuration(duration,delay:0.0,usingSpringWithDamping:0.8,initialSpringVelocity:0.8,options:nil,animations:{self.aView.transform=CGAffineTransformIdentity//Thislineist

ios - “type of expression is ambiguous without more context” 使用结构属性作为字典键

我得到异常:typeofexpressionisambiguouswithoutmorecontext使用以下代码:structParameter{staticletEmail="email"staticletPassword="password"staticletIsFacebookUser="isFacebookUser"}letparameters:[String:AnyObject]=[Parameter.Email:email,Parameter.Password:password,Parameter.IsFacebookUser:false]它不接受bool类型,我不想更改

ios - YouTube - 下载/播放私有(private)视频

我的iOS应用将包含私有(private)视频和公共(public)视频,用户可以购买私有(private)视频。现在我正在使用YouTube和youtube-ios-player-helperlibrary用于视频托管。加载公共(public)视频非常容易:playerView.loadWithVideoId("M7lc1UVf-VE")但是你如何以最简单的方式为私有(private)视频做到这一点?有没有像这样简单的东西:letplayerVars=["username":username,"password":password,]playerView.loadWithVideoI

swift - 在 Swift 3 中, 'private class Foo' 和 'fileprivate class Foo' 在成员变量方面有区别吗?

特别是关于成员变量,Swift3中的以下内容有区别吗?在这两种情况下,同一个文件中的所有代码都可以访问Foo。隐式作用域的“laa”属性也是如此,这似乎与文档相矛盾。Ifyoudefineatype’saccesslevelasprivateorfileprivate,thedefaultaccesslevelofitsmemberswillalsobeprivateorfileprivate.但是,在下面的两种情况下,“laa”可以从同一文件中的其他类访问,这意味着它是文件私有(private)的,而不是文档所说的第一个应该是私有(private)的。privateclassFoo{

ios - private 与 fileprivate 在 Swift 3 中声明全局变量/常量?

我应该使用private还是fileprivate在Swift3中声明全局变量/常量?例如fileprivateleta=1fileprivateclassSomeClass{fileprivateb=0}或者privateleta=1privateclasssomeClass{fileprivateb=0} 最佳答案 在文件级别确实没有区别,无论你使用fileprivate的private,访问控制都是一样的,例如这样定义的常量将只可用在该文件中。对于其他修饰符也可以这样说,在某些情况下,internal和private变得相同,