When I use hpple and build, aways show " 'libxml/tree.h' file not found " error.
I have ,
set [Header Search Path] "${SDKROOT}/usr/include/libxml2"
set [Other Linker Flag] value as "-lxml2"
Oh, sorry, I just set the TARGETS's Build Settings forgot set the PROJECT -->Build Settings.
Step 1: Target--> In Build settings-->Header search path-->press return(enter) key--->replace /usr/include/libxml2
Step 2: Target--> In Build phase--> confirm it whether "libxml2.dylib" framework is present, if not added
Step 3: Target--> In Build phase--> search libxml2.dylib then click add button
Refer Screenshot:
Related
I am receiving an error message when I try to use Xcode 8's Convert Wizard.
After trying rebooting, downloading fresh code, and deleting my DerivedData files I cannot escape this error:
Convert to Current Swift Syntax Failed: Could not find test host
I have tried both options which are: Swift 2.3 and Swift 3. After I select a version I instantly get that error.
Here is a screenshot of the error:
This worked for me:
Select the Xcode project in the lefthand browser.
Click on your test target in the Project's General tab.
Disclose "Testing". In my project the "Host Application" pulldown button was blank. Select your appropriate host application.
Try building your test target now. If that succeeds then converting syntax should as well.
I had this problem after installing the Xcode 8 beta so I assume this is related.
Picture Credit to #karthikkck
It cost me a bit of time to find the "Host Application" pulldown mentioned in the otherwise very helpful answer by iluvcapra.
So this is what he meant:
This is where you find the pulldown menu. Select your main target.
I find easy fix for this, just edit your Scheme and disable tests.
And run conversion again.
+1 iluvcapra
Alternatively, use text editor to remove the following two items from your MyAppSwift.xcodeproj/project.pbxproj file, search for TEST_HOST
Now, re-open your project and run the convert wizard again.
4EFFFAE51B53D5D8003CD25A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "AF SwiftTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) #executable_path/Frameworks #loader_path/Frameworks";
PRODUCT_NAME = "FA SwiftTests";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AF Swift.app/AF Swift";
};
name = Debug;
};
4EFFFAE61B53D5D8003CD25A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = "AF SwiftTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) #executable_path/Frameworks #loader_path/Frameworks";
PRODUCT_NAME = "FA SwiftTests";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AF Swift.app/AF Swift";
};
name = Release;
};
Please try these Steps:
Select your project on the left side of Xcode.
Go to Targets and select your Project Tests.
Select the General Tab and select Host Application drop down and choose your Host Application.
Convert or Run your project.
Trying these steps worked for me.
In my case I deleted my tests target, then re-added it using the + below targets and selecting "iOs Unit Testing Bundle"
For some reason this got a compile error, so I changed the "Per-configuration Intermediate Build Files Path: for my test target to $(PROJECT_TEMP_DIR)/$(CONFIGURATION) for both debug and release. This allowed the compile to work.
Fix this in 3 steps:
First delete your test target
The select Edit -> Convert -> To current Swift syntax... and perform the conversion
Then add a new test target
Is there any way to display the CFBundleShortVersionString as a UILabel text in my LaunchStoryboard without entering it by hand every time it increments? I know how to do it in code, but it is not possible to run code while the LaunchStoryboard is shown.
Is it possible through Xcode variables?
As we all know, you can't put code in a launch screen. And unfortunately there isn't a built-in way to use a variable for a label's text in the launch screen (similar to how you can preprocess Info.plist with values in a header file).
The only option available to achieve your goal would be to write your own script that updates the LaunchScreen.storyboard file and add that script as a custom Build Phase for your target.
To make this easier, I would setup your target to use a preprocessor file for Info.plist. Once that is done and working, you now have a separate and simple header file you can interrogate in your script to process the LaunchScreen.storyboard file.
Here's a complete solution:
Create a file named Info.h and add it to the root of your project.
Add the following line:
#define APP_VERSION 2.6 // Update this version as needed
Now select your project's target in Xcode and go to the General tab. Change the Version value from whatever number you have there to APP_VERSION.
Now select the Build Settings tab. Search on Info. Under the Packaging section, set the Preprocess Info.plist File to Yes. Also set the Info.plist preprocessing Prefix File to Info.h.
Now when you do a build, the CFBundleShortVersionString value in Info.plist will be set to the value in the Info.h file.
To get the label in the launch screen file updated to match, do the following:
Select your launch screen storyboard and then select the label that will contain the version number. Show the Identity Inspector pane. Enter APP_VERSION into the Label attribute. If you look at the storyboard file now, the XML for the label will now show a userLabel attribute with the value of APP_VERSION.
Go back to the project target and select the Build Phases tab. Click the + icon and choose to add a New Run Script Phase. Rename the new phase to something useful like "Update Launch Version". Then drag the new phase to before the existing "Copy Bundle Resources" phase.
Now open the new "Update Launch Version" phase. Enter /bin/bash in the Shell field. Copy and paste the following code into the phase:
VERSION=`cat Info.h | grep APP_VERSION | cut -f3 -d' '`
sed -e "/userLabel=\"APP_VERSION\"/s/text=\"[^\"]*\"/text=\"$VERSION\"/" Storyboard.storyboard > tmp.storyboard
Now do a clean build. This is a test at this point. Have a look at tmp.storyboard and make sure it looks correct and the label for the app version is showing the proper version.
Once that is working, update the above code to:
VERSION=`cat Info.h | grep APP_VERSION | cut -f3 -d' '`
sed -i bak -e "/userLabel=\"APP_VERSION\"/s/text=\"[^\"]*\"/text=\"$VERSION\"/" Storyboard.storyboard
This final version actually updates the launch screen storyboard file. The previous version was a test to make sure everything else was working without risk to trashing your storyboard.
I figured out the script to update the Version & Build label on LaunchScreen.storyboard based on the first answer without using any extra files. Unfortunately, Clemens Brockschmidt's solution doesn't work due to some Syntax errors and incorrect paths.
Make sure to name your label to "APP_VERSION" in Identity Inspector pane -> Document -> Label.
Also create your script before "Copy Bundle Resources" phase.
UPDATE: My older answer didn't work in the newest Xcode environment. I've fixed the current issues and refactored the script.
And here's the final working script with shell: /bin/sh in XCode 11 (Swift 5):
# ON/OFF Script Toggle (script ON with #, script OFF without #)
#exit 0
# Increment Build Number Bool (Increment ON with true, increment OFF with false)
shouldIncrement=false
# App vesion / Build version constants
sourceFilePath="$PROJECT_DIR/$PROJECT_NAME/Base.lproj/LaunchScreen.storyboard"
versionNumber="$MARKETING_VERSION"
buildNumber="$CURRENT_PROJECT_VERSION"
# Increment build number
if [ "$shouldIncrement" = true ]; then
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
fi
# Output version & build numbers into a label on LaunchScreen.storyboard
sed -i .bak -e "/userLabel=\"APP_VERSION\"/s/text=\"[^\"]*\"/text=\"$versionNumber($buildNumber)\"/" "$sourceFilePath"
As a BONUS I've included a build number incrementer and ON/OFF script toggle to disable your incrementer when you build your project a lot. Let me know if you have any issues or if this works for you.
Edit
There is no way to make the launch screen dynamic. Doesn't work good
with localizations too etc
A alternative is given below
Previous Answer
You should make your inital VC similar to the LaunchScreen.xib and in that make a label.
Now in the ViewController you can access the info plist through NSBundle method and set its value. This would make the transition from Launch screen to first VC smooth and look natural with version code animating in or something if you want
let appVersion = NSBundle.mainBundle().infoDictionary["CFBundleVersion"];
myLabel.text = "\(appVersion)"
While integrating latest robbiehanson's XMPPFramework, I came up with an error : CocoaAsyncSocket/GCDAsyncSocket.h' file not found
and a simliar kind of error:
/Users/Con/Documents/PROJECTS/Cor/Cor/Libraries/XMPP Framework/Core/XMPPLogging.h:62:9: 'CocoaLumberJack/DDLog.h' file not found
Help!
open your Built Setting on your project, then set it like
User Header Search Paths = $(SRCROOT) // recursive.
Always Search User Paths = YES
I got the following error when add a 3rd party library:UMSNSLibrary.a
Please help, thanks!
" ld: duplicate symbol _OBJC_IVAR_$_UMSNSJsonParser.c in /Users/macbookpro/Downloads
/UMSNSLibrary.a(UMSNSJsonParser.o) and /Users/macbookpro/Downloads/HeXuanDemo EN/Build/Products/Debug-
iphoneosbThree20UI.a(UMSNSJsonParser.o) for architecture armv6 "
Simply try to delete file form one of the Location you don't need:
either from
/Users/macbookpro/Downloads /UMSNSLibrary.a(UMSNSJsonParser.o)
or /Users/macbookpro/Downloads/HeXuanDemo EN/Build/Products/Debug- iphoneosbThree20UI.a(UMSNSJsonParser.o)
Clean the build and reset simulator and launch again.
I think it will resolve this.
Target->Build Setting->Header Search Path / Library Search Path : Remove unwanted path from there.
Hy, I want to use the QuickDialog library but gives me error.
The step that I made:
download it from github
copy the directory into my project's directory
add QuickDialog.xcodeproject
my project --> Build Phrases:
Target dipendencies: add QuickDialog
link Binary : add libQuickDialog.a
include in mi file Prefix.phc :#import
my project --> Build Settings:
Other linker flags: -ObjC
User header search paths : "${PROJECT_DIR}/QuickDialog" and check the box
always serach user path : YES
run
But give me the error:
QuickDialog/QuickDialog.h file not found
What is wrong???
Please help me!!
If you put this: "${PROJECT_DIR}/QuickDialog"
and you try to import "QuickDialog/QuickDialog.h"
that means that he goes in directory: "${PROJECT_DIR}/QuickDialog/QuickDialog/QuickDialog.h" ?
Did you try to put just: "QuickDialog.h" ?
EDIT: The solution is here: Including QuickDialog into Xcode 4.2 Project