forcedotcom / SalesforceMobileSDK-Templates

BSD 3-Clause "New" or "Revised" License
52 stars 56 forks source link

No visible @interface for 'NSDictionary' declares the selector 'nonNullObjectForKey:' #388

Closed ziftech closed 9 months ago

ziftech commented 9 months ago

Hi, I'm trying to run MobileSyncExplorerReactNative in XCode and getting 10 errors:

MobileSyncExplorerReactNative/node_modules/react-native-force/ios/SalesforceReact/SFNetReactBridge.m:57:79 No visible @interface for 'NSDictionary' declares the selector 'nonNullObjectForKey:'

Pls suggest how to fix it

wmathurin commented 9 months ago

Did you generate the application with forcereact ? Or are you running the template from the dev branch ? If it is that latter, we have a PR in flight to fix some issues.

ziftech commented 9 months ago

I used these steps: https://github.com/forcedotcom/SalesforceMobileSDK-Templates/blob/v9.0.0/MobileSyncExplorerReactNative/README.md

node ./installios.js then run in Xcode

wmathurin commented 9 months ago

What's in the package.json that lives in the root directory of your project? Specifically what is in the "sdkDependencies" section?

ziftech commented 9 months ago
{
  "name": "MobileSyncExplorerReactNative",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "sdkDependencies": {
    "SalesforceMobileSDK-Android": "https://github.com/forcedotcom/SalesforceMobileSDK-Android.git#dev",
    "SalesforceMobileSDK-iOS": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS.git#dev"
  },
  "dependencies": {
    "@react-native-masked-view/masked-view": "^0.2.7",
    "@react-navigation/native": "^6.0.2",
    "@react-navigation/stack": "^6.0.7",
    "react-native-elements": "^3.4.2",
    "react": "18.1.0",
    "react-native": "0.70.14",
    "react-native-force": "git+https://github.com/forcedotcom/SalesforceMobileSDK-ReactNative.git#dev",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-safe-area-context": "^3.3.0",
    "react-native-screens": "^3.6.0",
    "react-native-vector-icons": "^8.1.0",
    "create-react-class": "^15.7.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@babel/preset-env": "^7.1.6",
    "@react-native-community/eslint-config": "^2.0.0",
    "@types/jest": "^26.0.24",
    "@types/react": "^18.0.21",
    "@types/react-native": "^0.70.14",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.72.3",
    "react-test-renderer": "18.1.0",
    "rimraf": "3.0.2",
    "typescript": "^4.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}
wmathurin commented 9 months ago

So you are using dev:

"SalesforceMobileSDK-Android": "https://github.com/forcedotcom/SalesforceMobileSDK-Android.git#dev",
"SalesforceMobileSDK-iOS": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS.git#dev"

We recommend you use forcereact to generate your application. Just npm install forcereact. Use the listtemplates command to see available templates:

% forcereact listtemplates 
Available templates:

1) Basic React Native application
forcereact createwithtemplate --templaterepouri=ReactNativeTemplate
2) Basic React Native application that uses deferred login
forcereact createwithtemplate --templaterepouri=ReactNativeDeferredTemplate
3) Basic React Native application written in TypeScript
forcereact createwithtemplate --templaterepouri=ReactNativeTypeScriptTemplate
4) Sample application using MobileSync data framework
forcereact createwithtemplate --templaterepouri=MobileSyncExplorerReactNative

Alternatively, if you want to work with the template directly, make sure to be on a tagged version of the repo. Here is package.json on the 11.1.0 tag: https://github.com/forcedotcom/SalesforceMobileSDK-Templates/blob/v11.1.0/MobileSyncExplorerReactNative/package.json -- you will notice that it points to:

    "SalesforceMobileSDK-Android": "https://github.com/forcedotcom/SalesforceMobileSDK-Android.git#v11.1.0",
    "SalesforceMobileSDK-iOS": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS.git#v11.1.0"
ziftech commented 9 months ago

@wmathurin forcereact createwithtemplate --templaterepouri=MobileSyncExplorerReactNative that works! Thanks Could you please also suggest where I can find login/password for test app?

wmathurin commented 9 months ago

It should work in any org that you own (dev org or other) as long as the user has API access.