error: filename "ExpoModulesProvider.swift" used twice: ~ エラーが出たので対処した
Expo bare workflowを使って開発していた。dev, stg, prodで分けて開発したくなったのでその設定をしてビルドしたら
Command CompileSwiftSources failed with a nonzero exit code ... error: filename "ExpoModulesProvider.swift" used twice:
というエラーが出た。ExpoModulesProvider.swiftが被っているらしい。
TARGETS -> Build Phases -> Compile Sources をみてみたら2つあったので別のターゲットを参照している方を削除。これでビルドが通るようになった。
ExpoでreactDelegate' not found on object of type 'AppDelegate
Expoで開発をしていたら reactDelegate' not found on object of type 'AppDelegate' というエラーが出た。
ここにあるようにSDK44で対応しているものらしい。
そういえば自分は44でinitしたが、reanimatedがうまく動かなかったので43にダウンさせていた。おそらくこれが不整合を起こしていたと思う。
AppDelegate.mを修正して対応
before
RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil]; UIViewController *rootViewController = [self.reactDelegate createRootViewController];
after
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil]; UIViewController *rootViewController = [UIViewController new];
キャッシュクリアしてビルドしたら解決。
react-native-firebaseを使おうとしたらUse of undeclared identifier 'FIRApp' が出た。
ここにあるとおり、FB_SONARKIT_ENABLEDよりも上でimportしないといけない。
// before #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>) ... #import <Firebase.h>
// after #import <Firebase.h> #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>) ...
address already in useが出たので対処した
4000でGraphQLサーバーを立てようとしたら address already in use が出て起動できなかった。
解決法
lsof -i:4000 // プロセスの確認 kill 31979 // プロセスの停止
PrismaでThe provided value for the column is too longというエラーが出た
ORMにPrismaを使っていたら
The provided value for the column is too long
というエラーに遭遇した。
iosのサブスク課金のレシート検証に成功した際recieptを保存するようにしたのだが、このデータの保存のタイミングで起こった。
prisma.schemaは以下の感じ
model Foo { receipt String }
なぜ起こったのか
シンプルにデータが大きすぎた。
解決策
model Foo { receipt String @db.LongText // 追加 }
こうした
MySQLとPrismaの復習
MySQLには(というか多くのRDBMSには)保持するデータに型が存在する。VARCHARやINTなど。
指定した型以外のデータを保存しようとするとPrismaがエラーを吐く。
PrismaでMySQLを使う場合、単純に String だけだと VARCHAR(191) が指定される。
これでは191文字までに限定される。
MySQLにはLongTextという4294967295バイトまで格納できる型があるので今回はそれをPrismaで指定した。