How can I export an MVC project from Xcode to a single file .framework.
The project is very big, around 1 GB and the company want to embed this big project into a single library.
Can you help me to do this ?
Because on internet I can’t find any solution for a big project, just for a single file.
Thanks !
Edit: Here is a screenshot with my structure:
Add new target CocoaTouch Static Library (File -> New -> Target -> Cocoa Touch Static Library)
Add the project files to the target
Select a file which you want to add in project navigator pane then in File Inspector (View -> Utilities -> Show File Inspector) in the section "targets" check a checkmark.
Build
Related
Has anyone figured out how to add/edit values in the Info.plist of Xcode 13 yet? I see they moved the Info.plist from the navigator pane... but although I can find it, I'm not sure how to edit it.
It's a "feature."
You don't need it anymore. From the Release Notes:
Projects created from several templates no longer require configuration files such as entitlements and Info.plist files. Configure common fields in the target’s Info tab, and build settings in the project editor. These files are added to the project when additional fields are used. (68254857)
So, instead of inside Info.plist, edit properties like NSCameraUsageDescription here:
Project -> Targets -> Info -> Custom iOS Target Properties
The first time you add/edit, Xcode will automatically generate a new Info.plist file that’s kind of synced1 with Custom iOS Target Properties. Xcode will later merge them for you.
[1]: They’re not fully synced. Some properties like NSCameraUsageDescription will only appear in Custom iOS Target Properties, while Application requires iPhone environment will appear in both. I have no idea how Xcode determines this.
Want Info.plist back, completely?
You might want all of your app's properties in one place. Or maybe you don't trust Xcode with the merging. I spoke with an Apple engineer at WWDC21 about this... here's how to get the classic Info.plist back.
Create a new "Property List" file (File -> New -> File)
Name it Info.plist
Copy and paste the existing values from Project -> Targets -> Info -> Custom iOS Target Properties to Info.plist.
Copy
Paste
Note: Currently you can only select and copy 1 row at a time. If you want to save some time, here are the default contents in XML format. To use this, right-click Info.plist -> Open As -> Source Code, then paste.
Copy the path to Info.plist in the attributes inspector.
Paste the path here:
Project -> Targets -> Build Settings -> Info.plist File
Set Generate Info.plist File to No
Last step. Remove Info.plist from Copy Bundle Resources (select, then press the - button).
Project -> Targets -> Build Phases -> Copy Bundle Resources
Yep, that was a lot. But whether you want classic Info.plist or not is up to you — both are fine and won't change your app.
Xcode 13.3.1, macOS Monterey(12.0.1)
Here is the most simple solution which work for both swiftUI and Storyboard projects, if you are not able to find info.plist and want to add target properties like Privacy - Camera Usage Description and things like we can add in older Xcode version. Here is the solution...
***> Select target of you project on top of the files click on Info on
> top of the right side, now you can see "Custom iOS properties" like
> info.plist, do whatever you want.***
Target > Info
see the image below for reference
Here is a link to a raywenderlich tutorial: https://www.raywenderlich.com/19611194-multiplatform-app-tutorial-swiftui-and-xcode-12
The sample projects uses Xcode 12.0-compatible (objectVersion = 54) project format, created with the Multi Platform app template. I borrowed the plists from this project. Until the sample project is revised, it's nice to have a reference project (structure) for comparison.
This also applies to Xcode 14. To be brief, a few pieces of information about this change:
There is a good write up of the issue here:
https://useyourloaf.com/blog/xcode-13-missing-info.plist/
There is a good YouTube video (found in this page above):
https://youtu.be/mml9ZI81VKA
This issue applies to SwiftUI projects not Storyboard. Once you make
a change to the "standard" info settings, Xcode actually
automatically creates an info.plist file in your project navigator. You can then add more custom settings in the info.plist file.
I have a problem.
I have a XML and a project (XCode 4.1).
I must build my app with a XML file into this.
Now, where i put a XML file in my project?
In the XCode 3 there is a resource folder but now i haven't this.
Thanks
There should be a Supporting Files folder in your project. You might organize any extra files in this space.
You can put the XML file anywhere you like, so long as you subsequently make Xcode aware of its whereabouts. However, the most straightforward way is probably as follows:
Either:
Make a new group by going to File->New->New Group or
Use the existing Supporting Files group.
Drag the XML file into the group. Xcode will then present an add file sheet. Make sure that "Copy items into destination group's folder (if needed)" option is selected and your target is checked in the "Add to targets" list. Click "Finish".
That's it. Xcode should automatically add the file to the project and include it in your app's bundle.
Should you need to add the file "manually", you can select your project in the Project section of the Navigator pane (press Cmd-1 and select your project at the top left), select your target in the list (just to the right), select "Build Phases" from the tabs at the top and add the file to the "Copy Bundle Resources" build phase.
Just put it in Supporting files group.
I think this should help you.
I'm trying to create a static library in xcode 4, but i don't know how to generate the .a file. I added files to the library (.h .m) files, but when I run the the project the .a file is never generated. Do I have to do something special to generate this file? I'm following the steps in this
tutorial.
Thanks in advance.
The .a file was the product of the project file's target if memory serves.
It should show up under the "Products" group of the project navigator. If it is not red, you can control-click it and choose "Show in Finder".
I have a project (AQGridView) that compiles to a static library, but I can't seem to add it to my project.
Dragging in the project to my project creates a workspace, and if I try to link the libAQGridView.a file from the DerivedData directory it doesn't recognize it as a library. I'm not sure what I'm doing wrong.
This is the AQGridView project. Does anyone know specifically how to use it in an Xcode 4 project?
I do this as follows:
Drag in the static library project. If you have the static library project open in Xcode, close it now.
Select the main project in the project navigator (the project I'm adding the static library to) and in the editor, under the header TARGETS in the left-hand column, select my main project's target and navigate to the Build Phases tab.
Click the "+" for Target Dependencies and add the library icon target dependency from the added static library project.
Click the "+" for Link Binary with Libraries and add the library icon that is under the folder "Workspace".
It may also be necessary to enter a Header Search Path for the headers of the static library project if that is how the headers are linked in the static library project itself.
If you don't see the static library project as nested under the main project in the main project's project navigator, the most likely reason for that is that the static library's own Xcode project is still open. Quit Xcode and open up the main project that has the nested static library project in it without opening up the original static library project itself, and you should see it appearing as a nested project in your main project.
Xcode menu > View > Utilities > File Inspector
Select the static library file, and then set 'File Type' as 'Mach-O object code' in 'Identity and Type'.
Workspaces are supposed to make this easier, but I don't know that they do. The way I do it is create a workspace, add my main project, add my library project. Then go into the main project's build phases and add the library in the "Link binary with libraries" section and add the library. That should be all that is necessary, at least that's my reading, but it isn't. What I do is go into Xcode preferences, then to the Source Trees pane. Add a source tree that points to your static library's headers, then go back to the build settings for your project, then to the Header Search Paths key, and enter ${foo} there, where "foo" is whatever you called the source tree.
That's what works for me, though I don't know if that's the best or easiest way to do it.
Find your .a file in finder, and drag it into your project.
Select the 'copy items into destination group's folder (if needed)', and add your headers to your project.
Now, Xcode 4 should automatically link against that framework for you.
Here is what the library should look like in your project:
Follow Apple's documentation.
In brief:
Link your target against the library.
Add -ObjC to 'Other Linker Flags' (OTHER_LDFLAGS) under the target's build settings.
Also, I needed to add the library to the scheme of my main project since the library was not visible in the target's dependencies.
The Halle's answer works for me with one addition:
Check in Build Settings of the static library project the Private( or Public) Headers Folder Path value and copy it.
Add copied value to the client project Build Settings Header Search Path or User Header Search Path depending of the include directive you are using
I don't think I'm including the FMOD library correctly. I'm getting the following XCode error:
expected specifier-qualifier-list before FMOD
I'm using XCode 4 and the latest version of the FMOD library. I went into the "Link Binaries With Libraries" section in XCode and added libfmodex_iphonesimulator.a.
Any ideas on what I could be doing wrong?
Thanks!
Here is a step-by-step process for getting FMOD running in an iOS application:
File -> New Project
iOS -> Application -> Window based application
Choose name and location (I used 'test' and the FMOD examples directory as the location)
Assuming you named the app 'test', rename 'testAppDelegate.m' to have the extension '.mm' to allow C++ code.
Edit 'testAppDelegate.mm' to have #import "fmod.hpp" at the top.
Project -> Edit project settings (ensure Configuration at the top is set to All configurations)
Go to "Other linker flags" and type in -lfmodex_$PLATFORM_NAME
Go to "Header search paths" and type in ../../api/inc
Go to "Library search paths" and type in ../../api/lib (now close settings).
Right click on the "Frameworks" group on the left, choose Add -> Existing Frameworks, then choose 'CoreAudio.framework'
Repeat step 10 but choose 'AudioToolbox.framework'
Add FMOD code to 'testAppDelegate.mm' as needed, see playSound example for reference code.
After you link the appropriate library make sure you drag the 'inc' folder with all of the .h files into your project somewhere, that was my issue. Also, make sure you include AudioToolbox and CoreAudio if you did not already, and make sure to include fmod.hpp and fmod_errors.h in your view controllers header.