Failed to build Swift framework test - ios

I'm trying to run my test for a custom framework but I get this error:
"xctest[75653:2358339] The bundle “Tests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle."
I added some dependencies using carthage to the framework. Could this be the issue?

Copy the xcodeprojs from your dependencies inside your workspace
In the buildPhase/link binary with libraries from the test target, add the dependencies clicking + and choosing them from the workspace (you must have your cocoa framework there + the dependencies)
Command B
Command U

Solution: Just set manually your Host Application in the test target

Related

I cant build an iOS project

When I try to build my project I get this same error
error: Multiple commands produce '/Users/shaka0241/Library/Developer/Xcode/DerivedData/tutores-ckkpuvpkfwcscbfxzqbzibwjihlk/Build/Products/Debug-iphonesimulator/tutores.app/Frameworks/Alamofire.framework':
1) Target 'tutores' has copy command from '/Users/shaka0241/ios-tutores/Carthage/Build/iOS/Alamofire.framework' to '/Users/shaka0241/Library/Developer/Xcode/DerivedData/tutores-ckkpuvpkfwcscbfxzqbzibwjihlk/Build/Products/Debug-iphonesimulator/tutores.app/Frameworks/Alamofire.framework'
2) That command depends on command in Target 'tutores': script phase “Carthage Copy Frameworks”
Clean build folder and try deleting the DerivedData folder (and re-build)
Check all your Info.plist files for any inconsistencies (especially when working with SiriKitIntents)
Check your Target Memberships & frameworks you import
Those solved it whenever I had this problem..
Also possible dup:
Xcode 10 Error: Multiple commands produce

Not able to link a Carthage framework to Xcode project

I am trying to link a new framework downloaded via Carthage to one of my project but getting a linker error:
I'm following these steps:
Updated the Cartfile with the framework location.
Run carthage update command to fetch the framework.
Under project target -> Build Phase added a new Run script and renamed it to Framework Copy.
Added the script to copy the framework from the file system : $(SRCROOT)/Carthage/Build/iOS/CleanroomLogger.framework.
Dragged and dropped the framework from the mentioned location under Link Binary With Libraries section of project target -> Build Phase.
Double checked the Framework Search Path under build settings and it seems to be set correctly : $(PROJECT_DIR)/Carthage/Build/iOS.
Am I missing something?
Eventually it turned out to be deployment target issue. The framework I was linking was supported with minimum deployment target as 8 and I was running with 7 :). I wish the build error could be more descriptive.

Realm doesn't load libwrappers.so

I try to use Realm database(version 0.74.1) in Xamarin.Android project. When I do build all is ok, but when I try to run project i get error
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Error executing task BuildApk: /{SolutionPath} /packages/Realm.0.74.1/lib/MonoAndroid44/arm64-v8a/libwrappers.so.
what I can do in this situation?
The APK is not built during the default build phase so you only get verification that libraries are in the right place when you run the debugger, or explicitly build an APK.
Can you check if the libwrappers.so file is actually in that location in the packages directory? It should have been put there by NuGet.
Also, is there just one Android target in the solution or have you created a PCL and Android target. The NuGet needs installing into both.

Invalid bundle structure - The app may contain only one executable file.

This question is similar if not identical but there is no solution. I've looked inside the archive and there's only one executable, so I am at a loss as to how to proceed. Any ideas greatly appreciates.
Invalid Build Structure
The binary file 'YourApp.app/libYourLibrary.a' is not permitted.
Your app may contain only one executable file.
This error occurs when a static library file is mistakenly copied into the app bundle.
You should link the libYourLibrary.a static library via a Link Binary with Libraries build phase.
It should NOT be added to the target's Copy Bundle Resources build phase.
My app was rejected with the same error message. It turned out that I was copying a third party framework (Fiksu) in the 'Copy Bundle Resources' build phase. The framework contained an executable and was already linked to in the 'Link Binary With Libraries' build phase. I deleted the framework from the 'Copy Bundle Resources' build phase. The framework continued to work normally in a release build. I resubmitted the app and it passed validation. Similar solution was posted here:
https://devforums.apple.com/message/1020254#1020254
In hindsight the error is straightforward. An executable file was accidentally added to the project. In my case "Develop!.app/Xcode" meant that Xcode was the executable. Checking the list of files in the project I found a symlink to Xcode. (Maybe I dragged it from the dock somehow and dropped it into the project).
If you are getting this error look at the files in your project -- there is an executable there somewhere.
I had this issue for the first time on an app I'd submitted over several versions with no issues.
I found that somehow that although I'd linked to one of my own libraries, one of the source files from that same library appeared in the list of files in the "Copy Bundle Resources" list. I have no idea how it got there but removing it meant that my app build, archived and was submitted successfully. :-)
If you are getting error in following format:
"Invalid Bundle Structure - The binary file 'Abc.app/AnyFileName.o' is not permitted.
Build Phases > Copy Bundle Resources > check your file AnyFileName.swift will be added too here. (Remove it)
validate it with XCode. Error gone !!
In my case I tried to remove references but nothing worked for me. Then I uninstall particular pod, remove references as mentioned here and then install that particular pod again. It worked for me.
For those who required elaboration check below:
1)
In Podfile comment the particular pod by adding # in the beginning and save it:
On command line run: pod install // It will uninstall that framework
2) Removed references of that framework from:
Link Binary with Libraries // In Build Phase
Copy Bundle Resources // In Build Phase
Embed Frameworks
3) Now install Pod again, Remove # which you added before and save it.
On command line run: pod install // It will install that framework again
Just delete the exec file from your bundle and delete the "Executable file" key from your bundle resources.
After that archive and validate the the the build it will work.

Can't create Archive with Static Library

I'm trying to create a archive for a app linking to a static library but with no luck.
I can built the app in both release and debug mode just fine. I can even built it for Archive (product->built for->archiving) but it fails miserably when I try to create the archive (products->Archive)
XCode can't seem to find the headers for the Static lib:
In file included from /Data/Code/iPhoneDev/ArchiveTest/ArchiveTestApp/ArchiveTestApp/ArchiveTestAppAppDelegate.m:9:
/Data/Code/iPhoneDev/ArchiveTest/ArchiveTestApp/ArchiveTestApp/ArchiveTestAppAppDelegate.h:10:24: error: DataFetcher.h: No such file or directory
In file included from /Data/Code/iPhoneDev/ArchiveTest/ArchiveTestApp/ArchiveTestApp/ArchiveTestAppAppDelegate.m:9:
/Data/Code/iPhoneDev/ArchiveTest/ArchiveTestApp/ArchiveTestApp/ArchiveTestAppAppDelegate.h:13: error: cannot find protocol declaration for 'DataFetcherDelegate'
Any ideas or suggestions on what I'm missing here?
I ended up roughly following the suggestions in this Questions:
Compile, Build or Archive problems with Xcode 4 (and dependencies)
Create a group call "Indexing headers" in your project
and drag the headers to this group, DO NOT add to any targets when
prompted. This includes any headers inside your dependency
For all dependancies set "Skip Install" build setting to "Yes"
Moving any "Public" headers in Build Phases to "Project" for dependency
Set the Build Setting "Installation Directory" on your Target to
$(LOCAL_APPS_DIR)
The archive was created with no errors with step 1-3, but for it to become a valid app step 4) was needed.
Amazing how half baked XCode4 seems

Resources