create static library on iOS 8.1 with real device - static-libraries

since I am quite new in iOS programming and still learning something new every day. So I tried something new.
I want to create a static library with the help of this link (How can I create static library and can add just .a file on any project in ios)
I also could import my classes and insert them, but they use some specific code, which is not supported by the simulator, only by a real device like an IPad.
But when I hit the build button I get the error under the tests:
CodeSign error: code signing is required for product type 'Unit Test Bundle' in SDK 'iOS 8.1'
As far as I could find out, it has something to do with the code signing identity for the tests . I don't use any of these tests by now and I already checked some of the articles here in that forum, but I couldn't figure out how to fix that error.
Has anybody some suggestions?

You can try this. May be the code signing identity is automatic, so set it to a specific profile.

Related

Trouble integrating Venmo iOS SDK Pod

I have been following the ReadMe from the Venmo iOS SDK but am having issues even importing the pod. When I try importing the SDK and running the application, I receive the following error:
The SDK mentions that there can be issues with a project that uses Parse (mine does), so I added these other linker flags. Upon doing so, I receive this error:
Anyone else run into similar issues with this SDK or have any idea how to at least allow my project to import the SDK? Thanks in advance!
Download VenmoAppSwitch.framework at https://github.com/venmo/app-switch-ios-framework or from a similar developer website from venmo.com
Follow the set up steps and if there are any follow up questions, please let me know.
This is how it was done for our Payments App at https://itunes.apple.com/us/app/paynet/id797415713?mt=8
I had that and other problems with Venmo IOS SDK, i think you´re duplicating Flags and there´s other you don´t have, try to go to your project -> your target -> Build Settings -> Linking -> Other Linker Flags. And be sure youre not dupicating, in the image show you the linker flags i use for my project.
*Sorry for my english hope you understand
Other Linker Flags

iOS error "Embedded binary is not signed with the same certificate as the parent app"

Those are my first steps in IOS applications development and I'm facing some problem that I can't figure out.
error: Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target's code sign settings match the parent app's.
Embedded Binary Signing Certificate: Not Code Signed
Parent App Signing Certificate: iPhone Developer: Emil Adz (9QNEF95395)
I can't understand, what is a Embedded Binary Signing Certificate?
I went over the questions with the same error here, but none of them were related to the problem presented here (Not Code Signed).
I tried to revoke my certificate from the Apple Developer Member Center and request another certificate, but the issue persists.
Does some know how it could be fixed?
Swift 5 . Simple way in my case check this screen shot i am done
The embedded binary is referring to a widget that you are deploying alongside with your app.
In your case, you are not signing your widget with any Signing Identity (since your error says "Not Code Signed").
To resolve this, go to your Project file, find your widget's target, and under the Build Setting tab, find the Code Signing Identity value. Choose the same code signing identity that you are using for your main app's target.
You will also need to create and configure a provisioning profile specifically for your widget when you want to release it.
Sometimes none of the solution on Stackoverflow works. In that case,
Solution
Make sure that there is no red mark/issue in any of the sections of Signing(Debug), Signing(Release) and Enabled capabilities in both of MainApp and EmbeddedApp
Make sure that both certificates and provisioning profiles are installed under login/system keychain.
Make sure that your certificate is never ever set as Always Trust. Access must be kept as Use System Default
This error is also shown when deployment target of your Today extension is newer than the parent app. They must be the same.
I have iOS app set to 10.0 and added Today extension which was automatically set to 11.4 as the latest. This caused the error to appear. Simply changing the Deployment target of the extension target to 10.0 resolved the issue.
Assumptions
the app I am working is called TestApp (for the sake of privacy)
the steps below are tested in Xcode 11.1
the scheme I was using to compile is AdHoc
the app has the Push Notification capability
Issue
In my case the issue was caused by a discrepancy between the signing of two targets. The issue was between:
the TestApp target (i.e. what in the error is referred to as Parent App Signing Certificate)
the notificationServiceExtension target (i.e. what in the error is referred to as Embedded Binary Signing Certificate).
Resolution
In my AdHoc scheme, under the TestApp target, I disabled the automatic signing because I wanted to specify the provisioning profile and the certificate.
The steps I followed were:
from Signing & Capabilities -> AdHoc -> Signing (section)
removed the tick from Automatically manage signing under selected
selected the provisioning profile I wanted to use
from Build Settings -> Signing (section)
under Code Signing Identity, choose for both AdHoc and Any SDK the certificate I wanted to use
under Code Signing Style -> AdHoc, chose Manual
under Provisioning Profile -> AdHoc, chose the provisioning profile I wanted to use (i.e. the same as step 1.2)
The error was thrown because I didn't apply the same settings to the notificationServiceExtension target (which was still using the automatic signing and therefore another certificate). As soon as I have repeated the steps above also for this target, the error was gone.
I hope it can helps someone, because this error drove me crazy!
It seems this issues appears in xcode 10 and the resolution is different from the aforementioned.
I was able to fix (or rather bypass) the error by setting the Build
System to Legacy (via File > Workspace Settings)
Another interesting thing to note is that the signing error would not
occurr if I was building to an actual device (i.e. before changing the
Build System to Legacy). It would only occurr when building using the
simulator and only on Xcode 10 beta 3, 4 and 5.
Link to the original thread: https://forums.developer.apple.com/thread/105537
I was having this issue when I migrated to Xcode 10 and managed to fix it by updating the architectures in "Build Settings"> "Valid Architectures" for the Watch target to
$(ARCHS_STANDARD)
This thread helped me out a lot: https://forums.developer.apple.com/thread/107563
Oddly enough, I had to remove the products folder from my project in order to fix this error. Xcode crashed then, after reopening, worked like a charm!
I got this error when the App Groups weren't set up correctly on all my App IDs in the Developer Portal. Therefor the App Groups in the app didn't work correctly and the Binary for the extension or the Watchkit app couldn't be signed.
check your Excluded Architectures
I got this error after adding a Copy Files Build Phase to the main app Target.
Copy Files
Destination: Absolute Path
Path: /Applications
File: MyApp.app
This worked the first time I ran the app.
On subsequent runs, Xcode began complaining about the certificate mismatch.
Removing the Copy Files build phase fixes the certificate mismatch. I'm still searching for a way to Copy Files without the error.
Same issue links:
https://stackoverflow.com/a/32802258/1265393
https://forums.developer.apple.com/thread/102707
https://github.com/Bouke/SwiftInitializerGenerator/issues/6
I had the issue when following the SwiftUI documentation about integrating an iOS app with watchOS.
The issue is that the extension is not under the same development team, so it will fail when we try to compile it.
Nothing about architecture and nothing about trust.
SOLUTION:
ScreenShot for xcode
Go to the project general file
Check on the extension folder on the sidebar (check the screenshot number 2)
Switch to the Signing & Capabilities tab
Choose your team (need to match the master project's development team)
I had this problem with a Photo Editing Extension. I eventually discovered that it was due to my unusual project structure.
My project includes a local Swift package containing all the source code and resources for the appex (app extension).
The appex links the library created by the Swift package.
The appex has no source files of its own. The “Compile Sources” build phase has no files, and it has no “Copy Bundle Resources” build phase.
On a clean build, Xcode builds the appex and embeds it in the app successfully.
On an incremental build, even with no changes to any file, Xcode fails during the “Validate MyEx.appex” step.
The problem, it turns out, is that Xcode re-links the appex executable every time it builds, even if nothing has changed. And Xcode does not then sign the new appex executable, except during a clean build.
This means that the appex executable is always unsigned after an incremental build, so it is never signed with the same certificate as the parent app (because the appex isn't signed at all).
My solution was to add an empty file, dummy.swift, to the appex target. That is sufficient to make Xcode only re-link the appex when needed, and to always sign the appex after linking during an incremental build.
I got this error while having another compile time error in my code.
My new target has never been built before.
So I thought I'll fix this error first. But it turned out, that fixing the other error enabled Xcode to build the target and fix the other error itself.
Check if you have more targets like oneSignal or other else and check if you have the same team of the main target.
I was getting this error trying to build a WatchOS app in Xcode 11 - I tried all the various suggestions in this and other SO posts but the thing that finally worked was switching Xcode to use the legacy build system.
Go to: File | Project (or Workspace) Settings | Build System
And select Legacy Build System
XCode 12.5
In my case, I followed Shakeel Ahmed's answer. But I also needed to do this change on the Pod file.
You can find more here https://github.com/facebook/react-native/issues/31480#issue-876308920
I have experienced this same issue in a Unity.iPhone project.
We embed a target for a Stickers extension that we ship with the app.
The Stickers extension target is the one complaining about the code sign settings not matching the parent apps.
error: Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target's code sign settings match the parent app's.
Embedded Binary Signing Certificate: Software Signing
Parent App Signing Certificate: Apple Distribution
This occurred when the Stickers Extension target build settings were set to ARCHS_STANDARD (arm7, arm64), while the parent app was set to arm64.
I fixed this by setting the Extension's ARCHS build property to arm64.
Go figure, I suspect this output catches a bunch of different issues and just doesn't specify any details in the log message.
Check your keychain access expire certificate not deleted that's why its showing a error.
In my case the key was to delete 'Products' folder. Then the build was successful. Moreover, after that I made git reset --hard and tried again with the same successful result.

Apple Mach-O Linker Error even with the .m files added to Compile Sources of Build Phases

I know this is some typical beginner question to use Xcode, but it's just confusing.
Basically, I git cloned a project from github.
https://github.com/gandg/webrtc-ios
https://github.com/soulfly/webrtc-ios (forked)
Both projects are updated fairly recently,
AppRTCDemo.xcodeproj some refactoring 18 hours ago
and the readme says:
To build XCode iOS app only:
project location: webrtc-ios/ios-example/AppRTCDemo.xcodeproj
Open the XCode project and set target for iPad
Build and run
Should work without changes
but, end up with many warning and errors.
Yes, I understand Apple Mach-O Linker Error typically occurs when *.m files are not added to Compile Sources of Build Phases, so I confirmed that.
It looks like the whole *.m files are included there (see the last attached image), so I know nothing to do more.
Can anyone give advice on this issue? Thanks in advance.
As I understand you are trying to build app to the iPad simulator.
Seems like this project doesn't work in iOS simulator, only on real device
Here is how Xcode looks like when I use real device - no errors:
Here is how Xcode looks like when I use iOS simulator - lots of errors like in your question:

Code signing in xcode fails when I add a static library to project

I created a Cocoa Touch static library that I want to add to a project I'm working on. The project built perfectly before I added the library but now it gives me a "codesign failed with exit code 1" error. Why would the library cause this and how can I fix it?
I'm not sure. Did you code sign the library? I have several static frameworks I've built and used without a problem. I haven't code signed them which is why I'm thinking you may have if it's possible.

"Relative to Current SDK" doesn't work mixing Mac Framework and iPhone static library

I have a framework of code I maintain. It's got mac and iphone objective-c code. And some of it is shared. I'm not having any problems with code. It's a problem with Xcode.
Let's just call my framework "AwesomeKit" for this problem.
The first thing I did was create an xcode Framework project called "AwesomeKit". Add source files to it, link against the common mac frameworks: foundation, cocoa, carbon, etc. It compiles fine.
Then, add a new "static library" target, let's call it "AwesomeKit-iPhone" and set the base SDK in the build settings to iphone device 3.1.3.
The problem comes when I try to add "Existing Frameworks" to the AweseomKit-iPhone target.
First change the current build target to AwesomeKit-iPhone.
Right click on any group and select "Add > Existing Frameworks..."
Choose UIKit.framework
UIKit will immediately be highlighted red, as if it's missing. It is indeed missing because Xcode uses the "Relative SDK" setting from the "Mac OS 10.6" SDK. When it should be using it relative to the current target's base sdk iphone device 3.1.3.
What the heck? Has anyone experienced this? This is really annoying.
I found the solution to this. You have to edit the project.pbxproj file inside of the project.xcodeproj directory. Find any entries like "SDKROOT = XXX" and change it to you real base root. It's probably best to look another project.pbxproj file that has it correctly set. I've used this on multiple occasions now and works like a charm. Usually there's 2 or more of the SDKROOT entries in project.pbxproj.
I think I've seen your problem. I'm still new myself to this, but what I've found when universal static libraries for both simulators and devices is that it's best to keep the Xcode Active SDK set to "Base SDK" rather that selecting an SDK. IN that mode, the current SDK is the SDK of the currently selected target.
Active SDK is rather like overriding the sdk on the command line. If yoy set it, SDK settings on targets will be overridden.
So im my case I wanted two targets to be run at the same time, one using the simulator sdk which compiles for i386 architecture and the other pointing at the device sdk which builds a universal lib for armv6/armv7 architectures.
I have seen the red not found stuff and I seem to remember that doing this, made it go away. I also had the project SDK set to a device rather than Mac. Remember that targets override this so it's a good way to ensure that Xcode is pointing at the right sdk without effecting the settings on targets and the ultimate build.
I'm in the same boat right now, XCode keep tacking the wrong SDK in front of the frameworks. This is project with both OSX and iOS targets. But there's seems to be something really wrong with my Project Build settings. Your screenshots don't show them, but you may want to check them. In my case, many entries are duplicates. So I have two categories "Architectures", totally identical. If I change one, the other changes along with it. This could be related to the problem with the wrong SDK being chosen. I think the project file is corrupted, and I'm now trying to figure out if I can fix it manually.

Resources