facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.18k stars 24.32k forks source link

ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h:132:1: Property with 'retain (or strong)' attribute must be of object type #29681

Open jencircj-developer opened 4 years ago

jencircj-developer commented 4 years ago

iOS Xcode build fails with this Syntax error "ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h:132:1: Property with 'retain (or strong)' attribute must be of object type"

Description

I am using this RCTBridgeModule to create my own custom bridge module for one of my application. Recently i migrated the app to latest react-native version 0.61.5. Now the iOS xcode build and react-native run ios command build gives me the error "ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h:132:1: Property with 'retain (or strong)' attribute must be of object type". The build works fine when i removed the strong keyword from this line below. The strong or retain keyword is not required here as i see the variable methodQueue here is not an object. https://github.com/facebook/react-native/blob/75a617827963fd53f5f36987677a992e137eaebf/React/Base/RCTBridgeModule.h#L146

See this link for more details on declaring dispatch_queue as a property after ARC - https://stackoverflow.com/questions/8904206/what-property-should-i-use-for-a-dispatch-queue-after-arc

React Native version:

info Fetching system and libraries information... System: OS: macOS 10.15.2 CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz Memory: 2.77 GB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.14.1 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.13.4 - /usr/local/bin/npm SDKs: iOS SDK: Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: API Levels: 23, 25, 26, 28, 29 Build Tools: 28.0.3, 29.0.2 System Images: android-28 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.6 AI-192.7142.36.36.6392135 Xcode: 11.6/11E708 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5 npmGlobalPackages: react-native-cli: 2.0.1

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Use RCTBridgeModule to create some custom bridge module for a react-native application
  2. Build the iOS project after integrating the above custom module
  3. Xcode build fails with above syntax error

Expected Results

Xcode build should work fine without any syntax error

Snack, code example, screenshot, or link to a repository:

Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

safaiyeh commented 4 years ago

Hi @JencirJamal could you test this out on v0.63 and provide a repro?

github-actions[bot] commented 4 years ago
:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.
github-actions[bot] commented 4 years ago
:warning: Using Old Version
:information_source: It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release.
jencircj-developer commented 4 years ago

Hi @safaiyeh , I can test it in the latest v0.63 version of react-native, But i guess the bug is still there in this line of code in your repo https://github.com/facebook/react-native/blob/75a617827963fd53f5f36987677a992e137eaebf/React/Base/RCTBridgeModule.h#L146

There is the below PR which was suggested by some other developer who already had this issue 2 years back, he has done the fix for it, But i see the PR is not merged for some reason. https://github.com/facebook/react-native/pull/19479

I guess this issue is mostly faced by developers who created their own Native iOS custom bridge module and integrate to their project. Currently i am working for a big complex project which uses lot of react-native dependencies and recently we migrated from very older version 0.59 to 0.61 and it had a lot of breaking changes in several dependencies and took around 1-2 months to complete the migration. It will take some more time for our team to upgrade the react-native to 0.63 version. Anyways i will check if this issue is present after upgrade and let you know if it still exist.

safaiyeh commented 4 years ago

Appreciate it, it looks like that PR needs to be reopened for discussion as the submitter didn't sign the CLA.

sunzhongliangde commented 4 years ago

the ios podspec file need add s.platform = :ios, "9.0" like this; if you don't add this line , has Property with 'retain (or strong)' attribute must be of object type error

chrisglein commented 3 years ago

Open for someone to rehydrate PR #19479 with a valid CLA and get this addressed.

damiandizeo commented 3 years ago

Same issue here, using react-native-ffmpeg dependency which latest require development target iOS 11+, and since updated this I'm having this problem!!

ReynaldoMaciel commented 3 years ago

Same issue here using react-native-ffmpeg dependency

sasmyk commented 3 years ago

Guys, how did you resolve it?)))

AlkanV commented 3 years ago

facing same issue.

sasmyk commented 3 years ago

facing same issue.

In my case it was because on a new lib added. It was ffmpeg, so i fixed it by updating Pods with pod 'react-native-ffmpeg/full', :path => '../node_modules/react-native-ffmpeg'

mika-lindell commented 3 years ago

Was able to fix this by making sure platforms is defined in podspec of your custom native dependencies. For example:

s.platforms = { :ios => "11.0" }

https://stackoverflow.com/q/19404328 https://stackoverflow.com/questions/8618632/does-arc-support-dispatch-queues

arsensgitacc commented 1 year ago

have this issue on 0.70.5

Saadnajmi commented 8 months ago

For what it's worth, I hit this issue while doing some recent work with visoionOS, found this explanation that this can be fixed by setting a proper minimum deployment target, and observe that React Nativedoes so consistently for a couple of versions, so I think this issue can be closed.