Add Today Extension to Cordova project - ios

I have a directory of "Today Extension" project.
I want to add the project to my Cordova project, one may know the platform directory in the Cordova project when I run the command
CLI: "cordova platform add ios"
is automatically generated and couldn't be added through Xcode.

Adding a target to an existing XCode project is something that can be done using node with the xcode package or through ruby using xcodeproj. The exact method on how to do so, however, is something I haven't figured out yet and I'm also very interested in.
So far, I have found one resource where they actually add a watchkit extension, but I haven't had the time to look into this in much depth. Also I think I myself lack the skill to generalize this into a plugin.

Related

ld: library not found for -lCocoaAsyncSocket - React Native

I have created a new react native project and when I try to run the app within an iOS emulator it always crashes.
When I open the .xcworkspace within Xcode I get the following error.
I have tried to update the search paths but this has not worked, I have also tried to reinstall pods but this hasn't worked.
This must be fixed on the framework side, however, the solution is the following steps:
On the Xcode bring the Build Settings tab
Find the Search Paths and then try to modify Library search paths
Add ${inherited} to the first of the list. It's important to be the first
Delete the build folder inside the ios folder of the project
Try to run the project again
It must fix the issue
This issue is basically related to the wrongly linking classes. Please follow these steps:
check make sure, you have install all the pods.
Please check your .js files, and check your import statements. To be make sure , every import statement package is installed in your project
clean project
Rebuild again
I can see that you state you have already checked search paths, but I had this same issue, and it was resolved by adding "${PODS_CONFIGURATION_BUILD_DIR}" as recursive to my Library Search Paths, under <Project> > Build Settings > Library Search Paths. However, now I'm stuck on the linker instruction -lcrypto, so it's not a complete solution.

UnityFramework-Swift.h file not found

I have an error 'Lexical or Preprocessor Issue Group' with building xcode project after have built from Unity.
'UnityFramework/UnityFramework-Swift.h file not found'
I have Nice Vibration asset and FB SDK in my project. So I tried to follow this instructions in 'Building for iOS' section, but have no result https://nice-vibrations-docs.moremountains.com/platform-specifics.html#building-for-ios
I makes it with .xcworkspace, not .xcodeproj file. I have read it's right way because of FB SDK needs CocoaPods build pipeline and I should use .xcworkspace. And it's happens in XCode 12, if it matters.
What could be wrong? I spent a few hours and so still there, where I have been :(
I also ran into this issue today (although because of the Firebase SDK, not FB).
The problems seems to be with the post-build processor, which modifies the output XCode project. The NiceVibrations implementation currently only copies a single file (module.modulemap) to the build directory. Instead, we need the entire NiceVibrations/Common/Plugins/iOS/Swift directory to be copied over.
While I can't publish the entire file, I will share my modifications with you for automating this process.
Open the following file:
NiceVibrations/Common/Scripts/Editor/MMNVBuildPostProcessor.cs
Locate the WritePropertiesToFramework function and replace:
System.IO.File.Copy(privateModuleFilepath, destination);
With this:
DirectoryCopy(Path.GetDirectoryName(privateModuleFilepath), Path.GetDirectoryName(destination), true);
You can find the source code for the DirectoryCopy function from the Microsoft dotnet docs here
Edit: You will have to change the second argument of file.CopyTo to true to allow for subsequent rebuilding atop the same directory to avoid runtime errors
Additionally, I have increased the callbackOrder to 60 to ensure that this hook runs last.
I am personally using .xcodeproj instead of workspaces, but it should work fine with workspaces as well. (Firebase uses something called External dependency manager which allows you to configure your project generation preference)
After making these changes, trigger a build from unity and "replace" the target folder to update your XCode files!

How to update a Cordova iOS platform project with only iOS source code

I have got a job to reform a Cordova iOS project to the newest version. However the only source code I have received is the iOS platform. The folder's structure is like this
-ios (root folder)
--cordova (folder)
--CordovaLib (folder)
--icon
--icon#2x.png
--AppName (folder)
--AppName.xcodeproj
--RandomSDK (folder)
--Versioning.txt
--www(folder)
So as you can imagine, it must be just a sub-folder under the platform folder in a complete Cordova project. And the Cordova version of this iOS project indicated by the file under path .\CodovaLib\VERSION is 2.7.0
My question is, is there any whether "dirty" or "clean" way one can build it up to the newest Cordova platform as well as the newest iOS version? I even don't have to recover the original Cordova project. The only thing need to be cared here is the iOS project.
I have read some of the post like Upgrade Cordova Version of an iOS app (which I called it a "dirty" way). I just want to do something like that, with only www folder, plugin folder and config file in the iOS platform, but that post only tells how to do it with the original Cordova project.
For the "clean" way I mean do something like this: https://cordova.apache.org/docs/en/latest/guide/platforms/ios/upgrade.html .
OK, After some struggles, I finally make it work and compiled. Here are the steps I do in a high level of view.
First, I have created a brand new Helloworld template Cordova project and name the project name and bundle identity exactly same as the old one. Second I copy the www folder to from the old iOS project to the new Cordova project. (Yes, the www folder in both iOS platform and Cordova are the same), and then base on what I need, I change the settings such as content src to the one I want manually. Third I built the iOS platform, then copied all the files that are missing from the old iOS project, use the old xcode project covered the new one, and manually changed all the config files manually to make it consist both to the newest Cordova and the old iOS project. Last I exclude all the old plugin from the xcode project, and remove any old plugin from the project, then reinstall them via the latest Cordova. And miraculously it work!
In general, what I did is mostly like what this post have done, except first you need to set up all the config manually, second after you build up the iOS platform you still have to copy everything and confiure them again since the Cordova project here is no more than a Helloworld template with the html, js and css files you need.
Actually this is my first time maintaining a Cordova project at work. I think the idea is really neat, but somehow it is really hard to make it work due to the hardware support vary from device to device, which is unfortunately. Hopefully later on people can use the design pattern that separate the UI and core of the mobile app so that at least things like Cordova can do the UI work all together.

Modifying Cordova iOS platform template -- linking frameworks?

I have been working on a Cordova project for both iOS and Android.
As part of the project as we will need to build a number of projects from a basic template.
I have done this by creating a template for the actual cordova project and also as part of it I pulled the cordova-ios-master code base for when we add the iOS platform. So we use our own cordova-ios-master due to some small modifications we needed to add.
With some of the plugins we have added / created we need to access SDK's / API's from some third party developers (this is mainly for some push notification services). Normally when we create the project and have added the platform we then need to add the linked frameworks using Xcode.
However I can see that within the cordova-ios-master there is the template Xcode project. I was hoping I could add the linked frameworks within this project so that they are already added when we first create the project and add the custom iOS platform.
What seems to be happening though is if I add the linked library into the template Xcode project and then save it. Once I then re-add that platform to the cordova project instead of the Xcode project being named after the cordova project name, it seems to have messed the re-naming of the Xcode project.
Below shows how the Xcode project normally appears when you add the libraries manually after adding the platform
So if i modify the Xcode template in cordova-ios-master, shown below....
You can see it already has a libCordova.a added.
I add one more and re-save the project.
But then when I add the platform to my project again from this source, i open the Xcode project for it and whilst my library is added, the project was named "myproject" but i can't choose to run it as the project selection seems to appear as "PROJECT_NAME" as opposed to being named and usable as "my project"....
Im fairly new to mac's and Xcode so maybe I'm doing something basic wrong.
Any suggestions or ideas would really help, I hope this post makes sense, it is a bit complex.
Thanks again
Rhys
Right I found a solution. I think I was looking at the problem the wrong way round. So if I need to add a framework for a particular plugin, rather than edit the Xcode project to add the framework. Cordova actually gives you the option to add certain frameworks from within the plugin.xml. Found this answer here....
How to copy a custom ios framework using plugin.xml on Phonegap 3
so I have added a required framework like so....
<framework src="src/ios/OtherLevels/OtherLevels.framework" custom="true" />
My bad!
-Rhys

Best Practice for customizing Cordova Xcode project

I'm working on a Cordova project that requires me to replace my main.m file with a .mm file and - along with adding a custom build phase script. When I do this I can no longer use the cordova cli commands or cleanly upgrade my cordova project when new versions are released.
I can't seem to find any documentation on editing things at this level. Can anyone point me in the right direction? I've looked into the cordova hooks but I'm not sure whether that would work or where to hook my code to ensure a proper build.
Fork the Cordova-iOS and maintain your changes there. Merge commits from the original apache repo from time to time.
Use cordova platform add your-fork-git-url#branch-or-tag to add platform
I hope it can help

Resources