VS-MDA: Custom iOS-Framework in Plugin - ios

we want to create a MobFox-Plugin for our hybrid apps. It is already running well in CLI-Cordova Apps, but it does not work in our hybrid apps, because it seems that the directory structure of the framework (the symbolic links between headers and version directory) is destroyed by Windows, where the framework is inside the plugin in the mda project. If I start a build, the header directory of is not recognized as a symbolic link, but as an ordinary executable textfile on the Mac.
This is how I include the framework in the plugin xml:
<framework src="libs/ios/MobFox.framework" custom="true"/>
I also tried to copy the MobFox.framework to the SDK Frameworks Folder and reference it like the standard system libraries (which work well):
<framework src="MobFox.framework" />
But this also fails, though the Framework is now included correctly in Xcode. But the compiler now says that it cannot find the MobFox.h-class, this is how it's included:
#import <MobFox/MobFox.h>
So I really think that the problem is that Windows cannot handle the symbolic links inside the .framework File. Does anybody has a workaround or solution for this problem? Or an idea why my Workaround with placing the file in the Standard-Frameworks Folder does not work?
Any help would be highly appreciated.
Thanks

Same problem here - it appears that when the plugin is published to the cordova registry it loses the symbolic links inside the .Framework package that tell XCode where everything is.
They are maintained on git, so it is something in the plugman export/publish that is going wrong.
So for example
cordova plugin add https://github.com/uxcam/cordova-uxcam
will work for the plugin I am writing, but not
cordova plugin add com.uxcam.cordova.plugin
which is the published version.
If you delve down into the 'plugins' folder of the project you added it too and 'show package contents' on the com.uxcam.cordova.plugin file you can then get into 'src/ios'UXCam.framework' and see how it has messed up the symbolic links in the framework folder that should point at the Headers folder and a link the the library binary as well.
Reference: Cordova bug report here: https://issues.apache.org/jira/browse/CB-6092
Update: I've worked around the problem by manually putting files in the framework into the places they need to be. So now on the github project I reference above you can see that the framework library is directly in the UXCam.framework folder, and there is an explicit Headers folder that has the UXCam.h file in it. This works for a published plugin now.
Not an ideal solution and every time I update the framework I'll have to fix the layout again, but works for now until I can find the proper place to report the problem.

Related

How to construct a Swift Package that links to a local (not system) library?

I must have read over a dozen posts on possible techniques to link a local library into my Swift Package. Specifically, my package depends on libturbojpeg.a, which most users won't have installed anywhere. Even if they did install it (there is a DMG), I'd have to go through hoops to make sure I was linking in the correct version. I finally found a post in the Swift Forums that basically says you can't do it now.
It appears that the only way to link it now is using .linkerSettings(LinkerSetting.unsafeFlags(..., but if you use that your package can't be managed by Xcode (see above link, and I even tried it and verified it cannot be used).
Is there some kind of workaround that allows me to distribute my Swift Package with the library?
In my Package, I created a directory "Libraries" and added my library there.
I discovered that Xcode 11 places included Swift Packages in a specific location in the Derived Folders directory. This means that it is possible to tell Xcode where to find it during the link phase.
My Package has these instructions in it for users:
1) Add the Package using Xcode->File->Packages with the URL of https://github.com/dhoerl/
2) Open the app's Project Build Phases, and from the Package shown in the left file pane, drag the Libraries/.a file into the link phase. It will appear just above the that should already be there
3) In Application Build settings, under library search paths, add:
"$(BUILD_DIR)/../../SourcePackages/checkouts//Libraries"
Build and run! Voíla - works like a charm!
Note: obviously this is somewhat fragile, Xcode 12 could change how packages are managed, but its possible by then that the Swift Package Manager will support linking of local libraries (its mentioned in the above link.)

Swift iOS GoogleAPIClientForREST – Shell Script Invocation Error GTMSessionFetcher.framework: No such file or directory

I'm programming a Swift iOS app in XCode 9.2 (Dated, I know), and I've tried to integrate GoogleAPIClientForREST using Cocoapods. When you integrate GoogleAPIClientForREST (and possibly other pods, I don't know), it also downloads GTMSessionFetcher. Since the integration of the pods, the app won't run and gives this Shell Script Invocation Error:
/Users/username/Library/Developer/Xcode/DerivedData/Teachers_Assistant-aphjxihtqtmedabcymmxjlmxduzc/Build/Products/Debug-iphonesimulator/Teachers Assistant.app/Frameworks/GTMSessionFetcher.framework: No such file or directory
However, I can't open Teachers Assistant.app, as it's not a folder. GTMSessionFetcher.framework exists, but inside of the folder circled in red in the image at this link, not inside the .app file circled in blue.
I've tried the suggestions at this link, the suggestions in the question at this link, this link, this link, and this link. None of them have worked, though if you think that there was something I did wrong while trying to carry out those steps feel free to tell me.
All of my code is online at this repo, including the podfile. Thanks for the help!
Additional information: I plan on using the Google API to automate Sheets as a sort of storage information system to log attendance data and other miscellaneous information, if that helps at all.
Project's name should not contain special characters like ' or space, this could create some problems when Cocoapods try to link the libraries. I suggest you to change your project's name to TeachersAssistance (it worked for me). Here is the suggested steps:
Change project's name in the navigator. Xcode will recommend you to refractor the project, accept it:
Update podfile to point to new targets's names
Cocoapods will create a new workspace TeachersAssistance. Use it and delete the old one.
Remove Pods_Teacher__Assistance from new workspace. From now it will use Pods_TeachersAssistant.
Compile again and enjoy your project :)

Adding an Xcode subproject: Shouldn't all the source files get copied?

I am manually adding the SQLite.swift subproject to my project. As the directions indicated, I copied the .xcodeproj file to my project. This allows me see all the source files (unlike this SO question).
Everything seemed like it was working fine. However, I discovered that the source files of that subproject were not copied to my project. They are still in original location where I downloaded them. Is this by design? What if I want to share my project source code with other people in the future? They won't have the subproject source that is necessary for my project to work.
If I do need to copy the subproject source to my project, then how do I do that?
Add it to your filesystem-structure first. For example by pressing "Show in Finder" on the "Chimee"-project which will lead you to the folder it's located in. Then copy the SQLite-project structure in there.
Afterwards you can then drag&drop the xcodeproj into your project which will then still link to its original path, but as it's now inside your project-structure isn't a problem anymore.
I guess that this is by design, because when you try it via Add files to "YourProject" you can select the Copy items if needed-option but it will still not get copied (only with .xcodeproj-files, it works with all other filetypes)
After doing more research, I now feel that using a dependency manager (like CocoaPods or Carthage) is a better option than manually adding the framework to the project.
This will allow easier updating in the future.
Github source code sharing and App Store submission issues have already been considered.
Using Carthage is not too difficult if you follow this excellent guide: Carthage Tutorial: Getting Started
Notes
Delete the framework files that you manually copied in before installing the framework with Carthage.
I will leave #TMob's answer as accepted for now, but I am no longer pursuing that route.

How to integrate Unity inside native iOS App?

I'm having troubles integrating a simple Unity project inside a native iOS App.
I followed this this tutorial but I think that some things have changed since it was written. I'm stuck with this error:
And thats not the only one, there are 1600 files that include include that file. The problem is that all this 1600 files have a wrong reference to il2cpp-codegen.h
This are my build settings for the Unity project:
So, after following all the tutorial, should I change all the files so that all the references would be correct? Or am I missing something else?
Thanks!
Joel
EDIT
I'm currently using Unity 5.1.1f1 Personal version.
Do you have a warning saying folder not found or something like it?
I think you didn't set the path for Libraries/libil2cpp/include in your header search paths.
You probably didn't copy the Libraries/libil2cpp folder.
That folder isn't visible inside the Xcode project but you can find it in Finder. You should try and copy that folder also and maybe add it to the Build Phases in Xcode. Not sure about this last step.

Adding ios frameworks (like Google Maps API) to subversion won't allow working checkout

I added the new Google Maps API framework to a project and checked it into subversion. The framework has the usual Apple structure which includes alias files that point to the actual static library and includes. Apparently XCode these days allows the use of the standard framework structure so you don't have to put header or library references in any more, merely adding the framework is sufficient.
However it appears that storing these in subversion does not work as the alias files seem to break when you check them out.
Anyone have an idea how to make this work? Clearly I can add manual references to the includes directory and the static library in the framework, ie the old fashioned way. It would be nice for this to just work somehow since people are shipping SDKs as proper frameworks now (Google, Crashlytics).
Update: The symbolic links inside the frame work are supposed to be stored in SVN marked as svn:special. However what I get back from checking this framework out is a symlink to the library, but with actual folders for Headers and Resources instead. This of course no longer matches the SVN repository. I wonder if my svn client (Versions) might be messing it up.
I avoided putting symbolic links into SVN by copying the real GoogleMaps file and the real Headers and Resources folders from GoogleMaps.framework/Versions/A/ up into the GoogleMaps.framework folder, overwriting the symbolic links (and then I removed the Versions folder).
This is probably not the 'right' way to do it, but it seems to be working okay so far :)
Update SVN global ignores:
Open terminal and execute:
vi ~/.subversion/config
Then search for global-ignores, and uncomment same line (remove # in first char). Then remove .a in same line
Someone's client was messing up the checkin. Versions OSX seems to do it correctly but once it's checked in wrong, strange things start to happen. The solution is to remove it from the repository and check it in with the command line or a client that works correctly like Versions.

Resources