How to Handle ResearcKit 2.0.0 Deprecated Code for Use With iOS 14? - swift

I'm a novice in iOS development and learning how to build an app for conducting a research study that involves the use of surveys, audio, displaying progress for study duration, and if possible a token system for completion of the surveys to allow participants to enter raffles for completing surveys on time.
Now, I've tried implementing the ResearchKit but it has so many errors when trying to build it and I'm not entirely sure how to fix each one of them. I've tried searching around for a walk through for updating the code but I can't seem to find anything and the developer documentation is a bit difficult to interpret for fixing the errors.
Is ResearchKit just out of my grasp for now to use for this project?
If so, what other solutions should I look into because as of now, because ResearchKit handles and standardizes a lot of the components that I'm trying to build from scratch and I want to make sure the IRB accepts the app within the first submission (hopefully).

After deleting the framework, re-specifying the target, and performing the following steps ResearchKit 2.1.0 beta is properly imported and no issue with deprecated code.
1- Delete your Podfile.lock (I like to use the command '-rm -rf Podfile.lock' on the terminal for this)
2- Delete your Pods folder (I like to use the command '-rm -rf Pods' in the terminal for this)
3- Delete your .xcworkspace
4- Pod install
5- Clear your project into XCode> Product> Clean Build Folder
All thanks to an old post from jeffersonsb on: https://developer.apple.com/forums/thread/123790?answerId=386841022#386841022

Related

Library not Loading/Image not Found - Swift 4.0

So I am very new to Swift and XCode. I am trying to use an external library called JJFloatingActionButton the projects build fine but when I try run it on an emulator I get:
dyld: Library not loaded: #rpath/JJFloatingActionButton.framework/JJFloatingActionButton
Referenced from: /Users/mkangwa/Library/Developer/CoreSimulator/Devices/
3E58C8A1-3F02-4CA0-8EF3-A79311A202A2/data/Containers/Bundle/Application/D8BBF9A8-5BC7-4619-
B08C-2E6F7C6BCB85/DriversHub-iOS.app/DriversHub-iOS
Reason: image not found
Now of course I know you can't come ask a question like this on StackOverflow without researching and trying to find a solution yourself, so thats what I've been doing for the past few hours I have been looking at what was causing this, I started thinking that maybe it was the library it's self so this one is the third or fourth I've tried till I came across a few posts on SO that were about this issue.
Most people fixed this by just putting the Framework into the Embedded Binaries in the targets General Settings. And I tried this but I now receive a log:
I also get a Dependancy Analysis Warning:
I don't know much about these types or warning and errors but it's saying that it can't find the file which is pretty self explanatory but when I am adding the file to Embedded Binaries it shows the framework file there
What I often do when I have problems with cocoapods is remove cocoapods from the project and reinstall it.
You could use pod deintegrate (https://github.com/CocoaPods/cocoapods-deintegrate) to remove it and then a pod install to reinstall.
So it took a day and a half to work this out but I have finally got it and I can carry on with my project.
Problem:
The problem in my particular case (because other methods seemed to have worked for people trying to achieve the same thing) that the reason my project wouldn't build and was throwing Build Time errors was because after adding the Framework to Embedded Binaries it was also adding it to Embed Frameworks in my targets Build Phases. This then, I believe, caused the compiler to try and build it twice hence the Multiple Build Commands error
Solution:
So the errors I kept getting where saying No such file or directory above it was saying Multiple build commands for output file and what I did to fix this I went to Build Phases in my target settings and deleted the framework from Embedded Frameworks but made sure it was still under [CP] Embed Pods Frameworks.
in my case I was have to make framework "embed & sign" in stead of "don't embed"

pods in a framework, import that framework for main project in swift

The idea is to have an api framework (new project -> cocoa touch framework) for example "SuperApi". SuperApi use pods like Alamofire, ObjectMapper and whatever I need.
Next I want to integrate that SuperApi into my app like a normal framework.
I tried different ways. I tried to add it at "Embedded Binaries" and/or tried to add superApi at "Linked Frameworks and Libraries". Without success. I always linked the whole framework-folder.
import SuperApi threw always an error: could not find framework
Then I read something about workspaces where I can have a lot of projects parallel. This seems really overpowered for an api.
Create a framework without pods (xcodeproj) is no problem. There are a lot of descriptions in web. But what is a (good) solution for my problem?
I don't want to write my own http-networking + JSON parser. Thanks for input.
Why don't you add your SuperApi as a pod of your main project? You can have it either as a local pod, directly linking the last commit or using your own private repo
There's a very nice tutorial by Ray Wenderlich: https://www.raywenderlich.com/99386/create-cocoapod-swift
Thanks Eli. I found this video, it's more up to date
https://www.youtube.com/watch?v=gNMNeqXKnzw&t=964s (thanks to you Mr. Levi Bostian - you made my day)
Unfortunately this video is a litte bit outdated too.
You run into a Swift 2/3 issue. So you have to create a .swift-version in your git. For example Alamofire did it like this: https://github.com/Alamofire/Alamofire/blob/master/.swift-version
You can do it like this in your pod-folder: echo 3.0 > .swift-version
I ran into a second issue, because my pod wasn't up to date. So update your pod sudo gem install cocoapods --pre
Last but not least I had a warning in my podspec, so I have to use pod spec lint --allow warnings
Better way is to fix the warning ;)

how to put to work Ionic generator?

I have an Ionic app running with the basics of Ionic and running it in the browser by doing ionic serve, but I want some new stuff and run it trough the grunt serve command, also has the feature for JSLint, I am already using this scss this: https://github.com/diegonetto/generator-ionic/ and I see that have everything I want, how do I install that in my project?
Take into account that my project is almost done, I have almost 85 % already done.
Is this the part I need to follow up:
Upgrading
Make sure you've committed (or backed up) your local changes and install the latest version of the generator via npm install -g generator-ionic, then go ahead and re-run yo ionic inside your project's directory.
The handsome devil is smart enough to figure out what files he is attempting to overwrite and prompts you to choose how you would like to proceed. Select Y for overwriting your Gruntfile.js and bower.json to stay up-to-date with the latest workflow goodies and front-end packages.
does this will bring some complications ? is there something else I need to know ?
I use the same generator and enjoy using it. With that said, I would not recommend starting to use a generator until you've made a complete backup of your project.
Even then, I'd recommend creating a brand new project using the generator then migrating your existing code into the newly generated project. While migrating, you should be modifying your code to match the generator conventions as you go. This gives you the most control and will make sure that you learn the conventions of the new project structure. Upgrading instructions are really meant for people who already use the generator and are just upgrading to a new version of the generator. They are not applicable to you.

Automatically Clean a target before building in XCode

I try to automate my UI testing (using FoneMonkey ).
I have several targets, linked to different frameworks.
The issue is that I have to clean my targets before building them. If not, it looks like it loads unwanted frameworks (and thus has unexpected behavior).
So I'd like to know if there is a way to auto-clean the target(s) before building, by setting an option, using a run script...
I tried using
xcodebuild clean
But I get an
ASSERTION FAILURE in /SourceCache/DevToolsBase/DevToolsBase-1763/pbxcore/Target.subproj/PBXTarget.m:597
Any idea ?
Thanks
You can force the top level project to rebuild from scratch by removing the build directory. e.g. rm -rf build. This may be sufficient for your needs.
Otherwise, upgrade to the latest version of XCode, and failing that, submit a bug report.

How to build and install yajl-objc on iOS

Hey I am trying to get http://github.com/gabriel/yajl-objc to work on iOS. It says to "Add the YAJLIOS.framework to your project" but I am not sure how I can get/build YAJLIOS.framework
Thanks!
-Ray
Although this is an old question, I came across the issue today updating a client's old project. The YAJL-objC project requires you to run a makefile command in order to compile the .framework file needed for installation.
To create the framework, checkout the latest from github, and then open Terminal. Change your directory to: yajl-objc\Project-iOS
Next, type the command make and run it. This will execute the compiling for you and create a new framework file here: yajl-objc\Project-iOS\Framework\YAJLiOS.framework
You can then drag that framework into the project you wish to use it in. Good luck!
I should have looked harder, but there is simply a download under the github download link that includes the framework.