New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Frameworks): set Header Target Membership 'type' to Public || Private || Project #222
Comments
I dug-in to the project.pbxproj, and can confirm that the attributes do indeed belong to the PBXBuildFile. From the top of the document (see Booking.h):
So, I tried brute-forcing the edit of the for i in 0..proj.objects.length - 1
obj = proj.objects[i]
if obj.class == Xcodeproj::Project::PBXBuildFile
build_file = obj;
build_file.settings = { 'Attributes' => ['Public']}
proj.save
end
logger.info obj.uuid
logger.debug obj.pretty_print
end I can see that the UUID's of the PBXBuildFile's match those in the project.pbxproj, and the logger output shows that the settings of the build files have been set; but, they do not appear to be written to the *.pbxproj.
|
This was what I did to set a file to be a public header in a framework in a project using xcodeproj, https://github.com/orta/cocoapods-keys/blob/master/lib/installer.rb#L42-L47 |
@orta Thanks! this solved the issue. I think I was failing to uppercase the complete "ATTRIBUTES" string. # works
target.headers_build_phase.files[-1].settings = { "ATTRIBUTES" => ["Public"] }
#fails
target.headers_build_phase.files[-1].settings = { "Attributes" => ["Public"] } |
@orta Is there a documentation location where I could post some code samples for this and some similar topics? |
Nope, IMO, I'd love something like this, as I also just had to iterate a bunch of times till I found the answer. |
I thought this "Header" Build Phase was officially recognized broken and obsolete by Apple, and that they suggest to use the "Copy Files" Build Phase instead? Or is it only with static libraries and not frameworks? Or maybe they did fix that since Xcode 6? |
@AliSoftware when creating a framework manually using Xcode and changing the visibility of a header from the inspector, they end up in the "Headers" build phase, so I think this was either fixed or did never apply to frameworks in the first place. |
Couldn't framework_target.headers_build_phase.add_file_reference(file_reference, 'Public') ? |
For me the following script worked posted by @sstadelman , I changed 'Attributes' -> 'ATTRIBUTES'
|
I am trying to set the Target Membership 'type' to Public, for headers which should be made public in an iOS Framework. I have a script which adds classes to the project and target, and I can successfully build and utilize the framework classes, after switching this value manually.
This may be currently possible via the PBXBuildFile
#settings
instance attribute, but I don't see the (seemingly) correct values taking effect.The Xcode UI shortcut is located here. Note that I've already switched the value from "Project" to "Public" on the Booking.h class".
This is logically equivalent to moving the headers between the "Project" (default), "Private", and "Public" sections in the Target > Build Phases > Headers menu.
I've been trying to use the PBXBuildFile and PBXHeaderBuildPhase to set this value, with no success, as follows:
outputs:
I've also tried initializing the PBXBuildFile directly on the Project + PBXFileReference, but do not see a method for adding it to the target references.
It seems that the API for this value should be on PBXFileReference, or PBXBuildFile. Does anyone know if this is available?
The text was updated successfully, but these errors were encountered: