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

Crash on iPhone 5S ios 12 #37

Open
thachnn2 opened this issue Apr 5, 2022 · 9 comments
Open

Crash on iPhone 5S ios 12 #37

thachnn2 opened this issue Apr 5, 2022 · 9 comments

Comments

@thachnn2
Copy link

thachnn2 commented Apr 5, 2022

dyld: Symbol not found: _OBJC_CLASS_$_HKElectrocardiogramQuery Referenced from: /private/var/containers/Bundle/Application/943403A9-5FAB-401D-B053-3DA33B6223C0/Runner.app/Frameworks/HealthKitReporter.framework/HealthKitReporter Expected in: /System/Library/Frameworks/HealthKit.framework/HealthKit in /private/var/containers/Bundle/Application/943403A9-5FAB-401D-B053-3DA33B6223C0/Runner.app/Frameworks/HealthKitReporter.framework/HealthKitReporter (lldb)

I got an error when i pulled example from your repository on the master branch.
Could you fix this issue?

@thachnn2 thachnn2 changed the title Crash on iPhone 5S ios 22 Crash on iPhone 5S ios 12 Apr 5, 2022
@kvs-coder
Copy link
Owner

Hi @thachnn2

Thank you for your report. According to Apple documentation you must have iOS 14 minimum to use Electrocardiogram related API. Source. Also see in the consumed library

In the example app you might locally comment out the lines 107 and 108 of main.dart file and give it a try again.

@mariosemedo
Copy link

Hi @VictorKachalov

I'm also experiencing this issue with iPhone 5S iOS 12.4. The app crashes in release mode and is frozen in debug.

@mariosemedo
Copy link

Hi @thachnn2,

I was able to get this working by downgrading the Command Line tools to Xcode 13.2.1.

Screenshot 2022-04-08 at 16 54 16

Find out how to downgrade here.

@VictorKachalov This doesn't fix the issue. It would be good to know why this is happening in the latest version of Xcode.

@nohli
Copy link
Contributor

nohli commented May 14, 2022

I have the same issue.
The app is only saving to mindful minutes, and a lot of iOS 12 devices are crashing right at the app start.

@mariosemedo
Copy link

Hi @thachnn2,

I was able to get this working by downgrading the Command Line tools to Xcode 13.2.1.

Screenshot 2022-04-08 at 16 54 16

Find out how to downgrade here.

@VictorKachalov This doesn't fix the issue. It would be good to know why this is happening in the latest version of Xcode.

This no longer works. @VictorKachalov Any updates on when this will be fixed?

@kvs-coder
Copy link
Owner

@mariosemedo

Does it also happen for you, if you use the native lib https://github.com/VictorKachalov/HealthKitReporter ?

@kvs-coder
Copy link
Owner

Hi all,

does it happen now in the 2.1.0 version? Unfortunately I don't have any iOS 12 device by hand.
I assume the problem was here

The availability macro was in the wrong place

@lynrin
Copy link

lynrin commented Nov 6, 2022

Hi @VictorKachalov

Even if health_kit_reporter was set to 2.1.0, an error occurred at runtime and it could not be started. (iOS 12.4.1)

dyld: Symbol not found: _OBJC_CLASS_$_HKElectrocardiogramQuery
  Referenced from: /private/var/containers/Bundle/Application/0B2AD4DC-AEA1-4EFB-B075-4177D73FA04D/Runner.app/Frameworks/HealthKitReporter.framework/HealthKitReporter
  Expected in: /System/Library/Frameworks/HealthKit.framework/HealthKit
 in /private/var/containers/Bundle/Application/0B2AD4DC-AEA1-4EFB-B075-4177D73FA04D/Runner.app/Frameworks/HealthKitReporter.framework/HealthKitReporter

In the main project, HealthKit.framework is linked as Optional, but when I added HealthKit.framework as Optional to HealthKitReporter on the Pods side, I was able to start it even on "iOS 12.4.1".
(In this case, you can also remove the link to HealthKit.framework from the main project.)

Can't it be solved by adding the following to HealthKitReporter.podspec of HealthKitReporter?

spec.weak_frameworks = 'HealthKit'

@lynrin
Copy link

lynrin commented Nov 6, 2022

If you add it directly with Xcode, it will be reset every time you start it via Flutter, so I added the following to the project's ios/Podfile to make a temporary workaround.

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      flutter_additional_ios_build_settings(target)
+
+     if target.name == 'HealthKitReporter'
+       # Add HealthKit.framework with Weak attribute.
+       ref_healthkit = target.project.frameworks_group.new_reference('HealthKit.framework')
+       ref_healthkit.source_tree = 'SDKROOT'
+
+       ref_build_phases_healthkit = target.frameworks_build_phases.add_file_reference(ref_healthkit)
+       ref_build_phases_healthkit.settings = { 'ATTRIBUTES' => ['Weak'] }
+     end
    end
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants