I recently updated my Xcode to Xcode 7.0.1. My project used to compile and build for ios without issues on Xcode 6.4. Now, I'm having this error:
Cordova/CDVViewController.h file not found in the line -
#import <Cordova/CDVViewController.h>
Please let me know how to fix this.
P.S. "archiving" doesn't produce errors
I found the answer here: http://forum.ionicframework.com/t/cordova-cdvviewcontroller-h-file-not-found-in-xcode-7-1-beta/32232/5
From the author shazron
Add this line to your Build Settings -> Header Search Paths:
"$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include"
Don't replace the existing line that looks similar, that is still needed to be backwards compatible with Xcode 7 and Xcode 6.4.
This probably had something to do with tvOS, I reckon -- Apple had to separate the archive intermediates by platform for universal builds.
Related
I made a simple blank project and added Bugsee via swift-package-manager.
Its located on https://github.com/bugsee/spm.
I can successfully build project for iOS Device.
But it fails for Simulator. And the error is not really verbose
(the path is shortened):
Cannot open file handle for file at path: Path(str: ".../Bugsee.xcframework/ios-arm64_i386_x86_64-simulator/Bugsee.framework")
What does it mean?
The path is valid and the framework is there:
I also found that build for simulator is OK after I have added Bugsee.xcframework into Frameworks, Libraries, and Embedded Content.
Does anyone know what's wrong?
It looks like SPM in Xcode have an issue with i386 arch.
Bugsee released 1.28.0 with dropped support for i386 arch. And now Xcode starts building fine for simulator.
I think i should create a ticket in SPM tracker.
I'm trying to run downloaded from app, try to open in Xcode and have an error:
"
Showing Recent Messages
:-1: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'SimpleWeather')"
Select the target 'SimpleWeather' in the project and change language version Target->build setting -> Swift compiler language -> select 5, 4.2 etc
******** Easiest way: **********
1.Click on PODs in the left column.
2.In the centre column select the pod you want, then navigate to "build settings" in the top right panel.
3.Then search "Swift Language Version" and change to a known version.
For Xcode 10.1, select your Pods File
-> Go to Build Settings -> Choose your Pod -> Search "Swift" -> Navigate to "Swift Language version" -> Set to desired language version.
I followed the instructions on this page and the error didn't resolve. Finally, went into
$ vim MyProject.xcodeproj/project.pbxproj
and found two instances where
SWIFT_VERSION = 3.0;
was still being referenced. I changed those to 5.0 and the error was gone. Not sure why those two were still there.
Select project
Select Build SettingTab
Select Swift Compiler language Option
select pod like as per image and change swift language version
this can save you one day
Search for Swift and double click, then change each offending version.
It seems that the app might have an old Swift version code like Swift 3.0 in your case. In the release of Xcode version 10.2 has launched Swift 5.0 version. Xcode 10.2 does not support compiler for Swift 3.0 version. You can change compiler from Build Settings -> Swift Compiler - Language -> Swift Language Version -> Change it to Swift 5. If your code is compatible with that language version then it will run the code without error.
However, the Swift 3 compatibility mode will not be supported in the
Swift 5 compiler. Swift 4.2 is the last release of Swift to support
Swift 3 mode. There are important changes to both the surface of the
language and the interior of its implementation in the releases
following Swift 3 that will be the basis of future (and lasting)
source and binary stability.
Refer below link for more details.
https://developer.apple.com/documentation/xcode_release_notes/xcode_10_2_release_notes/swift_5_release_notes_for_xcode_10_2
If you really wish to run the app which has older Swift version code than you must have to use an older version of Xcode. You can use Xcode version 10.1, it's compiler having support for Swift 3.0 version.
Another alternative way is to migrate your old Swift code to the new version of the Swift version. You can migrate you Swift 3.0 to Swift 4.0 in Xcode 10.1 version.
For migration guide refer to this
https://swift.org/migration-guide-swift4/
Check this out:
Click on Project name
Click target
Click on Build setting
At the Swift Language Version: Choose Swift 4
I opened up the file MyProject.xcodeproj
(using VSCode editor)
and I found some lines where
SWIFT_VERSION = 3.0;
(at about line 400 where it says /* Begin XCBuildConfiguration section */)
Modify to SWIFT_VERSION = 5.0 or others.
After that I was able build and run the project.
I came across this issue while developing a Cocoapod. I had an old .swift-version file in my repo that specified Swift 3.0.
Running pod lib lint --verbose led me to this helpful response:
Please remove the .swift-version file which is now deprecated and only use the swift_version attribute within your podspec.
I deleted the file and added spec.swift_version = '5.0' to my podspec file to fix the problem.
If you multiple pod files like I did and you're having trouble finding the pod with SWIFT_Version = 3.0 try the search bar
Its very simple. Just follow this 2 steps to resolve this issue.
In Step 1:
Resolve Build Failed issue.
Covert Swift 3.0 to Swift 4.0
In Step 2:
Resolve all other warnings
Then Covert Swift 4.0 to Swift 5.0
1) change pod's version on podfile (because library wrote old swift version )
2) "pod install" on terminal
I am new to iOS development. After I followed all of the above answers, I still got the same error. I was using Xcode 11 and I downloaded the "FoodTracker" sample from Apple Developer web site and I got the same error after trying to build it. I found that the project has several settings referring to Swift language version after VIM the project file content. So, I resolved this by first setting the "Project > FoodTracker", and also "TARGETS > FoodTracker" and "TARGETS > FoodTrackerTests" the Swift Language Version to 5.0. Hope it helps.
Setting Swift Language Version on Project and ALL Targets
open MyProject.xcodeproj/project.pbxproj in the editor (e.q. Sublime)
Rename all SWIFT_VERSION = 3.0; Rename all SWIFT_VERSION = 5.0;
PLease make sure that the your pod's version is compatiable with your swift's version. I have faced this issue when I had installed wrong version of pod (swift 2.3), But I was using swift 4
We can automate this using a post-install hook installing Cocoapods.
Add this to your Podfile:
..
pod 'Alamofire' # Just an example for the last pod in list.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
end
end
end
end
This hook is helpful if you have lots of Pods as dependencies because we don't need to manually change the Build Settings for each pod. However, be sure to manually change some pods to 4.0 or 4.2 as outlined in the earlier answers if they don't support Swift 5 yet.
clang: error: no such file or directory: '/Users/admin/Library/Developer/Xcode/DerivedData/__TESTING__-fzbkvdbnndieeagphtjhdndiyttl/Build/Products/Debug-iphoneos/libCordova.a'
How do I get this a missing libCordova.a ?
(source: kerrydeaf.com)
UPDATE: For Simon Germain.
UPDATE: For Simon Germain. I don't see "Identity and Type". I can see "Identity". I'm using xcode 4.5
(source: kerrydeaf.com)
UPDATE: For Simon Germain. I got the Identity.
(source: kerrydeaf.com)
UPDATE: For Samuel
(source: kerrydeaf.com)
UPDATE: For Simon Germain - Architecture.
UPDATE: For james0n - armv.
(source: kerrydeaf.com)
UPDATE: For Simon Germain - Architecture.
UPDATE: For james0n - armv.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CDVURLProtocol", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_CDVViewController", referenced from:
_OBJC_CLASS_$_MainViewController in MainViewController.o
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
UPDATE: For james0n - Valid Architecture.
(source: kerrydeaf.com)
UPDATE: It is now solved!!! make sure all armv7 and armv7s for ios 6 on all in xcode. It worked.
For your project, set the build setting "Build Active Architecture Only" to yes.
(Maybe also set the the Architectures build setting to "Standard (armv7, armv7s)" for CordovaLib project.)
Had (as many others) the same problem, here's what I did:
Redid the Getting Started guide from Phonegap (including downloading
and extracting the source again)
Same problem with the HelloWorld app
product - clean
Changed both the 'HelloWorld' and 'CordovaLib'-project (so not the Targets) according to james0n's answer, settings:
Architectures: Standard (armv7, armv7s)
Build Active Architecture only: Yes
and then it magically worked, I think steps 3 and 4 did it however.
Only need to remove armv6 from both YourProject and CordovaLib:
The consequences of doing this? Apparently, it's still working on iPhone 3GS, but not the previous versions..
I had the same problem as you, worked fine deployed to the simulators but not to a device. Neither of the suggested answers worked for me.
Here's what did work for me:
Set deployment target to v4.3 and on the project settings for the CordovaLib project, set the Build Active Architecture Only to Yes. (Not needed on your main project).
Important, do a Product-> Clean and rebuild.
Make sure that the CordovaLib's product's target is set to "Relative to Built Product" on the right hand-side panel, first tab on theleft, under "Identity and Type".
Download the Cordova installer from here http://phonegap.com/download. Make sure it is the same version that you are currently using (ex 2.0).
Then mount the dmg found in the ios directory.
Then run the .pkg installer.
Restart Xcode.
You gotta run the update script, I know it might be a pain in the butt to do it, but that's what it takes.
Download and open the Phonegap 2.1 package from the official site. Open a terminal window, and cd to the installation directory
You'll need to first create a new project:
./create [project_folder_path] [package_name] [project_name]
Then you need to set the path to your libraries.
/update_cordova_subproject [xcodeproj file]
Now open up your project and set the deployment target to 4.3 and you should be ready to go. Hope that helps
EDIT:
This is how my configuration looks like for CordovaLib Project
Also - make sure you don't have more than one PhoneGap Xcode project open at a time - I was getting conflicts between the two. "Workspace already open in another workspace" type of loop.
After spending many hours with even more errors, here's what worked for me. Basically combining much of the above:
Start with a fresh copy of Cordova. If you've been messing with it like me, it's not fresh anymore.
Move the Cordova files out of the download directory (I tend to clean that directory now and then...)
Create a new project as described in the Phonegap docs, i.e. drag the ios/bin folder to the Terminal icon and run the create script in Terminal. No need to run the update_cordova_subproject script.
Open the project in XCode.
For your product, set the iOS Deployment Target to 4.3 (I did it 2x, both in Project and Target Build Settings).
For CordovaLib.xcodeproj, set Build for Active Architecture to Yes in the Project Build Settings.
Clean and run.
Do not include armv7s in any of the architecture lists, as it will not build for device.
Tested in simulator and on an iPad with iOS 6. Using Phonegap 2.1.0 and XCode 4.5.1.
Update: if you want to support iPhone 5, you will need armv7s. It requires the fix in https://issues.apache.org/jira/browse/CB-1360 , which will be in Cordova 2.2.0. (Haven't tried it yet, working on an iPad project.)
I fixed this by removing the armv6 and i386 architecture from Valid Architecture setting
I had this problem too. I think it was because I had previously installed an old version of phone gap that installed some stuff in xcode. I uninstalled, then reinstalled xcode. Then I ran the Uninstall Cordova.applescript that came with phone gap. This fixed the problem of the red libCordova.a
In addition to several other suggestions & post, I found that I was experiencing this problem on my AdHoc builds only. Please note that I figured this out during debugging because if I set the Edit Scheme > Archive build configuration to "release" it would work OK, but if set to AdHoc it would give me a link error, telling me that this file could not be found:
/Users/jason/Library/Developer/Xcode/DerivedData/MommyNearest-ceourmykvgxdekbkmzenuvhcfnzk/Build/Intermediates/ArchiveIntermediates/MommyNearest/BuildProductsPath/Adhoc-iphoneos/libCordova.a
This was actually a good clue to what the problem was, which was that somehow the CordovaLib subproject did not have an AdHoc configuration (it had ONLY "Debug" and "Release" configurations).
Therefore, when building for an AdHoc release (to use with Testflight) it would not create a symlink for this file correctly. Once I added an "AdHoc" configuration to the CordovaLib subproject, this started working.
I am getting an error after upgrading to xcode 4, for all of the library projects that my application depends on.
[BEROR]No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=i386, VALID_ARCHS=armv6).
It looks like all you have to do is add i386 to the Valid Architectures in the build settings. I was compiling for the simulator, and that's why it was complaining.
This seems odd, because the project worked just fine before upgrade. It looks to me like you have to do this for any project you upgrade. At least that will work for now.
See https://devforums.apple.com/message/376732#376732
"No architectures to compile for" means "Valid Architectures" field is empty. Update it to $(ARCHS_STANDARD_32_BIT) and you'll see the usual armv6 armv7. This happens sometimes in XCode 4 GM after updating "Base SDK" to "Latest SDK".
Open project.pbxproj (show package content of xcodeproj file), remove all lines with VALID_ARCHS = "...";, and restart Xcode.
Very strange. I encountered the same error and both the Debug and Release "Valid Architectures" were set to armv6 and armv7. (The same code compiles fine in Xcode 3.2.) I ended up deleting both settings, then expressly setting them to $(ARCHS_STANDARD_32_BIT) ... which in turn translates to armv6 and armv7 again ... and it compiles just fine now. No i386 needed. Hmm ...
If this error occures in combination with Phonegap the solution is:
Add "i386" in the build settings to the "Valid Architectures": for your project and the library (PhoneGapLib.xcodeProj). In both cases for the project and the target.
I was getting this error when I was trying to convert to automatic reference counting in the latest Xcode. I fixed it by adding "x86_64" to the valid architecture list, which allowed me to continue building.
Just in case someone else was having the same issue, thought I'd throw in what worked for me!
Had similar issues with xcode6 it seems to pop when upgrading xcode, tried all of what is suggested with no success what worked for me was in the new xcode created a simple new app(tabbed) and made sure my App had the same settings for architectures
Open a new project and compile in Xcode 4 and then compare build settings with converted project. That's how I found it.
I have recently updated Xcode to version Version 3.2.2 (Pre-release). It is working fine with old Objective-C projects but I experience some problems with projects which have mix of Objective-C/Objective-C++ code. During the compilation I am getting the following error:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/c++/4.2.1/bits/functexcept.h:41:28: error: bits/c++config.h: No such file or directory
I have checked the path a compiler complains about and found that file functexcept.h is located in the following path:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/c++/4.2.1/armv7-apple-darwin9/bits/
My question is where I should change that path to correct one in Xcode?
Thanks in advance.
Try to make a symlink pointing arm-apple-darwin10 to arm-apple-darwin9:
cd /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/c++/4.2.1/
sudo ln -s arm-apple-darwin9 arm-apple-darwin10
Report a bug to Apple.
After installation of the iPhone SDK with XCode (Version 3.2.1) problem has gone.