草庐IT

global-required

全部标签

ios - `Protocol can only be used as a generic constraint because it has Self or associated type requirements` 问题

我正在尝试生成一个符合协议(protocol)Protocoling的ViewModel,该协议(protocol)是通用的,并且具有关联的类型。有几个ViewModel符合协议(protocol),所以我正在尝试为viewModel创建一个工厂。我在Swift中遇到了以下错误:Protocol只能用作泛型约束,因为它有Self或关联类型要求示例代码:protocolProtocoling{associatedtypemodulingTypevardata:modulingType{get}}enumMyTypes{casemyNamecasemyAddress}classNameVi

ios - 使用 Swift 时出现错误 "nil requires a contextual type"

我想在代码中实现以下目标:classMyService{letmySubject=BehaviorSubject(value:nil)//....}不幸的是,我收到“nil需要上下文类型”错误。在我真正把东西放在那里之前,我希望这个主题是“空的”。那么我怎样才能将nil作为参数传递呢?我可以将它转换为我自己的类型以使其工作吗? 最佳答案 基于referenceforRxSwiftBehaviorSubject,init(value:)初始化器声明为publicinit(value:Element)其中value参数描述为:value

ios - 自定义 UIControl 中的帧大小和 'required init(coder: NSCoder)'

我有一个自定义UIControl,我实现为:requiredinit(coder:NSCoder){super.init(coder:coder)initSubComponents()}funcinitSubComponents(){//DisplayUIControlborderforvisualdebuggingself.layer.borderColor=UIColor.redColor().CGColorself.layer.borderWidth=3.0subviewContainer=UIView(frame:self.bounds.rectByInsetting(dx:0

objective-c - "frameworkname"中的通用类 -Swift.h 在 Xcode 6.3 中导致 "Type name requires a specifier or qualifier"错误

我更新到Xcode6.3,我的工作区中有两个独立的项目(一个是框架)。现在,Xcode自动生成了这个“frameworkname”-Swift.h头文件,但是当我有一个通用类作为属性时,它会生成以下行:@classPresentation;SWIFT_CLASS("_TtC13BusinessLogic31MeetupDetailViewControllerModel")@interfaceMeetupDetailViewControllerModel:NSObject@property(nonatomic)/*RsvpStore*/anRsvpStore;@end在Objective

ios - 更新到 XCode 6.3 (Swift 1.2) 后出现 "Objective-C method conflicts with optional requirement method"错误

我在我的应用程序中使用GoogleMapsiOSSDK,直到今天一切都运行良好。我已经下载了Xcode6.3并遇到了一些错误。整理了所有这些,除了我的MapViewController类中的两个错误,在这两个方法上弹出:第一种方法:funcmapView(mapView:GMSMapView!,didTapMarkermarker:ExtendedMarker!)->Bool{...somecode...}错误:Objective-Cmethod'mapView:didTapMarker:'providedbymethod'mapView(:didTapMarker:)'conflic

swift - EXC_BAD_INSTRUCTION 在 ios 7(swift) 上使用 dispatch_get_global_queue 时发生

letdownloadGroup=dispatch_group_create()varimages=[UIImage]()varerrors=[NSError]()dispatch_apply(UInt(urls.count),dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0)){(i)indispatch_group_enter(downloadGroup)SimpleCache.sharedInstance.getImage(urls[Int(i)],completion:{(image,error)->()inifletfu

ios - 项目中 Xcode 生成的 missing required module 'SwiftShims' 错误

我在运行状态下复制了我的项目,但复制的项目对我不起作用,尽管实际项目运行良好。当我构建复制的项目时,出现以下错误:我已经清除了缓存和派生数据,但构建仍然失败。有谁知道可能导致此问题的原因是什么?提前致谢。 最佳答案 如果您使用的是CocoaPods,请打开yourProject.workspace而不是yourProject.xcodeproj。 关于ios-项目中Xcode生成的missingrequiredmodule'SwiftShims'错误,我们在StackOverflow上找

java - JAXB - 来自 XmlAttribute 的标志 'required' 在原始类型上被忽略

我在尝试使用JAXB库中的schemagen工具为我的项目生成架构时遇到了一些问题。问题是注释@XmlAttribute没有被正确解析。-src-teste-entity因此,问题是对于某些类,XmlAttribute中的标志required被schemagen任务完全忽略。我将在此处粘贴一些类示例和生成的模式,以便您了解发生了什么packageteste.entity;importjavax.xml.bind.annotation.XmlAttribute;publicabstractclassClass2{@XmlAttribute(required=false)publicStr

java - "Required filename-based automodules detected."警告是什么意思?

在我的多模块项目中,我只为几个模块创建了module-info.java。在使用maven-compiler-plugin:3.7.0编译期间,我收到下一个警告:[WARNING]*Requiredfilename-basedautomodulesdetected.Pleasedon'tpublishthisprojecttoapublicartifactrepository!*这是什么意思?那是因为我只有几个模块带有module-info.java而不是整个项目吗? 最佳答案 自动模块回顾显式模块(即带有module-info.j

java - IntelliJ/Android -> 案例 R.id.viewId 上的 "java: constant expression required"

当我尝试在IntelliJ中构建我的Android项目时,我在每个switch语句中都遇到了错误,这些语句使用了R.java中的Id。例子:switch(item.getItemId()){caseandroid.R.id.home:NavUtils.navigateUpTo(this,DashboardActivity.upIntent(this));returntrue;caseR.id.orders_options_add:handleAddItem();returntrue;caseR.id.orders_options_reorder:handleReorder();fini