草庐IT

before_migrate

全部标签

ios - iPhone 核心数据 "Automatic Lightweight Migration"

我正在尝试更新实现核心数据存储的应用程序。我正在向其中一个实体添加一个属性。我将以下代码添加到我的委托(delegate)类中:-(NSPersistentStoreCoordinator*)persistentStoreCoordinator{if(persistentStoreCoordinator!=nil){returnpersistentStoreCoordinator;}NSURL*storeUrl=[NSURLfileURLWithPath:[[selfapplicationDocumentsDirectory]stringByAppendingPathComponent

flutter - 未处理的异常 : inheritFromWidgetOfExactType(_LocalizationsScope) or inheritFromElement() was called before _ScreenState. initState() 已完成

我正在调用初始方法以使用initState从API加载数据。但这导致我出错。这是错误:UnhandledException:inheritFromWidgetOfExactType(_LocalizationsScope)orinheritFromElement()wascalledbefore_ScreenState.initState()completed.Whenaninheritedwidgetchanges,forexampleifthevalueofTheme.of()changes,itsdependentwidgetsarerebuilt.Ifthedependentw

ruby-on-rails - Rails db:migrate:reset 产生 Errno::EACCES Permission denied @unlink_internal

我正在学习MichaelHartl的Rails教程,在某些时候我们要运行railsdb:migrate:reset但是,每次我尝试这样做时,我都会遇到有关文件的权限被拒绝的错误development.sqlite3我已经尝试过以下我遇到的解决方案:1.closeallprogramssuspectedofusingsaidfileandretrytask2.terminaterailsconsole,server,editorandretrytask3.shut/restartpcandexecutingthetaskuponrestart4.executingrailsdb:drop

java - 错误 : Make sure the Cursor is initialized correctly before accessing data from it?

我的游标初始化如下:@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);//...Code,code,code...c=db.query("US_States",null,null,null,null,null,null,null);}游标本身在同一Activity中的单独方法中使用:publicvoidGameStart(){intgameCount=0;while(gameCount它给了我以下错误:E/CursorWindow﹕Failedtorea

ruby-on-rails - $rake db :migrate An error has occurred, 这个和所有后来的迁移都被取消了

我是RoR的新手,我不断收到此错误消息:$rakedb:migrate==CreateUsers:migrating====================================================--create_table(:users)rakeaborted!Anerrorhasoccurred,thisandalllatermigrationscanceled:SQLite3::SQLException:table"users"alreadyexists:CREATETABLE"users"("id"INTEGERPRIMARYKEYAUTOINCREME

ios - swift : 'attempt to delete row 0 from section 0 which only contains 0 rows before the update'

为什么会出现此错误?我需要做什么?*Assertionfailurein-[UITableView_endCellAnimationsWithContext:],/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3600.8.1/UITableView.m:14422017-07-0620:25:30.736267-0400BlogApp[1482:340583]*Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason

ios - Swift - Coredata Migration - 根据旧属性值设置新属性值

我当前的核心数据实体之一-Entity1-有一个名为isSaved的Boolean属性。在新的核心数据模型中,我计划删除isSaved属性并添加一个名为type的新Int属性。对于所有保存的Entity1对象,我想根据旧核心数据模型中isSaved的值设置type的值。(例如,如果isSaved为真,则类型为1,否则类型为2)。我已经阅读了一些关于轻量级核心数据迁移的文章,但它们似乎都没有帮助。只是想知道是否有任何方法可以使我计划的迁移成功? 最佳答案 轻量级迁移做不到这一点。您必须创建映射模型和NSEntityMigrationP

swift - 'Use of self in method call before super.init initializes self',无法通过方法调用初始化属性

我很好奇在您的init方法中是否有调用方法来设置类的实例属性。本质上我只是有一个子类UIView的类,在init中添加了一些subview,其中一些subview是该类的实例变量。classMyView:UIView{varcollectionView:UICollectionViewconvenienceinit(){self.init(frame:CGRectZero)}overrideinit(frame:CGRect){super.init(frame:frame)addSubviews()}requiredinit(coderaDecoder:NSCoder){super.i

ios - swift : How to get the string before a certain character?

如何在swift中获取某个字符之前的字符串?下面的代码是我在ObjectiveC中的做法,但似乎无法在Swift中执行相同的任务。关于如何实现这一目标的任何提示或建议?rangeOfString似乎在swift中根本不起作用(尽管Swift再次为我服务)。NSRangerange=[timerangeOfString:@""];NSString*startDate=[timesubstringToIndex:range.location];正如您从上面的代码中看到的,我能够在ObjectiveC中获取空格字符之前的字符串。编辑:如果我尝试这样的事情varstring="helloSwi

ios - 为什么在 Swift 中初始化变量的那一行会出现 "Variable used before being initialized"错误?

我很难理解为什么在使用Swift的iOS项目中会出现此编译器错误。如果我创建以下类:classInitTest{leta:Intletb:Intletc:Intinit(){self.a=3self.b=4self.c=self.runCalculation()}funcrunCalculation()->Int{returnself.a*self.b}}我在self.c=self.runCalculation()行上收到一个编译器错误,提示“在初始化之前使用了变量‘self.c’”。起初我以为这是因为编译器无法验证runCalculation()方法没有访问self.c,但后来我尝试