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

Incorrect file path for font assets on iOS #43

Open
TheHeumanModean opened this issue Jan 6, 2023 · 3 comments
Open

Incorrect file path for font assets on iOS #43

TheHeumanModean opened this issue Jan 6, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@TheHeumanModean
Copy link

Context

used ignite boilerplate this potentially changes iOS folder structure

Steps to reproduce

  • added custom font to ./assets/fonts
|
|_ assets
|_|_ fonts
|_|_|_ font-name
|_|_|_|_ ttf-file-name.ttf
  • changed react-native.config.js
module.exports = {
  assets: ['./assets/fonts/'],
}
  • ran npx react-native-asset
  • android builds fine and fonts are correct
  • iOS fails build with No such file or directory found on each of my ttf files

Steps that I did to fix

  • in the file ios/projectName.xcodeproj/project.pgxproj under the /* Begin PBXFileReference section */ replaced every ../assets/fonts/font-name/ttf-file-name.ttf with an extra ../ to make ../../assets/fonts/font-name/ttf-file-name.ttf

before

197A7A355453429EBCF9A29A /* ttf-file-name.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "ttf-file-name.ttf"; path = "../assets/fonts/font-name/ttf-file-name.ttf"; sourceTree = "<group>"; };

after

197A7A355453429EBCF9A29A /* ttf-file-name.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "ttf-file-name.ttf"; path = "../../assets/fonts/font-name/ttf-file-name.ttf"; sourceTree = "<group>"; };

@morwalz
Copy link

morwalz commented Jan 29, 2023

I have same problem. App builds but fonts do not work in ios. When i apply this fix, build start to fail.

@unimonkiez
Copy link
Owner

Not sure what the problem is, happily merge whatever PR you do to fix this

@unimonkiez unimonkiez added the bug Something isn't working label Feb 28, 2023
@cayleyh
Copy link

cayleyh commented Jun 15, 2023

The problem here is that the cordova-node-xcode library's project.addResourceFile() is to add the resource as "Relative to Group" in Xcode, which is "/Resources".

I'm investigating if there is an option on addResourceFile() that can set it relative to the project. I'll have a PR with a potential solution for discussion shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants