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

Cannot find 'OCKSurveyTaskViewController' in scope #645

Open
zxcheergo opened this issue Mar 15, 2022 · 14 comments
Open

Cannot find 'OCKSurveyTaskViewController' in scope #645

zxcheergo opened this issue Mar 15, 2022 · 14 comments

Comments

@zxcheergo
Copy link

With the latest Xcode 13.3, I encounter the problem the Cannot find 'OCKSurveyTaskViewController' in scope. Actually, I import the CareKit with the SPM. How to fix this problem?
image

@gavirawson-apple
Copy link
Collaborator

The OCKSurveyTaskViewController requires that ResearchKit is linked to your project. Can you confirm ResearchKit is linked? You can find linking instructions here.

@zxcheergo
Copy link
Author

The OCKSurveyTaskViewController requires that ResearchKit is linked to your project. Can you confirm ResearchKit is linked? You can find linking instructions here.

Yes, I can confirm that I add the ResearchKit and import it where I use the OCKSurveyTaskViewController. It worked with the old version of Xcode 13.2.1. When I updated Xcode to version 13.3, first I got an error that "Module (ResearchKit) compiled with Swift 5.5.2 cannot be imported by the Swift 5.6 compiler". Then I set Build Libraries for Distribution set to Yes for ResearchKit. After the operation, I build my project and get the error that I mentioned before.

@zxcheergo
Copy link
Author

The OCKSurveyTaskViewController requires that ResearchKit is linked to your project. Can you confirm ResearchKit is linked? You can find linking instructions here.

I also test the WWDC 21 RecoverApp and I also encounter this can't find problem. It worked well with the old version of Xcode.

@cbaker6
Copy link
Contributor

cbaker6 commented Mar 16, 2022

This is most likely related to #642. The old description I had on there:

Bumped the minimum for the project to iOS 15 watchOS 8 as the recent changes to ResearchKit (ResearchKit/ResearchKit#1487) won't allow CareKit to build an iOS 13 minimum deployment

@zxcheergo you probably updated ResearchKit to latest commit on the main when updating Xcode. If I'm right, you should be able to swap out your CareKit in SPM with the one on my branch, https://github.com/cbaker6/CareKit, specific commit 2e4bbe35162a0ecbe794afb543aca84067b6fd64 to get a working build. Basically, the CareKit minimum deployment needs to raise to iOS15 or the ResearchKit deployment needs to drop back to iOS13. You can also use the commit 90c68d0d195f23fff1f618a9a4ffa518be9ac845 on ResearchKit right before the latest.

Assuming you are using SPM for CareKit, you can use my branch of CareKit that I currently have bumped to iOS15 until the changes are in CareKit/ResearchKit, https://github.com/cbaker6/CareKit/tree/2.1-slider. This works fine with the latest ResearchKit in Xcode 13.2+

@zxcheergo
Copy link
Author

https://github.com/cbaker6/CareKit/tree/2.1-slider

Thanks for your replying! Could you please tell me how to use your branch 2.1-slider with the SPM in detail? Do I have to download and drag & drop in the project, instead of using SPM?

@cbaker6
Copy link
Contributor

cbaker6 commented Mar 16, 2022

Could you please tell me how to use your branch 2.1-slider with the SPM in detail? Do I have to download and drag & drop in the project, instead of using SPM?

You use it just like you use the CareKit apple repo in SPM.

  1. Go to your Package Dependencies in your Xcode project
  2. Remove the current CareKit package
  3. Click the + button, paste https://github.com/cbaker6/CareKit/ in the search field
  4. For the Dependency Rule, select Branch, and input 2.1-slider
  5. Press Add Package
  6. Rebuild your app

You will need to use the same process when reverting back to the apple CareKit repo in the future

@zxcheergo
Copy link
Author

Thanks for your replying! Could you please tell me how to use your branch 2.1-slider with the SPM in detail? Do I have to download and drag & drop in the project, instead of using SPM?

You use it just like you use the CareKit apple repo in SPM.

  1. Go to your Package Dependencies in your Xcode project
  2. Remove the current CareKit package
  3. Click the + button, paste https://github.com/cbaker6/CareKit/ in the search field
  4. For the Dependency Rule, select Branch, and input 2.1-slider
  5. Press Add Package
  6. Rebuild your app

You will need to use the same process when reverting back to the apple CareKit repo in the future

Thanks for your replying!

I follow your instruction and get the following error:

截屏2022-03-16 10 31 04

@cbaker6
Copy link
Contributor

cbaker6 commented Mar 16, 2022

You need to hit enter on your keyboard after you added the link in step 3.

You are currently searching for the 2.1-slider branch on Apple's repo in which it's not there. You can tell this is the case by looking at the link in your error above

The blue link to the CareKit repo should show my repo like below:
image

@zxcheergo
Copy link
Author

You need to hit enter pm your keyboard after you added the link in step 3.

You are currently searching for the 2.1-slider branch on Apple's repo in which it's not there. You can tell this is the case by looking at the link in your error above

The blue link to the CareKit repo should show my repo like below: image

It works!!! Thank you so much!

@samuelalake
Copy link

samuelalake commented Mar 22, 2022

Please do you know why I get this message while trying to add package via SPM?

Screen Shot 2022-03-22 at 6 01 22 AM

I'm unable to find any package result when I use the url

image

EDIT: It's most likely has to do with something it my Xcode's connection to Github. Couldn't fix. The alternative was to download 2.1 slider from the URL, drag the folders for CareKit, CareKitUI, and CareKitStore and drop it at top level in project. Check the Readme for guidance.

@zxcheergo
Copy link
Author

You need to hit enter pm your keyboard after you added the link in step 3.

You are currently searching for the 2.1-slider branch on Apple's repo in which it's not there. You can tell this is the case by looking at the link in your error above

The blue link to the CareKit repo should show my repo like below: image

This problem happened again for no reason. I use the latest main branch of ResearchKit and the 2.1-slider of CareKit. Could you please help me! Thank you so much.

image

image

@cbaker6
Copy link
Contributor

cbaker6 commented Mar 28, 2022

EDIT: It's most likely has to do with something it my Xcode's connection to Github. Couldn't fix.

Yes, this is something with your Xcode or your network connection. My repo is public, so anyone can read from it.

This problem happened again for no reason. I use the latest main branch of ResearchKit and the 2.1-slider of CareKit. Could you please help me!

This most likely has something to do with how you are using Xcode/SPM (or if you updated to the latest Xcode version recently). Or, how you are importing ResearchKit. My CareKit repo won't cause these types of issues. You can try to clean your build folder.

@zxcheergo
Copy link
Author

Thank you. clean build folder saved me.

@cbaker6
Copy link
Contributor

cbaker6 commented Apr 28, 2022

If #642 gets merged developers can point directly to the Apple CareKit main branch to use the latest commit of ResearchKit with CareKit for iOS 13+ with async/await.

Until then, if you need the latest Carekit and ResearchKit for iOS 13+ with async/await you can do the following:

  1. Go to your Package Dependencies in your Xcode project
  2. Remove the current CareKit package
  3. Click the + button, paste https://github.com/cbaker6/CareKit/ in the search field
  4. For the Dependency Rule, select Commit, and input ec157174bf77f95dcff53fd40d50bbfca5319b64. This will use a working commit of https://github.com/cbaker6/CareKit/tree/2.1-slider
  5. Press Add Package
  6. Rebuild your app

Basically the commit above has #642 merged in it which allows it to work with iOS 13+.

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

4 participants