How can I modify the xCode project automatic which generate by Unity? - ios

I create a Unity project and generate an xCode project . Aways I should and some frameworks or static libs to the xCode project to make it run . So I want make this progress automatic.
I found some tools to modify the xCode project . such as "Mod PBXProj":
https://bitbucket.org/darktable/mod-pbxproj/src
My question is that how can I call the tools(such as "Mod PBXProj") to modify the xCode project after the Unity project generate the xCode project . Or are there any other method to modify the project?

If you will open unity application as a folder, there will be a folder of xCode project, wich unity just copies while build. you can add there any files you whant (or replace), and on every new build, unity you use modified files.

Related

Integrating Unity in Swift project

Well, I have seen and tried most of tutorials referenced from similar questions "How to integrate Unity iOS code into Swift project". But all my attempts were failed with linker error "No such symbol for architecture arm_64" or "No such symbol for architecture x86_64". I have tried different build options in Unity side, no success.
Common minus of all of that tutorials / articles is: all of them outdated, latest version of Unity I have found article is 2018.2.2f1, my version of Unity is 2018.2.20f1.
So, anyone have idea how integrate Unity 2018.2.20+ iOS builded code into Swift 4.2 (XCode 10) project?
Any help will be great appreciated.
Here is how I have integrated unity in my swift project.
Create new Xcode project (using swift)
(create bridging header step) Create new class File -> New -> Cocoa touch class and select language Objective C it will ask for create bridging header choose create
Goto https://github.com/jiulongw/swift-unity and download zip file
Open downloaded file and unzip it. Go to Xcode folder -> DemoApp-> You will find Unity Folder copy paste to your project (if you drag and drop it make sure you check the check box for copy at destination)
open your new Xcode project and auto generated unity project side by side so you can copy paste it easily
copy Classes Folder from unity Xcode project to your Xcode project to the unity Folder of step 4
copy Library Folder from unity Xcode project to your Xcode project to the unity Folder of step 4
copy Data Folder from unity Xcode project to your Xcode project to the unity Folder of step 4
Important Goto Xcode project tap on name of project on left side there will be two options Project and target. Select project on centre main window you can see Configuration Expand it and against the name of your project choose Unity from drop drown
Goto Classes Folder that you have copied in step
And either delete main.mm file or comment everything
goto folder you have downloaded in step3 Copy all code of AppDelegate.swift to your AppDelegate.swift file
In your Xcode project search for YourProjectFileName-Bridging-Header and copy paste
#ifndef BRIDGING_HEADER
#define BRIDGING_HEADER
#import <UIKit/UIKit.h>
#import "UnityUtils.h"
#import "UnityAppController.h"
#import "UnityInterface.h"
#endif /* BRIDGING_HEADER */
Copy paste LaunchScreen-iPad.xib and LaunchScreen-iPhone.xib to your project and delete LaunchScreen.storyboard
Compile it :] it should compile successfully (not in my case I got error that DeviceSettings.mm there is return statement missing so I just added return deviceUnknown; before the })
You can see step3 downloaded view controller.swift file for see how to show unity view in your screen
Notes: After integrate unity you are not able to run in simulator so you have to run in real device.
it is better to have unity and xcode in same machine. sometime all the framework only get ref of folder so in different machine you may face the issue
at last your project should look like

Xcode 7 is using my framework after I deleted it

I'm in the process of developing a framework. My problem is that the changes I make to my framework are not being reflected in my app. My app seems to be linked to the original framework I created and isn't updating when I update the framework. Even when I delete the framework from my project, xcode still seems to think it's there.
Setup
I created a separate xcode project intending to make an app that uses the framework. I copied the root folder of my framework project into my app project root folder and I drag and dropped the .xcodeproj into my App's xcode project. I added the framework from my nested xcode project in each of the following steps:
Build Phases>Link Binary With Libraries
Build phases>Target Dependencies
General>Embedded Binaries
I tried removing the framework from each of these locations.
I tried cleaning the framework project and App project.
I tried deleting the derived data in my app project and framework project in Window>Projects
I tried using a previous version of my app project that doesn't contain the framework in any way (not in the xcode project or root folder)
The ghost of my framework continues to haunt my project! Any help?
I suppose you must have tried deleting it from build phases as well... just in case though:
Go to Build phases -> Link Binary with libraries
Select the one you want to remove, press minus button down there.
Do it for all modules: as in Debug, Release.
You can also try deleting the older framework and emptying trash to be on the safer side.
I just made a mistake.
I was using the classes I built my framework out of rather than the framework itself. I thought deleting these classes and selecting 'Remove Reference' would stop Xcode from using them. I deleted these classes completely and Xcode told me they couldn't find the class I was looking for-- indicating it was using those files rather than the framework.
Also, in my AppDelegate I used
import "ExternalClass.h"
Which I believe is for classes that are in the project. I changed this to
import <ExternalClass/ExternalClass.h>
to import the header file from the framework instead.

Worklight - Building iPhone environment

I am working on Worklight version 6.1.I have created a native ios environment.I added controller classes in the Xcode project and added native functionalities. I have added .js files in the eclipse project.Now I need build my iPhone environment.But I am afraid that native content (Xcode project) will get lost,after building the environment.What is the solution for this.
I should build at the same time native content shouldn't be lost.
How to do this...
Your explanation is VERY raw... it doesn't make much sense to me.
have created a native ios environment
What is that exactly? do you mean that you:
Created a Worklight project and added a Native API for iPhone, or
Created a Worklight project, added a Hybrid app and then added the iPhone environment to that application
Created a fully native project in Xcode?
The distinction between the 3 is important, and you need to mention this in your question in clear wording.
If what you mean is that you went with option 2 above, then your JS, CSS and HTML can be either in the common folder or in the environment folder.
If you then want to add native code, you need to first build your project and then open the generated Xcode project in Xcode, write native code and make sure to copy it back to your Worklight project in Eclipse.
I added controller classes in the Xcode project and added native
functionalities
Where did you add this? In which file? in the classes provided by Worklight in option 2 above, or in a new Class.
Either way, you need to bring these files back into Eclipse.
In Eclipse, you can create a iphone\nativeResources\Classes folder. During build-time in Eclipse, the files in this folder will be copied into the iphone\native\Classes folder, and when opened again in Xcode - your native code will be there...
Note: if you created your own class file, you will need to reference it in Xcode (right-click > add files...). Worklight cannot do this for you.
I believe your customizations should not be lost. Have you tried making the build already and your resources were overwritten?

Xcode Localization Building -

I am trying to build the project. The project has localization.
When I build the project, it does not create Base.lproj in the .app.
So, it crashes for Base localization.
This has happened only after the checked-in the code, then checked out a new code.

Do all artifacts in the Worklight iphone/native folder get propagated from Worklight into the xcode project

Working with a partner who is creating a cordova plugin.
If we add framework folders and artifacts to the Frameworks directory under iphone->native in eclipse will they get pulled into the corresponding xcode project?
There are some flags that need to be added to the ‘Linking’ properties under build settings. Does this need to be done through the xCode IDE?
Thanks!
JT
Some actions must be done in Xcode.
For example, if you are creating a Cordova plug-in, then you need to:
Edit config.xml - this can be done in Eclipse
Place the .m and .h files in the Classes folder - you can put them there while in Eclipse, but they will not be referenced in the Xcode project
for this you must first build the Worklight project
and then open it in Xcode and add the files you've placed in the Classes folder to the project it self
You would normally need to go to Xcode to create the plug-in to begin with, but assuming you downloaded a plug-in...
The same applies to frameworks.

Resources