thii / FontAwesome.swift

Use FontAwesome in your Swift projects
MIT License
1.57k stars 265 forks source link

Error during build #75

Closed natalia-osa closed 8 years ago

natalia-osa commented 8 years ago

During build (debug) I receive such errors:

egrep: .../Pods/FontAwesome.swift: Is a directory
egrep: .../Pods/Target Support Files/FontAwesome.swift: Is a directory

Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure

In fact, project name generates it. What can we do with it not to have this error?


Xcode 7.3.1 FontAwesome.swift (0.7.3)

thii commented 8 years ago

May I see a sample of your Podfile and your code?

natalia-osa commented 8 years ago

Here is the Podfile:

platform :ios, '9.0'
use_frameworks!
inhibit_all_warnings!

pod 'Fabric'
pod 'Crashlytics'
#etc....

target 'MyApp' do
    pod 'FontAwesome.swift'
end

target 'MyAppTests' do
    pod 'Quick', '~> 0.9'
    pod 'Nimble', '~> 4.0'
    #etc...
end

target 'MyAppUITests' do
    #etc...
end

And here is the code usage:

textField.leftView = UIImageView(image: UIImage.fontAwesomeIconWithName(.FileTextO, textColor: UIColor.blackColor(), size: CGSizeMake(20, 20)))

While performing pod install there is the information which version is installed == 0.7.3.

thii commented 8 years ago

I could not replicate the error. You might want to do a clean build and/or delete all derived data.

natalia-osa commented 8 years ago

That was the first thing I've tried, unfortunately didn't help. It seems that my custom script (quite common in fact) is taking part in generating the issue:

if [ "${CONFIGURATION}" = "Debug" ]; then
TAGS="MYToDo:|MYFixMe:|MYHack:|MYTemp:|MYWarn:"
echo "searching ${SRCROOT} for ${TAGS}"
find "${SRCROOT}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
fi

I have flag treatWarningsAsErrors turned to true, so this is how I declare temporary hacks/warnings/todos. As far as I saw, it's quite a common scenario, so there may be more people experiencing it. Here the script tries to iterate by .swift files, and your project is ending with .swift, so it displays an error. What is worse, it will work like this for all greps not only such one. Ofc, changing 4th line to find "${SRCROOT}/ProjectName/Code" clears the warning, as Pods folder is not browsed then, but that's more like a workaround than real fix.


Anyway, it seems that something gets installed incorrectly:

button.setTitle(String.fontAwesomeIconWithName(.FileTextO), forState: .Normal)

-> displays box with ?, while

let button = UIButton(type: .System)
textField.leftView = UIImageView(image: UIImage.fontAwesomeIconWithName(.FileTextO, textColor: UIColor.mfDefaultBlueColor, size: CGSizeMake(20, 20)))

-> displays the icon correctly.

I'm not sure whether this is a kind of bug or it's a known issue or that's because of install error quoted in first post under this issue.

thii commented 8 years ago

You forgot to set font for your button's titleLabel.

On Jun 6, 2016, at 7:48 PM, Natalia notifications@github.com wrote:

That was the first thing I've tried, unfortunately didn't help. It seems that my custom script (quite common in fact) is taking part in generating the issue:

if [ "${CONFIGURATION}" = "Debug" ]; then TAGS="MYToDo:|MYFixMe:|MYHack:|MYTemp:|MYWarn:" echo "searching ${SRCROOT} for ${TAGS}" find "${SRCROOT}" ( -name ".swift" ) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).\$" | perl -p -e "s/($TAGS)/ warning: \$1/" fi I have flag treatWarningsAsErrors turned to true, so this is how I declare temporary hacks/warnings/todos. As far as I saw, it's quite a common scenario. Here it tries to iterate by .swift files, and your project is ending with .swift, so it displays an error. What is worse, it will work like this for all greps not only such one.

Anyway, it seems that something gets installed incorrectly:

button.setTitle(String.fontAwesomeIconWithName(.FileTextO), forState: .Normal) -> displays box with ?, while

let button = UIButton(type: .System) textField.leftView = UIImageView(image: UIImage.fontAwesomeIconWithName(.FileTextO, textColor: UIColor.mfDefaultBlueColor, size: CGSizeMake(20, 20))) -> displays the icon correctly.

I'm not sure whether this is a kind of bug or it's a known issue or that's because of install error quoted in first post under this issue.

― You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

natalia-osa commented 8 years ago

Probably I'll go with attributedText then.

Anyway, coming back to grep problem. It isn't a huge issue, because we can always change search paths, like I've written, so if you want you're welcome to close the issue. Or if you find it disturbing you can investigate the issue ;). Just having folder named FontAwesome_swift instead of FontAwesome.swift would fix it.

thii commented 8 years ago

There is no folder named FontAwesome.swift in this project. CocoaPods makes it based on the pod name. The only way to fix it is creating a new podspec and deprecate the current one but I wouldn't do it at the moment.

I suggest you to integrate it using Carthage. The framework name in Carthage is just FontAwesome.

natalia-osa commented 8 years ago

Ok, so to sum up for anyone else seeking help with this issue, there are 2 ways to bypass the issue:

  1. Integrate it using Carthage instead of Cocoapods. The framework name in Carthage is FontAwesome.
  2. Change search script so it begins on your own code instead of root folder (like in 5th post).

I totally agree deprecating the project because of such small detail is without any sense. Thanks for your help.