Leaf cannot find my template - Xcode 12 Vapor 4 - vapor

I updated from Vapor 3 to 4, and Xcode 11 to 12. Now Leaf cannot find my *.leaf templates. I get a "noTemplateFile" error.

I found the answer here: https://theswiftdev.com/how-to-create-your-first-website-using-vapor-4-and-leaf/
The trick was to add a "Custom Working Directory" in the scheme's options. I added my project's root directory and it worked.

Just modify your schema to be the directory for your Vapor server.
Step by step guideline here https://docs.vapor.codes/4.0/xcode/

Related

Xcode 10 convert to Swift 4.2 fails

I am getting this error trying to migrate to Swift 4.2 using the Xcode provided conversion tool. How do I fix it? The code builds fine otherwise.
Do you have any libraries in your project? I think you are trying to covert your project with dependencies and there are problems in them with new swift version. Try to uncheck all dependencies except your project and convert to new version of Swift
I had similar problem, solved it by
1- Change swift lang version in build setting of all app and test targets to 4.2
2- build app, errors will happen like UIControlState renamed to UIControl.state
3- fix all of the build errors
4- I updated all recommended settings by xcode
5- then I asked xcode to convert to swift4.2
It's always a good idea to upgrade all dependencies (e.g. via Cocoapods) to its latest version that support Swift 4.2. In my case, I also need to manually change the Swift Language Version build settings for a pod library from Swift 4 to Swift 4.2 as that lib uses some APIs in 4.2 only.
I have problem too. I find solution to fix this problem in web
https://ericasadun.com/2018/09/13/converting-projects-by-hand-to-4-2/
First
You try delete pod in pod file and install pod again and pod update in your folder project in command then conversion to Swift 4.2.
if it's not work do this in second.
Second
you try follow do this picture in build setting project or try follow do in link web.
As described here,
There may have been issues with processing the targets that will
negatively impact the migration process. Switch to the Report
Navigator and select the Convert entry that was added; this is the
conversion build log. Check the log for errors that may have showed
up.
If you see errors about not being able to code-sign the target, try
disabling code-signing from the build settings of the target. If you
see other errors, please file a bug report and include the details.
You are strongly encouraged to attach a project that illustrates the
faulty migration if possible.

Xcode 8 beta 4: Build fails with "The following binaries use incompatible versions of Swift:" error

With new Xcode 8 beta 4 we started experiencing the following error during CopySwiftLibs build phase:
Effective srcDirs: {(
<DVTFilePath:0x7f865961e970:'/Volumes/Data/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator'>,
<DVTFilePath:0x7f8657d02b20:'/Volumes/Data/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator'>
)}
error: The following binaries use incompatible versions of Swift:
/Users/user/Projects/git/iphone-swift-1/DerivedData/myApp/Build/Products/Debug-iphonesimulator/myApp.app/myApp
/Users/user/Projects/git/iphone-swift-1/myApp/myAppApi.framework/myAppApi
myAppApi is a subproject in the workspace that contains some shared code (it uses Alamofire).
One thing to note: originally we converted project from Swift 2.2 to Swift 2.3, and then manually upgraded to 3.0.
Does anyone have any idea what might be causing this error?
Thanks!
I had the same problem, but managed to fix it by:
Clean the project.
Close project and quit Xcode.
Clean derived data.
Open the project again and it's there, all nice and working.
I did this on Xcode 8 using Swift 3.
You can also get this problem, if you have the scenario of your container app's code is Swift 2.3 and you're creating a new extension in Xcode 8.
To solve the above scenario...
Note: All code has to be in the same swift (compatible) version to compile without failure.
That being said, one way you could solve this problem is by sticking to Swift 2.3 and then setting your Extension Target's Use Legacy Swift Language Version to "Yes".
You can find that option while Xcode 8 is open as follows:
Select your app project root in the Project Navigator (on the left-hand side)
On the right-hand side, select your extension under the TARGETS
section
Once the extension is selected, click on the Build Settings tab
Scroll down and find Use Legacy Swift Language Version and set it
to Yes from its drop-down menu.
You can now build the project
Note: You might need to fix the overridden code in the extension templates since they were originally in Swift 3.
Before doing anything...
(If you can use Xcode 8.0-compatible with your project)
By default your project is set to Xcode 3.2-compatible
Select your app project in the Navigator (on the left-hand side)
Select Project Document in the Utilities Panel (on the
right-hand side)
Change Project Format to Xcode 8.0-compatible
Try to build your project.
If it doesn't work, try the other solutions proposed.
Note:You can even switch back to Xcode 3.2-compatible after fixing the error and it should work, but you "might" have other build problems later.
Recommendation:
Before debugging an existing project. Close your project and zip a copy of your project file if you did not create a Git repository when you created your project.
I just had the same problem after updating Xcode to 9.3. I fixed the problem simply by just cleaning the build folder. You can do this with Command-Option-Shift-K or in the option menu "Product" -> "Clean" (see screenshot)
I fixed this by deleting the embedded binaries in the project. To do this:
Open your workspace/ project in Xcode.
Navigate to the actual project file (with the General, Capabilities, etc. ribbon).
Go to General > Embedded Binaries, remove by selecting on the ones you don't want and then clicking the minus sign.
Note 1: You shouldn't have to delete them from the "Linked Frameworks and Libraries" section (they should automatically be removed when you remove them from the "Embedded Binaries").
Note 2: I have a lot of dependencies and am using CocoaPods. I have nothing in the "Embedded Binaries" and only the "Pods_[YourApplicationName].framework" in the "Linked Frameworks and Libraries" section.
I had various libraries integrated via carthage. However during the process I switched some of them to cocoapods and forgot to remove the old .frameworks file from the project target.
Removing them solved the build error.
I had the same problem.
My solution was to rename the 'myApp'-directory to 'myAppmyApp' and then I ran the app again. A new 'myApp'-directory was made a the app did run very well again on my iPhone.
A difference with your situation might be this: the name of my app, let's say 'myApp' in the directory 'DerivedData' was myApp concatenated with: '-'
Maybe this will help you.
You need to switch all the dependencies to swift 3.
In your case, Alamofire need to be switched to Swift 3 branch
I had the same error message after adding a Swift 3 version of a framework.
My target framework search path was still configured to find both swift 2 and swift 3 version of the same framework, so my project got stuck on swift 2.3 version.
For me, the solution has been to remove the old framework from my project directory and delete its folder reference from the framework search path.
So I just post the solution I found so far after an hour debugging.
Since Xcode 9, this can be tracked by the compiler log.
If you scroll down to the bottom of the compiler log, you will find this issue is caused by type checking crash.
Just had this pop up after upgrading to Xcode 10.2 ... one of my pods uses Swift.
Fix was to:
pod repo update
rm -rf Pods
pod install

Xcode 8.0 Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

When I compile my code on Xcode Version 8.0 beta 4 (8S188o) I get this single error bringing the compilation to failure:
Command
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc
failed with exit code 1
I tried to clean the project and wipe the derived folder but that did not change things.
What is it and how may I know more about it?
When I try to compile on the terminal the error being reported is:
Invalid bitcast\n %.asUnsubstituted = bitcast %swift.error* %13 to
i2, !dbg !438\nLLVM ERROR: Broken function found, compilation
aborted!\n
Happened to me, when I had two classes with the same name in my project. After deleting the redundant one, error disappeared.
If you look above the error, Xcode will tell you which ViewController is added/declared twice, navigate to it and remove the reference. Build and you're good to go.
I am going to tell you my silly mistake, the error is showing the issue and It took 3 hours to me to understand. look into below error
look into above 2 lines of error, the problem is shown, Obviously, In my case Xcode is complaining that Location.swift and Customer.swift file is missing, look into my project hierarchy, the same issue can understand.
It's my advice to everyone that first understand the error and then look into issues. I removed my desktop files, which were referenced in the project, and therefore compile error occurred.
Clean your project that fixed my project
Product/clean
I got this error for core data models that i've created manually.And it got resolved by changing particular entity's 'Codegen' attribute to 'Manual/None' under Data Model Inspector.
If you change any file folder location or change any Objective-C Bridging file path. Then it's happened some time.
Update your Bridging path.
Clean your project alt + Shift + Command + K
Quit Xcode completely Command + Q
Open project again and wait for Xcode to index files.
I got this error when I was trying to run an xcode project. A swift file wasn't being found and complied correctly, even though clearly in the xcode project file you can see the swift file and when you click on it in finder the file comes up as a separate xcode swift file. I solved this by:
Deleting the problematic swift file
Creating a new swift file with the same name
Xcode prompts that the file is already created, press replace
copy/replace the code/etc. in the file
Clean the project (for good measure)
Run the project
The problem went away by itself for mysterious reasons. Instead of the whimsical linking error I got a new bunch of errors due to Swift 3 fling which the app compiles and run fine.
The solution that worked for me is I had to delete the .xcdatamodeld file in my project and create a new one. This solved it.
I got this error and resolved by changing Xcode command line tools,
Goto Xcode -> Preferences -> Choose Locations tab
Choose required Command Line Tools from drop down, run the project error has been fixed.
In my case the error triggered when Xcode could not find a file/folder from the external Framework and dependency. In such a case just pod update / pod install do the job.
Try removing inactive file(deleted file) from Build phases...
Based on #Mohammed Rizwan N answer
If error not gone, do the clean project and close Xcode. Then click right button on .xcodeproj/.xcworkspace file and choose appropriate Xcode version.
In my case, I tried to run a project in Xcode9/Swift4, while the project was written on Xcode8/Swift3
1.Go to build settings and check the path of the info.plist file and bridging header file.
2.If not sure they are correct , from the left side drag and drop the files into respective fields .This creates the path automatically .
Clean the project and build again .
I created 3 new groups and put my MainVC under one of those groups. After I deleted one of the new groups I created, the error went away after I cleaned my project.
Please update your entire log which suggests the error, mine is telling me I have duplicated classes in file
Try closing Xcode, cleaning the project and building again.
At first, cleaning wasn't enough. I had to actually close it and try again.
I faced this issue when I resolved git conflict for the project file, which was for adding and removing some files.
What I found out is Xcode creates the folder named folder named "Recovered References", just search this from bottom left search option from Xcode and delete it. After you delete it you will only get an error for missing files. Resolve that by adding files again by right-clicking and selecting add files option. Once you are done with it project compiles with no error.
Happened to me when I found two swift files with the same name within the project, even if the classes have different names.
In my case error came when I moved my bridging-Header.h file from one folder to another. and when I checked in Build Settings -> Objective-C Bridging Header it was showing old path. Then I moved that file back to previous folder.
My problem was that my machine was running out of available space. Restarting it cleaned up ~8GB of temporary files, but I guess you can also delete something instead.
This is mainly because xcode is not getting the exact path of any file or duplication of file name under linking area.
In my case I have added bridge header file under Resources file and added the path in
BuildSettings->Objective-C bridge header-> bridgehearfilename.h
You should specify the exact path of that file in this section.
eg: BuildSettings->Objective-C bridge header-> Projectfolder/Resources/bridgehearfilename.h
Correct your file paths in the build settings then Clean and build the project.
For me it was ,
Product > alt + Clean Build Folder
OR
alt + Shift + Command + K
Do these 3 steps:
Clean Project: Shift+Command+K
Make sure low disk space shouldn't be on your mac
Focus on the upper lines of this error...Try reading them again...Paste those files that are missing or having some light icon in xcode project navigator and delete those files with light icon.
Hope you will fix the error.
I tried to run a project in Xcode12/Swift4, while the project was written on Xcode8/Swift3
so I install Xcode version 11.7 and run this work for me.

Protocol Buffers in xcode 6 Mac 10.9

I have been researching how to make a demo on Protocol Buffers in iOS
I found this tutorial recommended by a lot of people:https://code.google.com/p/metasyntactic/wiki/ProtocolBuffers
I use 10.9 Mac version and xcode 6 with command-line tool installed.
I have followed this tutorial and downloaded protobuf-2.6.0 and get some problem in "Project Integration" from step 2 to step 6.
I don't understand how to do it in step 2 and I can't find /Classes/ProtocolBuffers.h in step 3. Also in step 4 and 5. Can anyone help me explain cleary this tutorial.
you can find your the ProtocolBuffers.h in ProtocolBuffers-2.2.0-Source ▸ objectivec ▸ Classes.
In step2,
first you create a workspace and add you current project to your workspace, and then add the ProtocolBuffers.xcodeproj to the workspace which is in the ProtocolBuffers-2.2.0-Source ▸ objectivec.
you can see here about how to add a existing project to the workspace, hence, your current project can't be opened when you add it.
https://developer.apple.com/library/ios/recipes/xcode_help-structure_navigator/articles/Adding_an_Existing_Project_to_a_Workspace.html#//apple_ref/doc/uid/TP40009934-CH1-SW1
and in xCode 6, there is no pch file, you can get your help here:
Why isn't ProjectName-Prefix.pch created automatically in Xcode 6?

Three20: No such file or directory found

in the last 4 hours I try to add Three20 to my iOS poject.
I try to avoid it a long time but now I am on a point in which i can't :)
So I added it correctly all to my projects and after around 2 hours of work it compile perfectly!!!
Badly, I got a "No such file or directory found"-error when try to
#import "Three20/Three20.h"
I try nearly every string in the "Header search paths" I can imagine to get this working, but I have no idea...
here is a screenshot of my directory listing:
http://i.stack.imgur.com/9yWjM.png
here is my Header search paths:
http://i.stack.imgur.com/uXEWP.png
What am I doing wrong?
Have you tried to add the three20 framework manually or using the included ttmodule.py script? The script usually takes care of everything. You can either import the framework into an old xcode3 or current xcode4 based project. The python script is located in src/scripts/
Short answer: everything. Three20 has a very clear documentation. Just follow the Adding Three20 to your project section from https://github.com/facebook/three20
At least for Xcode 4.2 and 4.3, you should do a previous step before you click on Product->Archive. This step is clicking on: Product -> Build for -> Build for archiving.
In USER_HEADER_SEARCH_PATHS in Build Setting under the Search Paths section add this:
$(BUILT_PRODUCTS_DIR)/../../three20
$(BUILT_PRODUCTS_DIR)/../three20

Resources