Skip to content
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

"don’t copy the file itself, just add a reference" #33

Closed
simonbromberg opened this issue Sep 29, 2017 · 8 comments
Closed

"don’t copy the file itself, just add a reference" #33

simonbromberg opened this issue Sep 29, 2017 · 8 comments
Labels

Comments

@simonbromberg
Copy link

How do you do that? Asking for a friend.
🤷 😅

@simonbromberg
Copy link
Author

simonbromberg commented Sep 29, 2017

Oh right, drag from Finder (Or drag within the project navigator) but don't select "copy files if needed" or just "File" > "Add files to …"

Note also have to add it to your target in the "File Inspector".

EDIT: Hm, that doesn't seem to be working for me. At runtime still not finding the list.

@simonbromberg
Copy link
Author

simonbromberg commented Sep 29, 2017

Hm, the file generated by pod install includes the target name (e.g. "Pods-MyTargetName-acknowledgements"), but the source code is just looking for a file named "Pods-acknowledgements" without the target name. But if I rename my reference it renames it in the pod target support folder too, so the next time you run pod install it doesn't overwrite the one that is references properly.

Should the default pod name not include the target name too?

Relevant source file

@vtourraine
Copy link
Owner

Hello Simon, and thanks a lot for your feedback!

We should probably be more explicit about the Xcode “reference” in our documentation; as you noted, the setup can be tricky.

But to address your latest issue: you don’t have to rename the plist file, instead I would suggest that you instantiate the view controller like so:

let path = Bundle.main.path(forResource: "Pods-AcknowExample-acknowledgements", ofType: "plist")
let viewController = AcknowListViewController(acknowledgementsPlistPath: path)

@simonbromberg
Copy link
Author

simonbromberg commented Oct 2, 2017 via email

@vtourraine
Copy link
Owner

When I first created this library, that was the default plist file name, so it made sense. I added the option to specify the file path/name later on, but never removed the original initializer. Maybe there are cases where it’s still useful, but maybe not. If not, I should probably remove that init, or at least deprecate it.

@simonbromberg
Copy link
Author

simonbromberg commented Oct 2, 2017

Yea, or you could change the default name to match the actual default name… (It looks like it's just the target name so you could get that using Bundle.main.infoDictionary?["CFBundleName"] as? String)

@vtourraine
Copy link
Owner

That’s a great idea. It’s probably more nuanced than that (dealing with spaces, capital letters, etc), but it’s definitely worth exploring. Feel free to send a pull request, otherwise I’ll try to implement that later on.

@vtourraine
Copy link
Owner

@simonbromberg So... I’ve implemented your idea:

class func defaultAcknowledgementsPlistPath() -> String? {

I was worried that some apps are probably relying on the old file name, so in order not to break the current behavior, I check with FileManager if the file exists, and if not I fallback to the old behavior. I don’t really like having to check explicitly, but that seems like a good compromise overall.

Thanks again for the idea, and feel free to improve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants