Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Build Configuration Release Fails #10

Closed
gavinmahan opened this issue Feb 26, 2021 · 28 comments
Closed

iOS Build Configuration Release Fails #10

gavinmahan opened this issue Feb 26, 2021 · 28 comments
Labels
bug Something isn't working

Comments

@gavinmahan
Copy link

I get these four fatal errors when building in Release mode but everything works great in Debug mode.

/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:933:43: Use of undeclared identifier 'kindOf'

/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:933:43: No matching function for call to 'kindOf'

/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:934:5: Static_assert failed due to requirement 'std::is_base_of<facebook::jsi::Symbol, signed char &>::value || std::is_base_of<facebook::jsi::String, signed char &>::value || std::is_base_of<facebook::jsi::Object, signed char &>::value' "Value cannot be implicitly move-constructed from this type"

/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:939:26: Cannot allocate reference type 'signed char &' with new

@KingAmo
Copy link

KingAmo commented Feb 26, 2021

react-native-mmkv v1.0.0 is ok. v1.0.1 && v1.0.2 has this error

@mrousavy
Copy link
Owner

I think you have to clean & rebuild. Open Xcode and hit "Clean Build Folder", then run those commands:

rm -rf node_modules/react-native-mmkv
rm -rf package-lock.json
rm -rf ios/Pods
rm -rf ios/Podfile.lock
npm i
cd ios
pod install

and finally build your app

@mrousavy mrousavy added the bug Something isn't working label Feb 26, 2021
@gavinmahan
Copy link
Author

Tried all of that and have the same issues.

@mrousavy
Copy link
Owner

Hmm, the compiler options for debug don't seem to have any important changes compared to the options for release except the GCC_PREPROCESSOR_DEFINITIONS = $(inherited) 🤔🤔
Could you maybe try playing around with those values? The file you're searching for is in node_modules/react-native-mmkv/ios/Mmkv.xcodeproj/project.pbxproj - after every change you have to pod install

@mrousavy
Copy link
Owner

Another idea: Open Mmkv.mm in Xcode, go to line 72

            return jsi::String::createFromUtf8(runtime, value.UTF8String);

replace that with:

            return convertNSStringToJSIString(runtime, value);

see if that changes anything.

@gavinmahan
Copy link
Author

Did not seem to change anything. I also tried many attempts at changing the compiler options to no avail.

@gavinmahan
Copy link
Author

I have to test it more but changing the iOS Deployment Target to 11.0 seems to have resolved the issue.

@mrousavy
Copy link
Owner

mrousavy commented Feb 27, 2021

I cannot reproduce this issue, just tried to delete all cache and clean build folder to rebuild in Release mode, and everything works fine on my end (RN 0.64).

What RN version are you on?

Make sure you installed the latest version of react-native-mmkv (1.0.3)

@gavinmahan
Copy link
Author

gavinmahan commented Feb 27, 2021

Could just have been my set up. I tried it with a brand new app app installed yesterday so I assume it was the latest version of react. Who knows, it’s working perfectly now, thanks!

@ManAnRuck
Copy link

I've the same issue with RN 0.63.4 and react-native-mmkv 1.0.3

react-native-mmkv Group
Semantic Issue Group
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:933:43: Use of undeclared identifier 'kindOf'
/MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/Mmkv.mm:2:9: In file included from /MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/Mmkv.mm:2:
/MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/YeetJSIUtils.h:10:9: In file included from /MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/YeetJSIUtils.h:10:
/MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/Mmkv.mm:57:16: In instantiation of function template specialization 'facebook::jsi::Value::Value<signed char &>' requested here
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:1146:30: Must qualify identifier to find this declaration in dependent base class
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:1149:30: Must qualify identifier to find this declaration in dependent base class
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:1152:30: Must qualify identifier to find this declaration in dependent base class
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:933:43: No matching function for call to 'kindOf'
/MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/Mmkv.mm:2:9: In file included from /MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/Mmkv.mm:2:
/MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/YeetJSIUtils.h:10:9: In file included from /MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/YeetJSIUtils.h:10:
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:1146:30: Candidate function not viable: no known conversion from 'signed char' to 'const facebook::jsi::Symbol' for 1st argument
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:1149:30: Candidate function not viable: no known conversion from 'signed char' to 'const facebook::jsi::String' for 1st argument
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:1152:30: Candidate function not viable: no known conversion from 'signed char' to 'const facebook::jsi::Object' for 1st argument
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:934:5: Static_assert failed due to requirement 'std::is_base_of<facebook::jsi::Symbol, signed char &>::value || std::is_base_of<facebook::jsi::String, signed char &>::value || std::is_base_of<facebook::jsi::Object, signed char &>::value' "Value cannot be implicitly move-constructed from this type"
/MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/Mmkv.mm:2:9: In file included from /MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/Mmkv.mm:2:
/MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/YeetJSIUtils.h:10:9: In file included from /MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/YeetJSIUtils.h:10:
/MY_LOCAL_PATH/App/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:939:26: Cannot allocate reference type 'signed char &' with new
/MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/Mmkv.mm:2:9: In file included from /MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/Mmkv.mm:2:
/MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/YeetJSIUtils.h:10:9: In file included from /MY_LOCAL_PATH/App/node_modules/react-native-mmkv/ios/YeetJSIUtils.h:10:

@mrousavy mrousavy reopened this Feb 28, 2021
@mrousavy
Copy link
Owner

@ManAnRuck can you confirm that this issue only happens in Release builds? In Debug everything works fine?
Did you try removing all cache (node_modules, Pods, lockfiles and Build Output Folder) and completely rebuilding?

I have just published 1.0.4 on npm, try if that works for you (clean everything before upgrading)

@ManAnRuck
Copy link

@mrousavy I can confirm, that it was happening only in Release build mode.

Clearing project doesn't solved it.
An upgrade to 0.64.0-rc.3 doesn't solved it.
react-native-mmkv 1.0.4 doesn't solved it.

increase platform target from 10 to 11 solved it 👍🏼
(with both react-native-mmkv versions also with rn 0.63 & 0.64)

For me, the platform target is totally fine. I like this package 😃 thank you

@KingAmo
Copy link

KingAmo commented Mar 1, 2021

increase platform target from 10 to 11 do not solve the problem in my case...

@alinavaie
Copy link

@ManAnRuck can you confirm that this issue only happens in Release builds? In Debug everything works fine?
Did you try removing all cache (node_modules, Pods, lockfiles and Build Output Folder) and completely rebuilding?

I have just published 1.0.4 on npm, try if that works for you (clean everything before upgrading)

Yes. It happens only on release build. Increasing platform target to 11 doesn't work for me.

@mrousavy mrousavy reopened this Mar 2, 2021
@mrousavy
Copy link
Owner

mrousavy commented Mar 2, 2021

@KingAmo @alinavaie

  1. Have you tried the latest version (1.0.5)?
  2. What react-native version are you on?
  3. Have you tried to clean cache & rebuild?:

Clean Xcode caches:

cd ios
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*

source

Clean local package caches:

rm -rf node_modules
rm -rf package-lock.json
rm -rf ios/Pods
rm -rf ios/Podfile.lock
npm i   # or yarn
cd ios
pod repo update && pod update && pod install

@alinavaie
Copy link

alinavaie commented Mar 2, 2021

@KingAmo @alinavaie

  1. Have you tried the latest version (1.0.5)?
  2. What react-native version are you on?
  3. Have you tried to clean cache & rebuild?:

Clean Xcode caches:

cd ios
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*

source

Clean local package caches:

rm -rf node_modules
rm -rf package-lock.json
rm -rf ios/Pods
rm -rf ios/Podfile.lock
npm i   # or yarn
cd ios
pod repo update && pod update && pod install
  • Yes, I install the last version (1.0.5)
  • I'm using react native 0.63.0
  • I cleaned cache and rebuild according to your instruction but nothing changed at all.

@mrousavy
Copy link
Owner

mrousavy commented Mar 2, 2021

@alinavaie I'm using RN 0.64 and don't have any issues at all. Does it work if you create a new RN 0.63 project with only the react-native-mmkv lib installed?

@frodoe7
Copy link

frodoe7 commented Mar 3, 2021

increase platform target from 10 to 11 do not solve the problem in my case...

I have the same issue , changing the platform target to 11 did not work with me

react native version : 0.63.4
react native mmkv version : 1.0.5

We were about to publish our app to App store , but after replacing the AsyncStorage with this library; we cannot build in IOS 🤦

@mrousavy
Copy link
Owner

mrousavy commented Mar 3, 2021

@frodoe7 again, I cannot reproduce. If you provide me a minimal reproduction (e.g. github repo, only with react-native-mmkv installed) I can help you.

@KingAmo
Copy link

KingAmo commented Mar 4, 2021

@mrousavy here is a fresh new project with only react-native-mmkv installed, rn v0.64.0.rc.4 https://github.com/KingAmo/test-react-native-mmkv , I can not archive success using XCode

***/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:934:43: Use of undeclared identifier 'kindOf'

...

@gavinmahan
Copy link
Author

@mrousavy here is a fresh new project with only react-native-mmkv installed, rn v0.64.0.rc.4 https://github.com/KingAmo/test-react-native-mmkv , I can not archive success using XCode

***/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:934:43: Use of undeclared identifier 'kindOf'

Since I started this issue I figured I'd give your app a try. Changing the iOS Deployment Target to 11 seems to work for your app:

From a fresh download of your app:

npm install
cd ios && pod install && cd ..
open ios/linyue.xcworkspace

IN XCODE

Select pods from the menu on the left
In the targets drop down select react-native-mmkv
Select Build Settings
Change the iOS Deployment Target to 11

Click on linyue at the top and select Edit Scheme
Change Build Configuration to Release

Press the Build & Run button and wait.

Seems like if I do pod install again I have to set the iOS Deployment Target to 11 again.

@KingAmo
Copy link

KingAmo commented Mar 4, 2021

@gavinmahan yes! i build success follow your steps! thanks a lot. but i am curious why this works?

@mrousavy
Copy link
Owner

mrousavy commented Mar 4, 2021

@gavinmahan you're a legend.

@KingAmo @frodoe7 I have just published 1.0.6 to npm which specifies iOS 11 in the podspec, let's see if that works for you

@frodoe7
Copy link

frodoe7 commented Mar 4, 2021

Thanks @mrousavy
it solved now in this version 1.0.6 👍

@mrousavy mrousavy closed this as completed Mar 4, 2021
@baptooo
Copy link

baptooo commented Mar 4, 2021

Moving to target 11.0 did the trick ! 🙇

One question about this as I am quite new to the community 👶 , shouldn't this be defined here directly to prevent future crash ?

IPHONEOS_DEPLOYMENT_TARGET = 10.0;

Thank you !

@focux
Copy link

focux commented Apr 21, 2021

@mrousavy here is a fresh new project with only react-native-mmkv installed, rn v0.64.0.rc.4 https://github.com/KingAmo/test-react-native-mmkv , I can not archive success using XCode

***/ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:934:43: Use of undeclared identifier 'kindOf'

Since I started this issue I figured I'd give your app a try. Changing the iOS Deployment Target to 11 seems to work for your app:

From a fresh download of your app:

npm install
cd ios && pod install && cd ..
open ios/linyue.xcworkspace

IN XCODE

Select pods from the menu on the left
In the targets drop down select react-native-mmkv
Select Build Settings
Change the iOS Deployment Target to 11

Click on linyue at the top and select Edit Scheme
Change Build Configuration to Release

Press the Build & Run button and wait.

Seems like if I do pod install again I have to set the iOS Deployment Target to 11 again.

That did the trick for me. Thank you. For the others, just make sure to change the deployment target to the Pod and not to the whole app like I was doing first.

@ryanlntn
Copy link

ryanlntn commented Aug 3, 2021

Running into this same error but in my case it builds fine regardless of scheme on iOS but fails with the aforementioned Use of undeclared identifier 'kindOf' when building for macOS using catalyst. So far changing deployment targets hasn't had any effect.

@dimaportenko
Copy link
Contributor

I'm trying to add macos target to this library and use it with https://github.com/microsoft/react-native-macos. And I got this error. I'm happy to share I found the problem place and solution. I'll do PR with macos target later, meanwhile solution if somebody will need it.

diff --git a/node_modules/react-native-mmkv/ios/MmkvHostObject.mm b/node_modules/react-native-mmkv/ios/MmkvHostObject.mm

@@ -73,7 +85,7 @@
       if (!arguments[0].isString()) throw jsi::JSError(runtime, "First argument ('key') has to be of type string!");
 
       auto keyName = convertJSIStringToNSString(runtime, arguments[0].getString(runtime));
-      auto value = [instance getBoolForKey:keyName];
+      bool value = [instance getBoolForKey:keyName];
       return jsi::Value(value);
     });
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants