商业成功的四个基石
一个充满了社会责任意识和强烈价值基础的企业愿景。
一个在竞争中将产品和价格作为核心竞争力的商业模式(企业做什么和怎么做)。
一个市场领军者的形象和均衡的全球投资组合,对企业短期和长期增长目标(哪里是主战场)有明确定位。
一个有公信力的企业家是确保成功的重要元素。宜家的企业宗旨是“为大众创造更加美好的生活”(“to create a better everyday life for the majority of people”),它形成并发表于1976年的一份名为《一个家具商的誓约》(“The testament of a furniture dealer”)的文件中。
人类社会面临的两大难题,一是贫困,二是随之带来的环境灾难。
宜家的产品定位源于企业深厚的价值底蕴,企业愿景和经营理念均清晰地映射出宜家的宗旨:为大多数人创造更加美好的日常生活,提供种类繁多、设计精良、功能性强、老板姓买得起的家居用品。
就像亚当·斯密在其伟大的《国富论》中所说:“我们期望的晚餐绝非赖于屠夫、酿酒师和面包师傅的恩惠,而是来自于他们的自利之心。不说清对他们的好处而只讲对我们自己的裨益是无法说服他们为我们提供产品的。要满足我们的欲求,就要让他们明白交换将如何让这些人自身获利。要靠好处打动人们,而不是靠可怜去博得同情。”
作者: CouldHll
《引爆流量:微信小程序运营与推广》
《乔布斯内部信件》
《微信小程序实战入门》
《造个小程序(与微信一起干件正经事儿)》
{“error”: “TypeError: Network request failed”, “status”: “FETCH_ERROR”}错误
问题描述
Android测试机上传图片时报错(iOS正常):
{"error": "TypeError: Network request failed", "status": "FETCH_ERROR"}
问题分析
上传图片使用库是"react-native-image-crop-picker": "^0.39.0"
问题解决
react-native-image-crop-picker返回的image.sourceURL和filename只在iOS下可用,所以代码改成这样:
const filePath = Platform.OS === 'ios' ? image.sourceURL : image.path;
const fileName =
Platform.OS === 'ios' ? image.filename : image.path.split('/').pop();
let formData = new FormData();
const file = {
uri: filePath,
type: 'multipart/form-data',
name: fileName,
};
formData.append('file', file);
《三体》
NO_FLIPPER导致RN编译失败
问题描述
Xcode构建RN报错:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FlipperClient", referenced from:
objc-class-ref in libreact-native-flipper.a(FlipperReactNativeJavaScriptPluginManager.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
问题分析
NO_FLIPPER没有设置成功导致react-native-flipper编译时没有被排除
React Native 0.71.1 当 NO_FLIPPER=1 时排除 react-native-flipper 以防止 iOS 构建失败
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
# dependencies: {
# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
问题解决
通过设置NO_FLIPPER=1把Flipper从pods中排除后再构建RN
Disable Flipper for iOS
NO_FLIPPER=1 pod install --project-directory=ios
node版本过低导致RN编译失败
问题描述
Xcode编译RN项目失败:
Node found at: /usr/local/bin/node
/Users/couldhll/Desktop/Jesus/node_modules/yargs/node_modules/yargs-parser/build/index.cjs:1015
throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
^
Error: yargs parser supports a minimum Node.js version of 12. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions
at Object.<anonymous> (/Users/couldhll/Desktop/Jesus/node_modules/yargs/node_modules/yargs-parser/build/index.cjs:1015:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/couldhll/Desktop/Jesus/node_modules/yargs/build/index.cjs:1:60637)
at Module._compile (module.js:652:30)
Command PhaseScriptExecution failed with a nonzero exit code
问题分析
查了一下node的版本是8.11.3,需要的版本是12以上
/usr/local/bin/node -v
v8.11.3
问题解决
把node
(nvm安装)link到/usr/local/bin/node
:
ln -s $(which node) /usr/local/bin/node
Multiple commands produce报错
问题描述
iOS Build 报错:
Showing Recent Messages
Prepare build
note: Building targets in dependency order
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/AntDesign.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/AntDesign.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/AntDesign.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Entypo.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/Entypo.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Entypo.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/EvilIcons.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/EvilIcons.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Feather.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/Feather.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Feather.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome5_Brands.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome5_Brands.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome5_Regular.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome5_Regular.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome5_Solid.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome5_Solid.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Fontisto.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/Fontisto.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Fontisto.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Foundation.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/Foundation.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Foundation.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Ionicons.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/Ionicons.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Ionicons.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/MaterialCommunityIcons.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/MaterialCommunityIcons.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/MaterialIcons.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/MaterialIcons.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Octicons.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/Octicons.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Octicons.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/SimpleLineIcons.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/SimpleLineIcons.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
error: Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Zocial.ttf'
note: Target 'Jesus' (project 'Jesus') has copy command from '/Users/couldhll/Desktop/Jesus/node_modules/react-native-vector-icons/Fonts/Zocial.ttf' to '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Zocial.ttf'
note: That command depends on command in Target 'Jesus' (project 'Jesus'): script phase “[CP] Copy Pods Resources”
Building targets in dependency order
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/AntDesign.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Entypo.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/EvilIcons.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Feather.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome5_Brands.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome5_Regular.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/FontAwesome5_Solid.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Fontisto.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Foundation.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Ionicons.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/MaterialCommunityIcons.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/MaterialIcons.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Octicons.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/SimpleLineIcons.ttf'
Multiple commands produce '/Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Products/Debug-iphoneos/Jesus.app/Zocial.ttf'
Computing target dependency graph and provisioning inputs
Create build description
Build description signature: e34cffb17530f18e248a8120033bffe3
Build description path: /Users/couldhll/Library/Developer/Xcode/DerivedData/Jesus-bixlpkqqeqxklgenquwktceekdsp/Build/Intermediates.noindex/XCBuildData/e34cffb17530f18e248a8120033bffe3-desc.xcbuild
问题分析
原因是react-native-vector-icons所使用的ttf字体文件被导入了两次:
一次是手动导入:通过项目导入
一次是自动导入:Pods-Jesus-resources.sh
问题解决
方法一:移除手动导入
移除项目中手动导入的字体文件
方法二:取消自动导入
在react-native.config.js
文件中加入如下代码:
module.exports = {
dependencies: {
'react-native-vector-icons': {
platforms: {
ios: null,
},
},
},
};