I'm trying to compile a basic Cocoa Touch framework to test this new feature in iOS 8 but I'm encountering some problems. First of all the framework doesn't import any other frameworks or libraries and the deployment target is set to iOS 8 (regular project when trying to create an Cocoa Touch framework. I added two methods:
- addValue:toValue
- subtractValue:fromValue
Compiling the framework goes without any problems as long as I'm not trying to code sign it. When I import the framework in my TestFramework project and I press build I getting this as build result:
I'm running into a peculiar error which doesn't seem to affect anyone on the web because nobody has complained about this error yet. The error is as following:
Warning: usage of --preserve-metadata with option "resource-rules" (deprecated in Mac OS X >= 10.10)!
.../DerivedData/TestFramework-ethagmafcjzncuftipguwzdeiezh/Build/Products/Debug-iphoneos/TestFramework.app/Frameworks/BasicFramework.framework: replacing existing signature
.../DerivedData/TestFramework-ethagmafcjzncuftipguwzdeiezh/Build/Products/Debug-iphoneos/TestFramework.app/Frameworks/BasicFramework.framework: invalid resource directory (directory or signature have been modified)
I mentioned that this "invalid resource directory" is an known issue for MAC developers but I can't seem to find the right solution. Who can point me in the right direction?
EDIT: I found out that it definitely has something to do with the code signing. Probably I need to code sign the framework too but that's not possible because I encounter the same error.
Related
Please do help me on this scenario. I saw several post related to this, but could not able to resolve the issue with my mac App without pods.
Project is several years old, developed in macOS(Objective C). Now I am trying with XCTest for unit testing. Using Xcode 7.3.1, I am not able to run tests classes.
This project is to create frame work. Project is working fine, only issue is with the testing. We are not supposed to do Pods or some other alternatives.
Console window shows below points:
xctest[35530:345970] The bundle “BaseLibTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. xctest[35530:345970]dlopen_preflight(/Users/12345678/Documents/Modify/Cocoa/Projects/BaseLib/build/Debug/BaseLibTests.xctest/Contents/MacOS/BaseLibTests): Library not loaded: #executable_path/../Frameworks/FreeTDS.framework/Versions/A/FreeTDS
Referenced from: /Users/12345678/Documents/Modify/Cocoa/Projects/BaseLib/build/Debug/BaseLib.framework/Versions/Current/BaseLib
Reason: no suitable image found. Did find:
/Library/Frameworks/FreeTDS.framework/Versions/A/FreeTDS: no matching architecture in universal wrapper)
Program ended with exit code: 82
#Anand For the 3rd Point: Please check the build settings.
Please make sure its either set to Standard Architectures (64-bit Intel) (x86_64) - $(ARCHS_STANDARD) or set to represent proper architectures.
To debug this more, could you please copy paste the exact error you are facing and share the build env variables?
I am currently experiencing an annoyance which has been following me for a couple of days.
I integrated the Facebook SDK framework to an iOS project and it did work fine. I played with that Framework in a "mm" file of my project without any trouble. Lately, I decided to move all the Facebook specific code in an helper class that would deal with all the Facebook integration to make my code cleaner. Since then, the XCode parser has been complaining on the line that import the framework SDK (FacebookSDK/Facebook.h) that the file could not be found ...BUT... the error goes away when I am compiling. And then, as soon as I edit again the source file, the error comes back.
I have verified that the Framework path was properly set. Again, the parser has no issue when this import is in another mm file that is within the same project/folder. In addition, in the problematic class, as soon as I type the name of the Framework on the import line, the auto-complete will propose me that FacebookSDK.
Rebooting XCode has no effect
Cleaning the project didn't help
Building the project fix the problem only until I edit the code again.
If you have clues, let me know!
Thanks,
I've been looking at adding iTunes Library access to a Mac app I'm developing.
I looked at some of the existing open source implementations, such as EyeTunes and iMedia - but found them to not be quite what I was looking for. Overkill in general.
So I tried out using the Scripting Bridge, and found that while functional it was slow. And since I didn't really need to control iTunes, the slowness was not worth it. It also had the downside of relying on iTunes to be running. It also is a bit irritating to get it working in a sandboxed app (though possible.)
So I finally started to roll my own by reading the iTunes Library.xml file. That seems to be working OK. But in the process of investigating the meaning of the Distinguished Kind key/value I stumbled upon a brand new, Apple supplied iTunesLibrary.framework !!!
Beautiful - the iTunesLibrary framework docs are here.
However, when I try to initialize the framework using the code as shown in the reference link:
NSError * error = nil;
ITLibrary* library = [ITLibrary libraryWithAPIVersion:#"1.0" error:&error];
It returns nil and provides the very helpful error like so (in my Sandboxed app):
Error Domain=NSPOSIXErrorDomain Code=100001 "Could not load."
UserInfo=0x1140025b0 {NSLocalizedDescription=Could not load.,
NSUnderlyingError=0x1026fbe20 "The operation couldn’t be completed.
(OSStatus error -50.)"}
Thinking it might be a sandboxing issue, I also created a quick command line utility that attempts to init the library and it returns an almost identical error:
Failed to open library: Error Domain=NSPOSIXErrorDomain Code=100001
"Could not load." UserInfo=0x1018015b0 {NSLocalizedDescription=Could
not load., NSUnderlyingError=0x103a000e0 "The operation couldn’t be
completed. (OSStatus error 100005.)"}
Has anyone else tried out this new iTunes Library framework with anymore luck than I have had?
// EDIT: Answer below is correct. Code signing is required. The sample code in the answer is a handy starting point for using the framework. Additionally, in my case the problem was also that the iTunesLibrary framework code does not appear to work when the iTunes library is hosted on a network drive. Make this a bit of a deal breaker unless Apple fixes it.
You'll need to codesign your app using a certificate from the Mac Developer Program.
It's not documented anywhere, but, my suspicion is that this requirement was added due to iTunes cloud being a web service thing that requires accessing user accounts.
// Edit: In addition to setting CODE_SIGN_IDENTITY in the project settings as discussed above, you will also need to add /Library/Frameworks to the FRAMEWORK_SEARCH_PATHS in the project settings so that Xcode will know where to look for the #import's.
// Edit 2: I wrote a quick little sample app to show how iTunesLibrary is used, since, Apple's sample code and documentation is rather sparse: https://github.com/zadr/iTunesLibraryExample
From iTunes Library Framework Reference
You must code sign your app in order to get information back from the
iTunes Library framework.
The iTunes Library framework is available to users running iTunes
v11.0 or above.
Not sure if this is true for all of you, but in my case, I kept Code-Signing-Identity to - helped me. Now I don't need to sign the app.
I'm trying to submit a Mac app for Approval in the App Store, but linking with Growl is causing a validation error. I'm trying to re-codesign from the command line, but I'm getting the following error:
Ashs-MacBook-Pro:500px Uploader ash$ codesign -f -v -s "3rd Party Mac Developer Application: 500px Inc." ./Growl.framework/Versions/A
./Growl.framework/Versions/A: replacing existing signature
./Growl.framework/Versions/A: object file format unrecognized, invalid, or unsuitable
I've tried re-downloading the framework, but with no luck. Anybody see what I'm doing wrong?
Really strange, I've managed to resign the framework like this:
codesign -fs "3rd Party Mac Developer Application: Future Simple" Growl.framework/Versions/A/Growl
Growl.framework/Versions/A/Growl: replacing existing signature
(BTW: I'm working with Xcode 4.3.1 and Growl 1.3.1)
I just spent the day working through the "bundle format unrecognized, invalid, or unsuitable" error when codesigning a framework. In my case I'm using XCode 4.6.1 and I was trying to code sign Qt frameworks.
First note that the Apple documentation (TN2206) explicitly states that you need to code sign the versioned framework directory, not the library executable.
This is discussed further here:
How do you codesign framework bundles for the Mac App Store?
So, based on that, the command line in Ash's original question is correct. However I was getting the same error.
I did get it working with that command line. Here are the things that I had to do:
Make sure that you're using the correct version of CODESIGN_ALLOCATE. This is discussed in many of the answers here: iPhone Codesign object file format invalid or unsuitable If you can get XCode to sign an app then you can find the CODESIGN_ALLOCATE path in the build log.
Make sure that the versioned directory (./Growl.framework/Versions/A in the question above) contains Resources/Info.plist and that there is a link from Versions/Current -> Versions/A and that there is a link Resources -> Versions/Current/Resources at the top level of the framework bundle. I found that I could not sign the versioned framework directory without the Versions/A/Resources/Info.plist being present. You can read more about the correct structure of a framework here and here, or just take a look at some system frameworks to get an understanding about how they're supposed to be structured.
Further to the previous point, make sure that your symlinks in your framework bundle are structured correctly (Current links to numbered version, top level links to Current) as shown in the Apple docs. This won't affect code signing but your App will be rejected if you don't get this right.
Make sure that CFBundleExecutable is set to the correct name (the executable name) in your framework's Info.plist
Would it be better if we shipped the sdk unsigned? It'd be a simple change, I'm hesitant to do so now since it's been like this for a little while.
It looks like the error might have been trying to sign a bundle that was already signed; I fixed the issue by downloading the Growl framework source and compiling it with my own signature instead.
If I find a better answer that will work for frameworks for which you don't have the ability to compile, I'll post it here.
I can't seem to get my app to compile when using JSON-framework http://code.google.com/p/json-framework/ with iPhone SDK 3.0.
My app compiles fine for the simulator, but when I go to compile for my device I get a 'codesign error' code 1. I've followed all of the installation instructions correctly, and when I remove the 'Additional SDK' reference and 'Other Linker Flags: -Obj-C -ljson' it compiles just fine...but obviously I then can't use JSON in my app.
Any ideas?
You may want to just switch to the code version and not link in the static lib.
It should compile and work fine on 3.0.
On my own project, I too ran into this problem. I was not able to build my app for iPhone OS 2.x using the iPhone 3.0 SDK.
The fix was to set the following at the project level (Get Info):
BaseSDK to iPhone Device 3.0
iPhone Deployment Target to iPhone OS 2.x
Code Signing Resource Rules Path to the same 2.x plist (e.g. /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/ResourceRules.plist)
The last bit allows a distribution (app store) build to code sign correctly... Otherwise you'll encounter an error "object file format invalid or unsuitable" since the code signer by default will use the same resource rules as the BaseSDK (i.e. 3.0), which is unsuitable for a 2.x app.
Also, be sure to clear any of the above settings at the target level (again, via Get Info).
Phew.
Codesign error means you do not have a valid provisioning profile for the device you are trying to compile to, using the current built settings.
Can you build and deploy sample apps to your phone?
I started using the lovely json-framework for the iPhone but then suddenly found that if I compiled for anything greater than 2.1 for a device, that it would pop up with:
Codesign error: “object file format invalid or unsuitable”
It took me a long time to figure out what was going on, but thanks to a blog post, the fix is this:
On the project settings, on the build tab, search for “Code Signing Resource Rules Path” and set “$(SDKROOT)/ResourceRules.plist” as its value.
I’m not sure how it works as it looks like that is the path it already has, but hey, it seems to work!
that solves the codesign error i was getting, but now I cant compile on 3.0 for some other reason. i'm going to try to link to the code rather than the library.
Sounds like an issue you would want to discuss with the developers, see the support group.
It seems like the code signing isn't extending to the framework. Have you tried linking the framework differently?
And for French persons, here is a tutorial too here too (en Français)
But for your problem I think it's not about JSON but more with your key developer.