Xcode creates generic archive of iOS app because of malformed/incomplete Info.plist file inside the archive - ios

I am trying to archive and distribute my ios app but out of nowhere it just stopped working. I have deployed my app many times and also had this problem before because xcode somehow creaded some bad xml lines in my project.pbxproj file, but eventually I edited the xml source code and it was ok (app archive and upload/distribution to AppStore). Now xcode is showing my new created archive in "Other items" sections and i cannot upload to AppStore. I opened the archive and I noticed that key elements are missing from the Info.plist file inside:
I looked into other archives (after upload/distribution) and it should look like this:
I tried about 10-11 links on google or stackoverflow, summerized very well here (see accepted answer): Xcode creating generic Xcode archive instead of iOS App Archive?
I tried everything and also cocoapods update to 1.10.0, cleanup cache, reinstall pods, no luck.
My app uses another framework project (developed also by me as described here: https://www.raywenderlich.com/5109-creating-a-framework-for-ios) but I haven't changed that one either. I set Skip install to YES to everything except my app's main TARGET and PROJECT Build settings and checked for private header files. I also distributed another app that uses that exact framework project and everything is ok there.
I checked the new changes compared to last commit and the only modifications (except the source code files) was the build and version number of my app.
In the end, I opened my archive and added the missing entries manually in with an xml editor inside the Info.plist, and restarted xcode (as described at the end of the accepted answer in the link above). After that I was able to distribute my app. The problem is that I do not want this approach because I do not know what is causing this and also what other problems it may cause. Does anyone have any other ideas? It seems a lot of people come across this issue, it has tens of possible causes and it makes me lose hours of work everytime it happends (about once every few months this issue just pops out of nowhere).

Related

Invalid Signature - Code object is not signed at all

Im able to submit my app through Xcode 6.3.2 perfectly fine. Validation and analyzing pass perfectly. Once it successfully submits to the app store though I get an email from Apple:
"Dear developer,
We have discovered one or more issues with your recent delivery for "App". To process your delivery, the following issues must be corrected:
Invalid Signature - Code object is not signed at all. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target. For more information, please consult https://developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html
Once these issues have been corrected, you can then redeliver the corrected binary."
I have tried redownloading the distribution cert, regenerating the distribution provisioning profile, added "--deep" to the code signing "Other Code Signing Flags." I even checked the bundle name etc, everthing is alpha numeric. I was able to submit fine on May 22nd, now on June 3rd everything breaks.
Doesnt make any sense, any help would be appreciated!
UPDATE & SOLUTION:
While I don't have a good explanation of why this suddenly has happened within the last week, I finally found a solution this morning.
I started with a new project and submitted to the app store with nothing but the identifier and correct version and build numbers, which processed fine. After that I started piecing in any assets that wasnt my own code until I got the "Invalid Binary" email. I narrowed it down to the Hockey App SDK (embedded framework) which was causing the issue and not even being used anymore so I removed it from the project (problem solved). The disturbing part is that nothing fails on my end during validation or submission and according to github this directory and content hasn't changed in a year, which leads me to believe something changed server side at Apple.
I did see a lot of posts via google saying that frameworks needed signed etc and when using Xcode 6 and iOS 8 it seems to be the standard which is why I assumed it might be something along these lines.
Im not sure how helpful this is as I was building for iOS and this article is in reference to Mac, but HockeyApp explains in order to distribute to the app store you need to sign the framework with your own identity here:
http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x/hockeyapp-for-mac-os-x
If anyone has anymore technical notes on this or why this suddenly changed Id love to understand this better.
I've checked a variety of places and there seem to be several things that are now being rejected by iTunes Connect. The solution is typically to remove the offending resource from the Target -> Build Phases -> Copy Bundle Resources (as #azizus mentions). Unfortunately Apple doesn't tell you what file causes this issue with your builds so you have to go hunt for yourself. Here are some items that I've found that will do it:
Shell scripts (Look for .sh files, though they could have a different
extension)
Also, look out for files that are listed as executable, when they
shouldn't be. Those might be a good place to look for shell scripts
that you might have missed.
Frameworks (Framework bundles, even .a or .o files - you
don't need them as they will get compiled into the executable binary)
DocSets (I don't know why, but I found that the HockeyApp SDK
includes a DocSet bundle which was the cause in my experience)
Sometimes this might also happen due to some weird entitlements
issue. The entitlements you have may not match up with the App in the
provisioning portal.
Look out for invalid characters in your app name or file names (like
wildcard characters)
This is a pretty broad list, something I did to help in the search is build an archive and then show the contents of the .app in the archive using finder, sorting by file type. The strange thing is that these files actually exist in the _CodeSignature/CodeResources file.
My own theory on why this is happening is that Apple made some changes (or is making some changes) because of Extensions and WatchKit apps. Essentially, you are including a couple of binaries in the packaged IPA (phone app, extension, watch app). They probably want to make sure you're not including something else that could potentially be executed. Unfortunately, the error message is too vague (really it's incorrect) for most.
This took me 3 days to debug.
In the end it was due to an external framework I created (lets call it X) that I was importing via carthage. X had its own dependencies that it was importing via carthage as well. In order to link these frameworks it had a path in the build settings called Framework Search Paths set to the location of the frameworks. For some reason it was this flag in this framework that was causing the problem specified in the questions. I eventually imported X's dependencies with Git submodules so that I didn't have to set the Framework Search Paths flag. I the exported the framework and manually added it to my project I was submitting to the AppStore. Then it worked.
I can reproduce this when I 'create folder references' for my resources folder as opposed to 'create groups' when adding in.
I contacted HockeyApp and they suggested not to add the SDK to app bundle. So I navigated to Target -> Build Phases -> Copy Bundle Resources and removed HockeySDKResources.bundle from there. iTunes Connect accepted my binary.
In my case it was a info.plist duplicated that was not used. (it wasn't easy find out the problem). I removed almost all the files of my project until remove this one and.. it worked
Clearing the value for Code Sign Resource Rules Path in each target resolved the issue.

PhoneGap Xcode Missing Header files on Build 'Cordova/CDVViewController.h' file not found

I am using PhoneGap 2.2.0 and XCode 4.5.2.
I can test my programs in the simulators, and I can put them on my devices to test them.
But I simply cannot build for distribution. It always fails with the following error:
my-projevt-path/Classes/AppDelegate.h:30:9: 'Cordova/CDVViewController.h' file not found
I've seen this problem around the web and still can't make it work, given whatever solutions have been posted.
I've changed things in Build Settings, I've reinstalled PhoneGap, I've run new lines in terminal, I've done my app over starting a new PhoneGap project from scratch, I've checked preferences in the build location in Xcode... I can't figure this out AT ALL.
Please, can anyone help? I've been working on this for days.
Thanks!
Problems in Xcode
If you have compilation problems related to missing headers, the build products should build into the same build directory. You may need to set the preference "Xcode Preferences -> Locations -> Derived Data -> Advanced…" to "Unique". This is the default setting for Xcode on a fresh new install, if you upgraded from older versions of Xcode, you might have a legacy preference in there that you need to update.
Found the answer!!!
Yes I am getting the same problem yeah and some help could be great.....
I followed all the instructions even with the ./update_cordova_subproject path as well it does not work. Also I solved the locking problem but I could not find the solution to this problem
The answer, in my case, had seemingly nothing to do with the error message that was being sent. Missing header files? That didn't seem to be the issue. Or, at least, not the direct cause of the issue.
This was an issue with my provisioning/certificates being somehow not right. I had re-created them several times, but it continued to be an issue.
I sent the job to another developer, who opened it on his machine, revoked my certificates and created new ones, and built it without changing anything else. He forwarded me the certificate, the provisioning, and an archive of the job. I opened the archive in xCode and validated it and uploaded it. And it was fine.
If you have got this problem, be certain your certificate/provisioning is set up right. I thought mine was, but apparently it wasn't? The "Apple Process" is definitely weird, and when certificates / profiles gets messed up, problems arise.
I was having the same problem and just solved it! First of the problem may very well be because of your distribution provisioning files... but when you look at the Project Navigator in xCode at the top level you have your Project and inside you have the CordovaLib.xcodeproj click on this file and you will see the iOS Deployment target. Make sure the proper IOS version is selected there. This is 1/2.
2) Then you need to duplicate the Release configuration and rename it Distribution. While the CordovaLib.xcodeproj is selected make a build and then build the actual project. This worked smoothly for me.
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.

How to restore my project wisely

So, it started as a simple test, where I had to delete my app from my iPhone (iOS4.3) just to check how the app behaves on a first run. (I am developing to support down to iOS4.3).
After the deletion, I wasn't able to run the app on my iPhone for some reason. The "Active Scheme" would show iOS Device, although I could manually select my own device from the list, the project wouldn't set my device by default. XCode would drop a message from the top saying:
Could not launch “project1” No such file or directory
(/Users/portal/Library/Developer/Xcode/DerivedData/project1-
cfjhjgezzcapwoadaivpptyywptu/Build/Products/Debug-iphoneos/project1.app/project
I went through this SO post (EDIT: Therefore, restarting XCode, iPhone doing clean project, hard resetting my iPhone) but this didn't change anything, except I can now delete the Derived data in Organizer.
I have a working backup at hand though. Thing is it is a bit outdated as I made many changes to the project. I can run the backed up project, and it seems sane as good.
Now my question is how can I merge the files back into the sane project? The XCode project itself has changed a bit, frameworks were put in as well as some settings.
I tried to simply copy the changed files into the old project, but all I get is a SIGABRT upon the first run. I did a FileMerge look, and saw that for some reason my projectAppDelegate.m is non existant in the PBXBuild section of the .xcodeproj file. which I didn't touch. seems like a mess here.
How can I merge the new project to the old one correctly?

armv6 and armv7

I've got an app that I created that I'm trying to test on an older iphone 3g. I've used this phone many times for testing but this new app for some reason will not accept the build.
I've done some searching and found that I need to charge the architecture from "armv7" to "armv6", I did this in both the project and target. After doing that I get the following error when trying to build to the device (construction is the name of the app)
Could not launch "construction"
No such file or directory (/Users/Matthew/Library/Developer/Xcode/DerivedData/Construction-cqtujdbjhpvbkrehtfzwvuhvxdrs/Build/Products/Debug-iphoneos/Construction.app/Construction)
But I can build in the simulator at it works fine... any idea?
thank you so much - clearing UIRequiredDeviceCapabilities in Info.plist would have never appeared to me.
None of these solutions worked for me. I'm using XCode 4.5 and ML. What I ended up doing (and still need to test thoroughly), was to re-create my project, started clean and then moved all sources and libraries to the new project and chose my provisioning profile for this new project. In the copy, I also manually copied the contents of the old Info.plist file and pasted them onto the newly Info.plist replacing them all.
In my case, I'm using CorePlot and that library needs armv7 (according to linker), so I can't just go armv6.
What I'm trying to figure out is when (cheap) XCode changed some settings to not run as a debugger on the device. I'm guessing something in the 'project.pbxproj' file. Otherwise I can't explain why the newly created project works and the old one doesn't.
I know this solution might not work for everyone, as in my case, as would lose all svn changes.
I'll post any progress on this.
My next step is to add CorePlot and let the project build it and not use the prebuilt one.
None of these worked for me either. But this DID work...
DO THE USUAL THINGS:
I cleared the build directory (cmd-k),
cleared the DerivedData (see prefs|Locations),
deleted the app from my iPhone 5,
unplugged the iPhone, and
restarted Xcode.
AND LASTLY DO THIS:
Open Xcode Organizer. Click on Devices | (your device name) | Applications. And finally, delete your application from here (aka. delete the app from your device, AGAIN).
Build and run...
Sorry I answered my own question! I figure I should leave this up in case anyone else has the same problem... I didn't update the plist setting to armv6 before... I did have to delete the armv7 in the plist to make it work

Xcode Build and Archive for Enterprise Distribution builds old archive

I'm working on creating an app for in house distribution enterprise level. I've created the app and tested hosting it on my own server and even getting the click to install working. Now though I have some updates to the app, I make the edits and I even see them in the simulator. When I build and archive the app things seem fine, then I go to the archived project in the organizer window, click the share button and distribute for enterprise, I enter details such as the ipa final url and the app title and then ok & save. Then I upload the app to my server and update any links to point to this new app. The click to install still works properly, but it installs the old version of the app. I've even tried this on a new device. Is there some step I'm mission that tells Xcode some version to build? If so, I don't get is how the simulator shows the update fine, but the archive that is built is not showing the latest code. The app I can find in the simulator dirs is 9.4MB in file size, but the one that is saved after build and archive is only 1.4MB (the update involves a lot of added images), so is the build for archive is not even getting the new files?
if a clean won't work, try completely removing the derived data folder.
the default location is in /Users/you/Library/Developer/Xcode/DerivedData . if you haven't played with the DerivedData location in preferences, this is likely where you'll find the sub-folder containing the cache.
when i encounter a situation similar to the original question (retaining items i've deleted, or similarly missing items i've added or holding onto project icons i've changed), i perform a clean on my project, close it, hit Delete… in the organizer, possibly even remove it from the organizer, possibly even remove from disk and then re-checkout from git if you have it under version control in this way, then re-open the project from scratch.
I figured it out and thought I should post it in case it helped someone else.
I cleaned the project.
Build > Clean - not 100% on what "Clean" is supposed to mean/do, but it allowed the project to build from the current files rather than the old files somehow.

Resources