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

[BLOCKING] cannot build iOS application #1

Closed
AndrewDongminYoo opened this issue Mar 6, 2023 · 1 comment
Closed

[BLOCKING] cannot build iOS application #1

AndrewDongminYoo opened this issue Mar 6, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@AndrewDongminYoo
Copy link
Owner

AndrewDongminYoo commented Mar 6, 2023

Expected Behavior

  • Xcode 에디터 상에서는 인스펙터에 걸리는 부분이 없지만 빌드 시에 Objective-C 타입 에러가 발생

Actual Behavior

  • Error Log looks like...

    ❌. @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:45:48:
    expected a type

     - (NSDictionary *)dictionaryFromPedometerData:(CMPedometerData *)data {
                  ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:17:30:
    use of undeclared identifier 'CMPedometer'

     @"supported": @([CMPedometer isStepCountingAvailable]),
                         ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:28:11:
    property 'pedometer' not found on object of type 'RNStepCounter *'

     [self.pedometer queryPedometerDataFromDate:startDate
               ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:30:50:
    type-id cannot have a name

           withHandler:^(CMPedometerData *pedometerData, NSError *error) {
                                                                   ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:30:66:
    expected ')'

     withHandler:^(CMPedometerData *pedometerData, NSError*error) {
                                   ^~~~~~~~~~~~~~~

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:30:48:
    C++ requires a type specifier for all declarations

     withHandler:^(CMPedometerData *pedometerData, NSError *error) {
                  ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:31:53:
    use of undeclared identifier 'pedometerData'

     handler(@[[self dictionaryFromPedometerData:pedometerData]]);
                                            ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:36:11:
    property 'pedometer' not found on object of type 'RNStepCounter *'

     [self.pedometer startPedometerUpdatesFromDate:[[NSDate date]init]
            ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:37:53:
    type-id cannot have a name

      withHandler:^(CMPedometerData *pedometerData, NSError *error) {
                                    ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:37:69:
    expected ')'

      withHandler:^(CMPedometerData *pedometerData, NSError *error) {
                                                             ^~~~~~~~~~~~~~~

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:37:51:
    C++ requires a type specifier for all declarations

      withHandler:^(CMPedometerData *pedometerData, NSError *error) {
                   ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:38:13:
    use of undeclared identifier 'pedometerData'

         if (pedometerData) {
                ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:39:19:
    no visible @interface for 'RNStepCounter' declares the selector 'sendEventWithName:body:'

      [self sendEventWithName:@"StepCounter.stepCounterUpdate"
                  ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:55:54:
    property 'startDate' not found on object of type '__strong id'

         @"startDate": [formatter stringFromDate:data.startDate]?:[NSNull null],
              ~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:56:52:
    property 'endDate' not found on object of type '__strong id'

         @"endDate": [formatter stringFromDate:data.endDate]?:[NSNull null],
                                                      ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:57:24:
    property 'numberOfSteps' not found on object of type '__strong id'

         @"steps": data.numberOfSteps?:[NSNull null],
                           ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:58:27:
    property 'distance' not found on object of type '__strong id'

         @"distance": data.distance?:[NSNull null],
                        ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:60:33:
    property 'floorsAscended' not found on object of type '__strong id'

         @"floorsAscended": data.floorsAscended?:[NSNull null],
                           ^

    ❌ @dongminyu/react-native-step-counter/ios/RNStepCounter.mm:61:34:
    property 'floorsDescended' not found on object of type '__strong id'

         @"floorsDescended": data.floorsDescended?:[NSNull null],
                                 ^

Steps to Reproduce the Problem

  1. yarn add @dongminyu/react-native-step-counter
  2. ...
  3. npx react-native run-ios --configuration Release

Specifications

you shold use this command.

npx react-native info
  • INFO OUTPUT
System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 13.90 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.14.1 - ~/.nvm/versions/node/v18.14.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.14.1/bin/yarn
    npm: 9.5.0 - ~/.nvm/versions/node/v18.14.1/bin/npm
    Watchman: 2023.02.13.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.0 - ~/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK:
      Android NDK: 22.1.7171670
  IDEs:
    Android Studio: Electric Eel 2022.1.1 Patch 1 Electric Eel 2022.1.1 Patch 1
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.3 => 0.71.3
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
@AndrewDongminYoo AndrewDongminYoo added the bug Something isn't working label Mar 6, 2023
@AndrewDongminYoo AndrewDongminYoo self-assigned this Mar 6, 2023
AndrewDongminYoo added a commit that referenced this issue Mar 6, 2023
This is the implementation of the `sendEventWithName:body:`
method in the `RCTEventEmitter` class in React Native.
This method is used to send events from a native
module to the JavaScript side of a React Native app.

Issue [BLOCKING] cannot build iOS application #1
AndrewDongminYoo added a commit that referenced this issue Mar 13, 2023
… .mm

React Native’s architecture can include both .h
and .mm files. According to the React Native
documentation, all .m files within the AppName
inner folder should be renamed from .m to .mm.
Objective-C++ is an extension of Objective-C
that allows you to use C++ code within an
Objective-C program.

[BLOCKING] cannot build iOS application #1
@AndrewDongminYoo
Copy link
Owner Author

개선한 부분들

  1. 예제 앱이 아닌 별도의 앱을 빌드해서 임포트를 시도했었는데, 해당 앱 iOS 코드의 일부만 Objective-C++ 파일로 만들어져 있었지만, 그런 식으로 사용할 수 있는 것이 아니라는 것을 알게 되어, iOS 애플리케이션 폴더 내의 모든 Objective-C(.m) 파일의 이름을 Objective-C++(.mm)으로 변경했다. (Objective-C++의 문법은 Objective-C의 확장.) 아마도 @AndrewDongminYoo/walking_tracker 별도의 앱에서 이 라이브러리를 임포트해서 사용하려고 하는 과정에서, 마이그레이션해야 할 부분들 중 일부를 놓친 것 같다. - 리액트 네이티브 애플리케이션 iOS 변경사항 셋업 직전 커밋에서 이 부분에 대한 문서를 추가했다.
  2. Flipper, Hermes, JSC 등 Expo 애플리케이션만 만들어봤을 때는 생소하게 느꼈던 개념들이 머릿속에 정리가 안되어 설정들이 충돌한 부분들이 있었다. 이 부분 역시 해결했고(NO_FLIPPER, NO_HERMES 등의 환경 변수 문제였어서 관련 커밋은 없다.)

앱은 이제 무사히 잘 빌드되기 때문에 이 이슈는 닫는다.

@github-project-automation github-project-automation bot moved this from In Progress: 작업중 to Done: 완료 in dongminyu's first npm library development Mar 14, 2023
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
Development

No branches or pull requests

1 participant