How do I use symbolic links with Xcode 4 and Cordova - xcode

I'm unable to get Xcode to copy over www resources to my PhoneGap based iPhone app. I considered using Git submodules, but since the app has to work on different platforms (iPhone, Android, etc) and has to be branded differently (images, css, and small changes to some files), it does not solve the complete problem.
I ended with a solution where I created an external core www folder and created symlinks for every file from the different projects. If a file needed special attention on a platform or for a branding requirement, then I could simply replace that instance of a symlink with an actual file.
This all would work like a charm, but for some reason Xcode for does not copy the symlinked resources over to the phone. Does anyone have any idea how to make this work? Or a solid alternative. Even if this takes me a day to fix.
Thanks.

This solution worked perfectly to pull in the symlinks on build. Using this method you can build Phonegap solutions for all platforms and have them branded differently with the absolute minimum code duplication.
In short, create a common directory that contains all your phonegap www contents, and then symlink this from your different projects (platform differences or branding differences). For building on Xcode, add the following to your project's run script:
rsync -pvtrlL --cvs-exclude \
$PROJECT_DIR/../Resources* \
$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH
Note: You also need to dereference symlinks if you build for BlackBerry.

I just want to say that using symbolic links shouldn't be necessary. You can simply drop the folder into xcode, and DO NOT copy the files.
In my case, my shared folder was called "mobile", so I did have to create this run script:
mv $BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/mobile $BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/www
This simply renames the directory so Cordova can find what it's looking for.

Related

macOS Application Bundle Frameworks Directory Codesign

I am packing my macOS application into an application bundle. I need to codesign it and pass notarisation. It is possible to put the frameworks in the "Resources" directory?
I have two frameworks. Normally, I used to put such frameworks into the "Frameworks" directory of the bundle. However, for (stupid) designing reason I need to have some more libraries in the same directory of my frameworks. Since such libraries will prevent code signing if placed in the directory "Frameworks", I want to move frameworks + extra libraries into the "Resources" directory.
Reading Apple documentation it seems that frameworks should - of course - belong to the "Frameworks" directory, however I could not find any reference to what should NOT be included into the "Resources" directory. Is this bad practice? Would my .app structure not pass gatekeeper?
Any suggestion would be very much appreciated
You've probably already tried putting a frameworks in Resources by now. As you said, even if it works today, this is not a good idea.
You might be able to work around whatever issue caused you to want to do this by using the install_name_tool to change one of the paths built into your frameworks. Adding symbolic links are another handy device for issues like this. This kind of stuff can be done automatically in a Run Script Build Phase or a Build Phase Post Action.

React Native - multiple targets

I'm creating a RN app that is meant to be some kind of wrapper. It should have multiple targets (like in Xcode) and all its content (images, text, etc.) should be target dependent. Unfortunately, I cannot find any useful informations about how to achieve this without opening Xcode or Android Studio project and create those targets manually (like here). Is there any other solutions for this?
I was still struggling with described problem but I finally found a solution. It's not easy, needs writing a bit of boilerplate code and looks more like a workaround but I hope it will help someone in the future. What I did is I have completed my wrapper app with the resources for one of my targets so I can have visual effect. In the project's root directory I've created a folder with subfolders for each target. Inside each I have put files (images, source code files, other assets) that are target-dependent. Then I've created bash script that takes one argument - target's name. Based on it, it replaces all the target-dependent files from target's subfolder to the original file's destination in the project structure. In this proces all meta-data informations are also replaced so after firing .sh file I can build the app and upload it to both stores. It's really time consuming to create all these apps separately and publish them and it's maybe not the best solution, but at least it works!
On android, you can edit build.gradle files, java or properties, without having to launch Android Studio (which simply uses Gradle)
You can build different type flavours by only changing app/build.gradle
On iOS, that's another story. Project file (.pbxproj) is a mess,and other Workspace/Scheme files are not easy to read or script. So XCode is the way to Go.
I tried to have dynamic target & Info.plist, there are tools to script that like PlistBuddy
in the end, I saw there are many ways to launch a React Native app for developpers. Some prefer the command line, and only VSCode.
Others want to play with native IDE.
By the way, native IDEs are VERY useful.
e.g. : you want to fine-tune your application performance, using XCode view hierarchy debugger or android Studio Layout Inspector (and be sure you don't use to many views), or use any other performance tools these IDEs offer...
In the end, I used react-native-config along with multiple almost similar configs (Info.plist < target < Scheme for each), here's a post giving an overview of the setup.

DJI iOS SDK 4.7 add so many bin files

I noticed that in the commit a6e2288 on 30 Aug in the repository Mobile-SDK-iOS of dji-sdk, it add a lot of bin files in the Sample Code/ObjcSampleCode/DJISdkDemo/Resource directory. And I found that those files names are only appeared in the DJIWidget project by searching the file name. Therefore according to this commit, there are two things confused me.
Firstly, I wonder if I need put those files in my swift application which only uses the swift version of DJI SDK since those files only add in ObjcSampleCode directory. To be honest, I don't know much about Objective-C.
Moreover, I found that there is no such commit in the Mobile-UXSDK-iOS repository. So dose it need this commit as well?
By the way, the code of DUXSDK in previous version such as 4.6 use a bundle file to manage those images that are used in the VideoPreviewer project. Why those images are added into project directly in version 4.7? I am not very familiar with the file structures in Xcode project and can someone explain to me?
Those bin files are for Mavic 2 decode image distortion calibrate. The reason why those files only add in ObjcSampleCode directory is SwiftSampleCode is not supporting DJIWidget features.
Mobile-UXSDK-iOS is still not supporting this feature now. Will coming next release.
The reason why we add the bin files as resource file is it's used by DJIWidget and the bin files import in the application project. If we used a resource bundle we need to add it to DJIWidget.

How to deploy PhoneGap app in multiple Platforms

Created one app using phonegap in Xcode, want to deploy that into multiple platforms like android phone and etc.
Can any one please give the answer, how can i achive this.
Take the contents of the "www" folder of your application and copy them into the "phonegap/lib/DESIREDPLATFORM/sample/www" where DESIREDPLATFORM stands for the target platform (I.E.: blackberry, android, etc). All files should be copied, except for the "phonegap.js" file, which is specific to each platform.
after that, go to the command prompt, navigate to the phonegap "sample" folder, and compile the application with "ant DESIREDPLATFORM compile" (you already know what DESIREDPLATFORM stands for). It will create the appropriate package for the platform.
One way of doing that is to create a repository(either public or private depending on your need) of your assets folder and using the phonegap build app, you can find it here: https://build.phonegap.com. I have tested that and it works great.

Development folder structure on OS X 10.6

I have switched to Mac as my main development machine (coming from Fedora) and was just curious as to what people used as there development folder structure. For example in Fedora I always had ~/opt for user programs ~/src for source code I was working on and ~/bin for files I constantly executed. Is there a Mac de facto. What do you guys perfer?
Thanks,
Greg
I use the directory ~/Developer as the root of my development-related files. Inside that I have ~/Developer/Code for code snippets, tutorial code, test ideas, etc. I have a ~/Developer/Projects directory to hold in-development projects. This contains a few subdirectories, including Archives for projects I've abandoned, and Current for current development work. ~/Projects is also a symlink to ~/Developer/Projects/Current.
To add to #mipadi, after a recent fresh install of OSX 10.10.2 (Yosemite) I noticed that if you create a ~/Developer folder, that folder automatically receives a special folder icon (with a hammer on it). This property seems to be an artifact of older versions of Xcode, in which it would automatically create the folder for you.
I have 3 folders in home:
Sandbox - my source control checkouts
Dev - projects that are not in source control (tests, experiments, etc.)
3rdPartyDev - 3rd party code I've downloaded and want to keep around
I try to keep as much 3rd party code around as possible. With the Mac's Spotlight feature, you can instantly search all the code at once. If there's an API I need to see example code for, I just Spotlight for it and chances are some code in there is already using it.
I have a big messy folder called "code" full of Xcode projects.
In Mac, for all developer projects there is a specific folder inside the home directory called ~/Developer, which when you create automatically has a customised icon.
You can thus subdivide using this:
Experiments: things you just want mess around with.
Public: open source
Private: private projects
Learning: If you're on a learning path to track your progress and milestones.

Resources