I have made a Swift framework. It builds normally for running on a device but Xcode can't archive it because of bitcode.
So I tried to find bitcode setting but it's nowhere.
I tried to add -fembed-bitcode to compiler settings but it's nowhere, as well. How can I solve this problem?
I want another project that imports my framework to be able to build for both device and archive.
Related
Currently, I have an issue with one of the libs that I use in the project, it simply won't let me make the build for the iOS simulator.
Getting the following error message:
Building for iOS Simulator, but the linked library '!##$%^&.a' was built for iOS.
In my class I have the following code:
#if (TARGET_IPHONE_SIMULATOR==0)
void !##$%^&_init(void);
#endif
I have tried to exclude the file when building the app for the iPhone simulator by adding it in Build Settings > Build Options > Excluded Source File Names > Any iOS Simulator SDK
I have also tried to exclude the following architectures: arm64, arm64e, and armv7.
Setting Build Active Architecture Only to YES, didn't do the trick for me, nor validating build product nor validate workspace.
Actually, none of the above-mentioned solutions worked for me, so I had to ask this question here.
As a workaround you should be able to change Build system to "Legacy Build System" under File/Project Settings.
The proper solution would be to package your library as XCFramework.
I have the custom framework name LogginFramework and I use it in my project. I can debug and I can call the class of LogginFramework in my simulator. Now I tried to archive my project to send to the tester, build failed and showing" Use of unresolved identifier 'CryptoHelper'" How can I solve this issue? I already added framework in Embedded binaries and "Linked framework in Libraries" My Swift 3 app rebuilds and runs successfully on all simulators except for Generic iOS Device. If I try to archive it or do a rebuild on Generic iOS Device, I get a No such module error relating to my custom frameworks.
I tried build,clean,delete drived-data but still error
Hope this will help you
Select your Project in Targets.
Then search for Skip install.
Change it into NO.
Then archive your custom framework. (make sure to use Generic
iOS Device ) as a target device.
Export it to where you want.
Then use it with your project.
I am writing a program in Swift using Mac OS Sierra and Xcode 8.3.2 and am using the RandomKit module from: https://github.com/nvzqz/RandomKit. I am using the basic Swift Package Manager to import the package into my project.
My program builds and runs fine, but when I go to archive it, I get an error saying "No such module 'RandomKit'
It highlights my code:
import RandomKit
Does anyone know why this would build and run but fail when I attempt to archive?
By default, when you Run in XCode, it uses the Debug configuration, and when you Archive, it uses the Release configuration. In Build Settings, look at the Build Active Architecture Only setting. By default, it is Yes for Debug, and No for Release.
This means that when you Run, XCode only builds for the simulator's architecture, but when you Archive, it builds for all possible iOS architectures.
Now, look at the settings for RandomKit to see what architectures it is built for. It needs to include all of the iOS architectures, like arm64, armv7, and armv7s.
After probably 4 hours I finally figured it out. I think this must be a bug in Xcode, but here is my workaround.
In this folder:
~/Library/Developer/Xcode/DerivedData/<My App Name>/Build/Products/Debug
I found RandomKit.framework and ShiftOperations.framework. I copied those two files into the root directory of my Xcode Project, and then linked the frameworks under General in my Xcode Project.
Linking Frameworks
Fresh cocos2d-x project build using Xcode runs normally on iOS simulator/device, but after making changes to cpp source files, rebuild fails with error-
Xcode cannor run using selected device. Choose a destination with a supported architecture in order to run on this device.
The only way to make it work is delete build binaries (i.e. delete XCode>Derived Data folder), and take fresh build after restarting Xcode.
Can someone please help me resolve this issue?
Additional Details:
This error is related to mismatching device architecture and armv6 armv7 flags. But first build works fine, and stops working after second build onwards, that means this is not a possible issue.
If the project is not using cocos2d-x (i.e. plain Objective-C project), then there is no such error after second build.
Compiler selected: Apple LLVM Compiler 4.2
Thanks in advance!
Following my comment you should make sure you use the latest templates for creating cocos2d projects. Some templates will only work for a specific Xcode version so make sure you use the right templates for your xcode version (There are some for xcode 3.x and others for xcode 4.x)
Change Valid architecture to armv7 and armv7s. Remove armv6. See image for more information.
I have searched for hours however I still have no clue what is wrong with my configuration.
My project uses a self-written libray (myLib). This library is compiled to work only for simulator and it works perfectly there.
What do have to change so it compiles for my iPhone Device as well?
This is my current warning:
ld: warning: in /.../myLib.a, file is not of required architecture
This is my configuration (of myLib.a)
I found a lot of articles explaining the reason for this error however I could not find a solution:
The simulator runs on an x86
architecture, while the device uses an
ARM architecture.
What do I have to change to get my library working on my iPhone?
Thanks
Edit:
What I did so far:
Cleaned both projects
Set library to 'Device' (3.1)
Built the library
Dragged the .a file of my library into my application
Result:
This works in simulator but setting the active sdk to device still raises a file is not of required architecture error.
I also tried mahboudz ( thanks for your support) link.
It explains howto built the project using a shell script.
However XCode keeps complaining that the library file is of the wrong architecture and the build fails.
This has to be a really stupid beginners mistake.
You need to add both .a files,the one built for the device (build/$config-iphoneos)and the one built for the sim (build/$config-iphonesimulator) to the new project. Make sure you name them differently before dropping them in. This is how admob and similar offering ship their static libs.
You need to compile your library for Intel so the Simulator can use it (which I gather you have done already), and then compile it for ARM, so it can run on the iPhone. Then you have to merge the two libraries. There are different ways to accomplish that, or make it more automatic.
Here are some links to help you:
http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html
http://www.clintharris.net/2009/iphone-app-shared-libraries/
I've met the same problem too. But seems you don't need to drag two .a files into the app project to solve this problem. This is what I did:
Drag the static library project into app project's framework group
"Get Info" for the target in app project
Set the direct dependency of static library
Make clean all unnecessary builds(for example the simulator build) in the static library project
Build in the app project