升级react-native-reanimated至2.12.0后iOS端Flipper redux-debugger失效求解决
iOS端Flipper无法查看Redux状态的解决办法
1. 检查Flipper Redux插件的iOS端初始化代码
确保AppDelegate.m/AppDelegate.swift中正确添加了Redux调试器插件的初始化逻辑,示例Obj-C代码如下:
#import <FlipperKit/FlipperClient.h> #import <ReduxDebugger/FlipperReduxDebuggerPlugin.h> static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; // 其他Flipper插件初始化代码... // 关键:添加Redux调试器插件 [client addPlugin:[FlipperReduxDebuggerPlugin new]]; [client start]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // 其他初始化逻辑... InitializeFlipper(application); return YES; }
2. 验证Redux Store的调试中间件配置
确认Redux store创建时正确引入了redux-flipper中间件,且仅在开发环境加载:
import { createStore, applyMiddleware } from 'redux'; import createFlipperMiddleware from 'redux-flipper'; import rootReducer from './reducers'; const middleware = []; if (__DEV__) { middleware.push(createFlipperMiddleware()); } const store = createStore(rootReducer, applyMiddleware(...middleware)); export default store;
3. 清理依赖缓存并重新构建
- 进入iOS目录执行:
pod deintegrate && pod install - 清理React Native缓存:
npx react-native clean - 重启Metro服务和Xcode调试环境
4. 确认版本兼容性
检查以下依赖版本是否匹配:
- 确保
Podfile中Flipper版本不低于0.170.0,配置示例:use_flipper!({ 'Flipper' => '0.174.0' }) - 确认
redux-flipper版本与当前React Native、Flipper版本兼容,可尝试升级redux-flipper至最新稳定版
5. 检查Xcode调试配置
- 确保当前Scheme为Debug模式
- 在
Edit Scheme > Run > Environment Variables中确认DEBUG值为1,无禁用调试的环境变量
内容的提问来源于stack exchange,提问作者Talha Ashraf
相关产品推荐
相关产品推荐

