Theos did not specify a target error - ios

Trying to build a tweak using theos and having this error
/var/theos/makefiles/common.mk:103: *** You did not specify a target, and the "i phone" platform does not define a default target. Stop.
My Makefile is as shown
ARCHS = armv7 armv7s
SDKVERSION = 7.0
TARGET = iphone:7.0
include /var/theos/makefiles/common.mk
BUNDLE_NAME = sometweak
bustiming_FILES = Toggle.xm
bustiming_INSTALL_PATH = /Library/Application Support/CCToggles/Toggles
include $(THEOS_MAKE_PATH)/bundle.mk
Not sure what am I missing out, I've searched multiple websites and they said it's because of the missing TARGET in the Makefile however it's not working. Any advise is appreciated thanks.

Try
include $(THEOS_MAKE_PATH)/ instead of /var/theos/
Also try listing your Target as TARGET = iphone:latest:7.0
Finally, make sure before you use build, you have set the environment variables :-
export THEOS=/opt/theos
export THEOS_DEVICE_IP=192.168.0.2 (your phone ip)
export SKDVERVSION=7.0 (or whatever you are building for)

Related

Xcode Localizable.string multiple targets issue

I have a project with multiple targets, which represent the same app just with different styling and translations.
Since almost whole project looks the same for each target, I need to have just few strings in Localizable.strings file, that I need to be different. And I don't want to copy whole huge Localizable.strings file to each project just because of the fact it has few lines different.
It is required for me to have just 1 strings file because of third-party libraries/SDK that are included in project. So I cannot use tableName for localizedString.
The problem is - I need to have a flexible possibility to override just few lines from Localizable.strings for each target separately. And I don't like the idea just to copy whole file to each target, cause it will lead to annoying flow in the future, in case I will have 10 targets and I need to add 1 string to all of them.
The goal is to have 1 huge Localizable.strings file with all strings included, that would be common for all targets, and have small configuration for each target for the strings that should tell different. So target's file should kinda merge and override the one that is common.
AFAIK it is not natively supported by Xcode, so I'm probably looking for a script that would make it works.
So, script should look into common and target's Localizable files, merge them, and in case some keys are defined in both, then it should use the one from target's file.
Can anyone help me with such script?
P.S. Similar issue exists with .xcassets, and CocoaPods solves it by merging multiple assets into 1, and it works as expected - if some targets has an asset containing the image with the same name that is already included into a common asset, then the one from target will replace it.
P.S.2. Similar feature is natively supported for Android devs - each image, each translations can be overridden by "child" flawor, or whatever it is called :)
TL;DR:
Example project: https://github.com/JakubMazur/SO45279964
OK, the easier thing to do would be shell/python script, because it will work for every build server. I assume that you have a different scheme for each target (otherwise it will make no sense). So what you can do is:
Let's say your target is named:
target1
target2
target3
1) Create separate files contains all the strings that should be different (i will put it under Localizable directory.
Your Localizable.strings file may look like this:
"someGeneralString" = "General string 1";
"AppName" = "This is a string that you probably need to change";
"someOtherGeneralString" = "General string 2";
And any of your targetX.strings file may look like this:
"AppName" = "target[x]"
And here is how it should look like in your project:
Note that your target localizable files should has target membership set only to one target, but your Localizable.strings should be for all targets!
That's all for project configuration. Let's go to scripting (I will use python for that):
#!/usr/bin/python
import sys
supportedLanguages = ["en","pl"]
commonPath = ".lproj/Localizable.strings"
keys = ["AppName"]
class CopyLocalizable():
target = ""
def __init__(self,arg):
self.target = arg
self.perform()
def perform(self):
for lang in supportedLanguages:
pathToLocalizable = lang+commonPath
textToFile = ""
with open(pathToLocalizable,"r") as languageFile:
for line in languageFile.readlines():
for key in keys:
if key in line:
textToFile += self.foundAndReplace(key,lang)
else:
textToFile += line
self.saveInFile(pathToLocalizable,textToFile)
def foundAndReplace(self,key,lang):
pathToTargetFile = "Localizable/"+lang+".lproj/"+self.target+".strings"
with open(pathToTargetFile,"r") as targetFile:
for targetLine in targetFile.readlines():
if key in targetLine:
return targetLine
def saveInFile(self,file,stringToSave):
with open(file,"w+") as languageFile:
languageFile.write(stringToSave)
You can optimize it yourself. It's easier script i can think about to get a job done.
And in the end let's automate it a bit:
- Go to your target
- add a new build phase
- Add a new script:
export PATH="/usr/local/bin:$PATH"
cd SO45279964/
python localize.py target[x]
and watch a magic happen ;)
http://www.giphy.com/gifs/26n6NKgiwYvuQk7WU
Here you can find example project that I've created to run this example:
https://github.com/JakubMazur/SO45279964
To keep it simple, Have a Macro defined for each target in Build Settings & define target specific strings within macro section like
#ifdef __TARGET__
//key values in localizable file
#endif

Xcode 8 Beta - Convert to Current Swift Syntax Failed: Could not find test host

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

xcodeproj adds framework but linker can't find it

I'm adding a custom framework to my Xcode project using the xcodeproj Ruby Gem:
top_group = project.groups[0]
framework_ref = top_group.new_file(framework_path)
target = project.targets[0]
target.frameworks_build_phase.add_file_reference(framework_ref)
When I then open Xcode and look at the target, the framework is listed correctly under Linked Frameworks and Libraries, yet the linker complains that the framework cannot be found when building. Dragging the framework in the Linked Frameworks list in Xcode fixes it, and I can build successfully.
Why? Dragging seems to force Xcode to regenerate the project.pbxproj and add a missing reference. What would that be?
you need to set the path where your framework is!
append the path in build settings for "FRAMEWORK_SEARCH_PATHS"
settings = target.build_settings("Debug")
settings["FRAMEWORK_SEARCH_PATHS"] = [settings["FRAMEWORK_SEARCH_PATHS"], your_framework_directory ]
or
settings["FRAMEWORK_SEARCH_PATHS"] = settings["FRAMEWORK_SEARCH_PATHS"] + " " + your_framework_directory ]
Append the path in build setting as follows:
#Add framework search path
settings = target.build_settings("Release")
settings["FRAMEWORK_SEARCH_PATHS"] = Array(settings["FRAMEWORK_SEARCH_PATHS"])<< '$(PROJECT_DIR)/SDK'
settings["LIBRARY_SEARCH_PATHS"] = Array(settings["LIBRARY_SEARCH_PATHS"])<< '$(PROJECT_DIR)/SDK'

Qmake get the target output file path

I have a qmake project that looks like this:
TEMPLATE = lib
CONFIG += dll
TARGET = mydll
SOURCES += ...
HEADERS += ....
Now I want to add an INSTALLS section, so I have:
target.path = /path/to/somedir/
target.files =./$$TARGET
INSTALLS+= target
Unfortunately this will not work, because $$TARGET contains the target name, and not the output file name. Is there a portable way to obtain the output file name? (Please no platform dependent string concatenation like lib + $$TARGET + .so)
You don't have to specify target.files, target is a special case and it's predefined in qmake.
http://qt-project.org/doc/qt-4.8/qmake-environment-reference.html#installs
If you append a built-in install set to the INSTALLS variable and do not specify files or extra members, qmake will decide what needs to be copied for you. Currently, the only supported built-in install set is target:
target.path = /usr/local/myprogram
INSTALLS += target
In the above lines, qmake knows what needs to be copied, and will handle the installation process automatically.

Qt / QMake iOS Set Target, Device, other XCode settings

Qt for iOS creates an XCode project when you execute a build.
How does one dictate the XCode project settings from Qt to set a "target" (minimum iOS version) and "device" (Universal/iPhone/iPad), as found on the "General" tab in XCode when this project is opened?
I could not find this documented anywhere, but I figured it out.
In your qmake (pro or pri file) add these lines:
# Set "Target"
QMAKE_IOS_DEPLOYMENT_TARGET = 5.0
# Set "Devices" (2=iPad Only)
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 2
Note for devices: 1=iPhone, 2=iPad, 1,2=Universal.
If you need to change other XCode project settings here's how you can:
After a build in Qt for iOS look at the "Compile Output" tab.
You will find a list of "export VARIBALE=some_value" entries.
To change one of these XCode build settings, simply use QMAKE_IOS_VARIABLE_NAME = my_value in your qmake.
For more info on these environmental varibles, check this out: Xcode Build Setting Reference
-- UPDATE --
I was wrong about the last part. You can't set all the XCode variables quite like that. If you output QMAKESPEC, however, you will get the path where you can find a qmake.conf file which will display some of these undocumented variables. Do so like this in your pro / pri:
message( $$QMAKESPEC )
That path will appear in the Qt console "General" tab when you build the project.
Here's an extended version I'm now using, with some logic for setting the build architectures:
greaterThan( QT_MAJOR_VERSION, 5 ){
DEFINES += QT_VER_5_4_OR_NEWER
}
else:equals( QT_MAJOR_VERSION, 5 ) &&
greaterThan( QT_MINOR_VERSION, 3 ){
DEFINES += QT_VER_5_4_OR_NEWER
}
contains(DEFINES, QT_VER_5_4_OR_NEWER){
DEFINES += SUPPORT_64_BIT_IOS
message( "SUPPORT_64_BIT_IOS" )
}
contains(DEFINES, SUPPORT_64_BIT_IOS) {
iosArchitectures="armv7 arm64"
iosTarget=5.1.1
}
else{
iosArchitectures=armv7
iosTarget=5.0
}
# Set "Architectures"
QMAKE_IOS_DEVICE_ARCHS = $$iosArchitectures
# Set "Target"
QMAKE_IOS_DEPLOYMENT_TARGET = $$iosTarget
# Set "Devices" (1=iPhone, 2=iPad, 1,2=Universal)
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 2

Resources