jjzjj

dateByAddingComponents

全部标签

ios - dateByAddingComponents :toDate:options return nil? 什么时候

我一直在使用dateByAddingComponents:toDate:options:和dateByAddingUnit:value:toDate:options:并使用可选绑定(bind)从中获取日期。像这样:guardletstartOfNextMonth=calendar.dateByAddingComponents(oneMonthComponent,toDate:startOfThisMonth,options:[])else{returnnil}其中oneMonthComponent只是一个月份值设置为1的NSDateComponent。当我读到它时,在文档中他们都说了类