'Will changing the info.plist of custom framework manually create problems in installing on device?
I made a custom framework from a xcode project with "example.com.a" bundle identifier using lipo -create
command by joining simulator and iphone architecture frameworks. So it has a bundle identifier "example.com.a" in it's info.plist
file by default. I am able to use this framework in my app and my app installs on device without any error
Now when i try to change the bundle identifier of the custom framework to something like "myapp.custom.framework" by manually editing the info.plist inside the framework folder instead of xcode project .
By doing this I am unable to install the .ipa in the device. It shows "Unable to install the app".
So my question is
1) Is manually changing the bundle identifier or adding keys to custom framework's info.plist affects the custom framework functionality ?
2) For changing the bundle identifier of custom framework do we need to change it in the main xcode project? Right now i am changing and adding keys in the info.plist which is there in framework folder.
Solution 1:[1]
After long research and trial i found that if we change the bundle identifier in info.plist inside the custom framework folder, it will create error while adding in a sample project, instead we need to change the bundle identifier from the XCode project for framework and then generate iPhone and Simulator .framework
and use lipo -create output
to combine them and create a universal library.
Following are the steps :
To build and distribute universal/fat frameworks: In the framework project:
Build xcode framework project for simulator and build for device, this will produce two frameworks in the derived data folder.
Find the derived data path for the project. Look for the folder
Build->Product
s. Inside it should be '-iphoneos' and '-iphonesimulator'. Inside each is a .framework folder. Copy one of those to some nice folder. From each of those .frawework folders, copy the binary that is in there to one folder.
In Terminal:
In terminal run the command
lipo -create -output <outputName> <binaryFromiphoneos> <binaryFromiphonesimulator>
. This will create a fat binary with all architectures for both simulator and devices. Replace the one in the copied .framework directory with the newly generated one preferably inside the folder of iPhone platform framework.Run
lipo -info <framework path>
in terminal to know about the architecture of the framework . Eg: X86 denotes simulator , arm64, arm7 denotes iphone devices.
To use the framework in another app:
- Select the
Project
in the Project Navigator, select the target, and selectGeneral
tab. - drag the .framework folder onto where it says 'Add embedded binaries here'.
- In the build settings of the target, add the path to the .framework folder to 'Framework Search Paths'.
- Import files in your source code using #import
<frameworkName/frameworkName.h>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |