草庐IT

OBJ_FILES

全部标签

swift - 无法将 Swift 4 字符串传递给 Obj-C++ -[_SwiftValue dataUsingEncoding :]: unrecognized selector sent to instance

我有一些像这样的Objective-C++代码://header@interfaceMyObjcClass-(void)myMethod:(NSString*)text;@end//implementation@implementationMyObjcClass-(void)myMethod:(NSString*)text{someInternalObject->useWstring(nsStringToWstring(text))}std::wstringnsStringToWstring(constNSString*text){NSData*data=[textdataUsingE

ios - 无法从 swift 访问 objective-c 方法。桥接设置和 obj-c 类实例化

这是我的第一个IOS应用程序,到目前为止一切顺利。我的代码在Swift中,我需要在我的应用程序中使用Obj-C中的GoldRaccoonFTP库:https://github.com/albertodebortoli/GoldRaccoon我导入了GoldRaccoon文件并创建了bridgeheader。您使用的主要类是GRRequestsManager,我可以在正在运行的应用程序中成功实例化它。但是,我无法访问该类中的addRequestForUploadFileAtLocalPath方法。我最初只是在桥文件中有GRRequestsManager.h导入语句。由于它继承了GRReq

从 Obj-C 类继承的 Swift 中的 iOS 错误转换对象

我们在从Swift类中的ObjectiveC类继承时发现了项目中的问题ViewController.m@implementationViewController+(ViewController*)getObj{ViewController*obj=[[SwiftControlleralloc]init];returnobj;}SwiftController.swiftclassSwiftController:ViewController{}当测试代码时,以下测试失败classTest:XCTestCase{functestFails(){letobj=ViewController.ge

ios - 为什么 Obj-C 属性默认所有权为 "assign"而不是 "strong"

我正在向旧项目添加Swift类。一切顺利,直到我尝试向Swift类添加一个属性。生成的header无法编译。我认为问题在于,在生成的代码中,Swift省略了strong所有权,仅将其声明为nonatomic。这通常应该足够了,因为@property应该默认为strong所有权,对吧?所以基本上这些是等价的:@property(nonatomic)NSDate*aDate;@property(nonatomic,strong)NSDate*aDate;但是,在我的例子中,根据编译器消息,它似乎默认为assign而不是strong。我正在使用Xcode6GM,并且该项目已打开ARC。知道为

objective-c - 从 Obj C didSelectionRow 调用 Swift ViewController

我有一个ObjC项目,我添加了一个SwiftviewController。我正在尝试将Storyboard附加到viewController。我可以通过编程方式向View中添加内容,但无法显示Storyboard。我也曾尝试使用xib作为SwiftviewController的竞争,但没有成功。从didSelectRowAtInexPath调用Swiftvie表单ObjC:SwiftController*sc=[[SwiftControlleralloc]init];[self.navigationControllerpushViewController:scanimated:YES]

ios - 为 Swift/Obj-c 项目运行 XCTest 时出错(错误 83)

尝试为我的Swift/Obj-c应用程序运行测试时出现以下错误:2016-02-0700:02:26.752xctest[3275:115122]Thebundle“MyAppTests”couldn’tbeloaded.Tryreinstallingthebundle.2016-02-0700:02:26.752xctest[3275:115122](dlopen(/Users/raphaelcruzeiro/Library/Developer/Xcode/DerivedData/MyApp-bjdolynlskqvavgryvznzbluqele/Build/Products/De

objective-c - 在 Swift 中使用 Obj-C 完成 block

在Objective-C中,我有一个完成block类定义为:文件.htypedefvoid(^MYCompletionBlock)(BOOLsuccess,NSDictionary*result,NSError*error);然后,在Swift文件中,我尝试按如下方式使用完成block:Swift.swiftclassMyClass:NSObject{...funcMyFunction()->Void{...objcMethod(param1,withCompletion:{(MYCompletionBlock)->Voidinif(success){//Error:"Useofunr

ios - Swift iOS 构建期间的 "clang: error: cannot specify -o when generating multiple output files"

我刚刚使用CocoaPods为我的SwiftiOS项目安装了一个额外的依赖项(HockeyAppSDK),现在我的项目在构建过程中失败并给出错误:clang:error:cannotspecify-owhengeneratingmultipleoutputfiles我卸载了依赖项,但项目在构建过程中仍然失败并出现相同的错误。有想法该怎么解决这个吗?编辑:使用xcodecli构建时,错误如下所示:2015-07-2420:28:09.378xcodebuild[34313:1668414]流错误:偏移量29处的流错误:由不受支持的XCDependencyGraph构建创建以下构建命令失败

ios - 银联银行 : Prevent backup files on iCloud

如何在我的应用程序中阻止iCloud备份。为此,我尝试使用NSFileManager。和如何在Swift中实现addSkipBackupAttributeToItemAtURL?ItriedwiththisstuffextensionNSFileManager{funcaddSkipBackupAttributeToItemAtURL(url:NSURL)->Bool{varerror:NSError?letsuccess:Bool=url.setResourceValue(NSNumber.numberWithBool(true),forKey:NSURLIsExcludedFrom

ios - 适用于 iOS 的 AWS 开发工具包 : unable to list the files in an S3 bucket

我遵循了第一步here配置凭据和S3存储桶。然后,在我的代码中,我有:funcsetupCredentialsProvider(){letcredentialsProvider=AWSCognitoCredentialsProvider(regionType:.USEast1,identityPoolId:identityPoolIdStr)letconfiguration=AWSServiceConfiguration(region:.USEast1,credentialsProvider:credentialsProvider)AWSServiceManager.defaultSe