Compiling/Running Cocoa Project implementing NSSharingServicePicker in 10.7.x - objective-c

I am learning about Objective-C/Cocoa and have downloaded the source code to a popular TeX typesetter and loaded up the project in XCode to play around with it. Compiling fails, and all of the error messages I have seen (so far) have to do with something called NSSharingServicePicker not being recognized. I gather (from this SO question and this Apple documentation page) that this is a class not available in 10.7.x. It therefore makes sense why the code won't compile on my Lion machine.
My question is, I guess, why I am able to run the downloaded package of TeXShop on 10.7 at all? (According to the website, this version is for OSX 10.7 and up.) I am interested in making a few minor changes to this project; am I not able to check my changes/compile unless I'm using a Mountain Lion machine? Is there some kind of update I can download for coding/compiling purposes?

Assuming you are using Xcode 4.6.*, you should be able to set your project to use the 10.8 SDK and get past the compile errors. (That's the "Base SDK" build setting.)

Related

Invalid Binary Or Invalid Swift Support

After I send my app for approval to the app store I get the message 'Invalid Binary' in the iTunes Connect. Then I get the following message in an email from Apple:
Invalid Swift Support - The bundle contains an invalid implementation of Swift. The app may have been built or signed with non-compliant or pre-release tools. Visit developer.apple.com for more information.
My app is just a simple game application. No external programs are called. I have researched this message and went through and checked the following:
xcode is up to date - checked in app store
EMBEDDED_CONTENT_CONTAINS_SWIFT to YES or NO
send with the xcode app, not the application loader
did NOT build with the command line
(Xcode menu -> Preferences -> Locations tab - verified that the Command Line Tools matches Xcode version.
"Clean"ed the app, rebuilt and rearchived and then resent, same message
The app validates through the organizer fine
viewing the contents of the archive shows a SwiftSupport folder
I am only using one developer account and have never logged into any other developer account
I cannot find anything online that would help solve this problem.
I am running OS X Yosemite 10.10.1.
xcode version is 6.1.1 version 6A2008a - built, cleaned and sent with this version
I have also pressed the Option key and "Cleaned Build Folder" and resent, same message
I cannot find any other reason for this online or in any forums. Any help is greatly appreciated. Thank you for your time.
SOLUTION I FIND
Edit:
(1)
One you contact Apple and you wait long time … for reset iTunes connect because this problem coming in Apple . (Apple ask to send log of this problem)
(2)
An other solution, your create an other project application on iTunes connect and upload your work, this solution work fine, is the solution for me .
(3)
An other solution, you create a new project on Xcode, copy and paste your project in this other project.... (create new provisioning profile etc..) And upload your work in the same project application on Itunes Connect.
(4)
Step (2) + step (3), create a new project in Xcode and Itunes Connect.
(5)
Create a new project with the same name bundle identifier, it works perfectly !
See: Technical Q&A QA1881 Embedding Content with Swift in Objective-C.
It seems that you only need to set EMBEDDED_CONTENT_CONTAINS_SWIFT to YES "If you are building an app that does not use Swift but embeds content such as a framework that does".
What language is your app written in? If Swift yo do not need EMBEDDED_CONTENT_CONTAINS_SWIFT.
I ran into this problem the other day. Took some doing, but I finally figured out the problem ( for me at least). Everything I read online said the problem had to do with this setting:
EMBEDDED_CONTENT_CONTAINS_SWIFT
When this started failing, I had this set to NO. So I tried setting it to YES, and it still failed for the same reason. The GUI wouldn't let me remove this setting, I could only change it between YES and NO.
For what it's worth, my code has no EMBEDDED code, it's all just straight up SWIFT.
Anyway, so I decided to uninstall XCode and redownload it, hoping that would help.
While XCode was downloading, I fired up Beyond Compare, and compared my current project, with a backup from last week, to see what could have changed.
Beyond Compare found that a file deep inside the Projectname.xcodeproj file, changed ... a file called project.pbxproj file.
Inside this, was that line:
EMBEDDED_CONTENT_CONTAINS_SWIFT = NO;
This appeared in the current version of my project (that was failing). Interestingly enough, this line didn't exist at ALL in the old backup version from a week ago. I know that I didn't set this flag. There must have been something in Xcode that did it under the covers.
Anyway with that knowledge, Xcode finished downloading, and I reinstalled. Started it up, opened my project, and magically, Xcode REMOVED that line from the .pbxproj file, and now my project uploaded to itunesConnect sucessfully.
BottomLine: There's a bug in xcode that it may decide to add this line to your project for no reason, making your project invalid.
Solution: Editing the pbxproj file yourself and removing that line might work ... but reinstalling XCode seemed to clear up any confusion it had, and it removed it for me.
If you are submitting an app that has an AppleWatch extension, you can get this error if you try and submit the app using the Application Loader utility and a zip file. I got the error:
The bundle contains an invalid implementation of Swift. and
The bundle contains an invalid implementation of WatchKit.
I went through pretty much every solution for the first of the errors - but it was submitting via Xcode that fixed it.
well xcode 6.1 is a bit old and contains old swift. xcode 6.4 is the newest public one IIRC
"Check your code signing. I had this error when in automatic signing. I Put my dev profile for dev and production profile for release version and error is gone."
Link for the Quote
Sometimes this happens inadvertently.
To be safe, all components of your app should be built with the same version of Xcode and the Swift compiler to ensure that they work together.
I think you need to do a pod clean and install. I reckon one of your swift pods was created on a old version of Xcode, you updated Xcode and then tried to do a submission to the app store.
Read the apple swift blog about binary compatibility and frameworks
You will also want to specify that your embedded content contains swift in the build settings:
EMBEDDED_CONTENT_CONTAINS_SWIFT
Enable this setting to indicate that content embedded in a target's product contains Swift code, so that the standard Swift libraries can be included in the product.

Cannot load nib/xib file in Mavericks

We have a Mac application we wrote about 3 years ago. We've been maintaining it through all versions of OS X since Leopard (10.5). It's a 32 bit universal binary and is part of a suite of packages, all compiled and built the same way.
All apps are working under Mavericks except one, and only one part of it is broken. In this "broken" app we have a menu option that allows the user to open up a simple logging window. All this thing is is an NSPanel with a text view in it. When we open it, the spinning beach ball comes up and observing the console, it identifies this program as "hung."
This thing has been working for years. It works on both PPC and Intel from Leopard up through Mountain Lion. I thought for sure there was deprecated code in it somewhere, but I went through it and couldn't find any. There's really not much to it anyway. All it does is open up and spit out text. I then traced through the code and found out the nib wasn't loading.
I have Xcode 3.2.5 installed on this system (it's been upgraded since Snow Leopard) without iPhone support and it seems to work. In any case, I thought I'd take a look at the actual contents and window layout to see if maybe I had some unsupported or dated support, and when I double click on the xib file from Xcode, when Interface Builder opens up, it locks up too. We have I think 5 xib files in this application, so I double clicked on all of them and they all open up properly in Interface Builder. The only one locking up is this one. As a test, I opened the xib up in Xcode 4 and it opened up properly.
We can't really move to Xcode 4 because we have a fair number of clients (about 30%) still using Leopard and Snow Leopard. We typically build in either Lion or Snow Leopard. but haven't had any problems compiling and building under Mountain Lion. This app, and all the other we have will compile and build using Xcode 3.2.5 on the Mavericks system. Everything seems to work except this one xib file.
Has anyone ever encountered something like this? Are we overlooking something? Are there changes to the OS we've overlooked? Is this an OS bug?
If you use Retrospect backup, check whether the NIB files have been caught in a backup on the server.
I have recently found several applications which Retrospect cannot handle backing up the NIB files and does not let go of the NIB files until after the backup job has been stopped.

Developing for Iphone without XCode [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I develop for iPhone using a Windows development machine?
iOS development on Windows
I began to study objective-c and cocoa with a friend but there's a problem. I have a mac and i can write code and stuff on XCode, but my friend can't, because he have not a mac. Is there a way to download the iphone sdk and use objective C and Cocoa on a windows supported IDE? So he could write, test and send his code to me so i can try it on XCode.
Thanks for your answer.
You're not going to find an IDE for Windows that supports iOS development using Objective-C and Cocoa Touch. Your best bet would be to run Lion using a VM (virtual machine). However, this is illegal to the best of my knowledge. Yes, since Lion there have been some changes to the EULA (End-user license agreement), but these only allow Lion to be run on VMs if the host machine is already running Lion. That's right: you can run Lion using a VM if you're already using it. Not very helpful. Some people would whip out the old "who's going to catch you?" stuff, but that's not exactly sound legal advice.
Your friend has a few (legal) options. They can buy the cheapest device capable of running Lion and the latest version of Xcode. Alternatively, or in the meantime, if you're only doing basic stuff, you could have them write out their code into any text editor which supports Objective-C syntax highlighting, such as NotePad++. Then, they can send the files to you and you can add them to a project in Xcode. Of course, this means you'd probably have to do most of the nontrivial debugging and all of the compiling, etc, and that might be harder on beginners who are more prone to make mistakes. There's really not much you can do. You could look into GNUStep but that's closer to Cocoa and not Cocoa Touch (you said Cocoa, but since you want to make iPhone apps you obviously mean Cocoa Touch, which is different).
This could be a bad answer, but you and your friend can share a sigle mac/or mac mini whatever you have, with TeamViewer. When you are not working allow him to access your mac through teamviewer.

Strange application behavior when building a project with the latest xcode/OSX version

I have an OSX application written in Objective-C/Cocoa using xcode. The application is quite finished, tested and sold on the App Store.
I haven't worked on this application for some time and recently, I rebuilt it using xcode 4.3.3 on my OSX 10.7.4 and I noticed that while it builds just fine, there are some very strange visual glitches when running the application that were never seen before and occasionally, I get EXC_BAD_ACCESS when closing the application. All these seem to be related to the PDFKit framework I am using. I am unable to debug these problems since the glitches are just visual (nothing I can check in code) and EXC_BAD_ACCESS exception comes from internally allocated objects not related to my code.
The code itself haven't changed, I tried previous revisions of the code and they all exhibit the same strange behavior now. I tried running an old binary I have of the application (compiled couple of months ago) and it works just fine. Then I tried building it with previous versions of xcode, down to 4.2.1 (which I know was ok when I submitted the app to the app store) and the problems still occur.
Then I suspected this may be something specific to my environment so I built the project on different machine also with xcode 4.3.2 and OSX 10.7.4. Same results, the problems are still there.
So now I suspect that it has something to do with the OSX 10.7.4 update since this is the last thing that was changed between now and when I was able to produce a good build of the application. I am pretty puzzled to what to do next and how to identify the cause of this problem. I have an old binary that is working fine and I have a newly compiled binary of the same code revision that has problems.
Is there any useful information I can get from the difference of these binaries? What can I do to determine the cause of these problems? What can I try next?
Thanks!
NOTE (update): I stated it above but I want to make sure it is clear. This is a Mac OSX Cocoa application, not iOS.
just reset your simulator then try.
I hope you check the ARC information
go to your project Target set build settings --> Search Paths-->Always Search User Paths Set Yes.
And check your all class variables different from one another.
Xcode--> preferences-->Documentation check installed core Libraries (or) install it
like that
Xcode--> preferences-->Components check required component installed or not
check these things in your project.
Are you sure your customers are not having the same problem? Since you have tested the application on a different machine you probably do not have corrupt libraries installed (unless you did not install from scratch but used some migration tool?), so that is probably not the problem.
Most logical explanation to me would be that your customers also have this problem but they haven't reported it yet. In that case, you probably have a memory problem and there are techniques to attack that.
In any case, eliminate all the parameters that you can eliminate to simplify the problem. Deconstruct the application until the problem does not occur anymore or reconstruct the application in a different project until the problem occurs again.
It sounds like a nasty one, but you'll get there in the end, with patience and perseverance :)
First of all, you need check and verify the build log for suspicious compiler warnings.
For EXC_BAD_ACCESS, XCode analysis will give useful information.
You could try 10.6 or 10.5 (need manual installation) SDK. Or restrict the deployment target to 10.5 or 10.6.
I will answer my own question (since none of the above answers really answer it) so anyone with a similar problem might have a hint. I was not able to understand why exactly this happens but I'm pretty sure this is not a problem with my code but rather some glitch on Apple's side. And there is a workaround.
First, I compiled Apple's sample "PDF Annotation Editor" project on my Lion 10.7.4 and while the functionality is obviously different from my project, it also exhibited similar glitches with the PDFView display that my project does when compiled with 10.7.4
Then I proceeded to building a fresh clean system on new hard disk. Intalled Snow Leopard and upgraded to 10.6.8 and ONLY installed xcode. Compiled my project (the source code always stays exactly the same) and everything works fine. No problems seen in the compiled project.
Updated my OSX to Lion 10.7.4 and xcode 4.3.3, same source code. The problem is there after I compile it. I am pretty sure that if I tried 10.7.3 first, I would not see the problem as I remember it only starts with 10.7.4 but Apple doesn't provide any reasonable way to update to 10.7.3 first or downgrade to it after 10.7.4 is installed (shame on them, not very developer friendly!).
So, the problem appears in 10.7.4.
Then I installed the pre-release version of 10.7.5. This was the only thing that was changed, same source, same xcode. To my surprise, the compiled code works flawlessly now and the problems seen with 10.7.4 are now gone!
So my workaround - wait for 10.7.5 release before working on the project further. Hopefully Apple won't screw it in the future with Mountain Lion. I don't think I am going to try and debug it further or submit a ticket to Apple, going to be a tough case to explain.
Thanks for the responses.

Cocos2d Targeting iPhone/iPad/Mac

I recently did some research on making a cocos2d app for iPhone/iPad AND Mac. I have done the iPhone/iPad route but have never done it with a Mac target. It appears that some people have added it as a target but mentioned that it is finicky and others have suggested making a separate Cocos2d Mac project that uses the same files. Any wisdom to impart here?
I believe it is absolutely crucial to have both iOS and Mac targets in the same project. Otherwise you'll spend too much time keeping one platform in synch with the other, until eventually you either manage to create a good (but still time-consuming) workflow - or end up neglecting one of the two platforms.
Ideally the code base should make as little use as possible of compiler macros. You'll want to compile both iOS and Mac code even if it's not being used for one platform. So having some classes or methods that are #ifdef'ed to Mac, others to iOS, will more often than not lead to compile errors when you switch targets. That means wrapper classes, so that you can write the same code regardless of the platform, are essential.
Right now, Cocos2D doesn't offer you to create iOS & Mac targets in the same Xcode project. The way to get there isn't immediately obvious either, because each target requires its own build settings for: Base SDK, SDK Root, Deployment Target, Architectures and possibly Compiler version. It gets worse if you also want to use 3rd party libraries (Box2D, Chipmunk, etc) because in some cases you'll be forced to create iOS and Mac specific targets for those libraries as well - if only to ensure that the library is built with the same compiler as the project's target, otherwise you can run into the strangest build or runtime issues.
I've had issues getting these platform specific targets to work within a single Xcode project without Xcode complaining or otherwise misbehaving. I haven't tried it with Xcode 4.1 and 4.2. By that time I had created .xcconfig files to host the build settings. The .xcconfig files may or may not be necessary with the more recent Xcode versions but they definitely make managing multiple platform-specific targets easier.
Long story short, the best and easiest way to do cross-platform development with cocos2d-iphone is by using Kobold2D.
Most of the 15 template projects have an iOS and Mac target in each project, you just need to select the corresponding scheme, then hit build & run. The most commonly needed platform-specific code (processing user input) is wrapped in a platform-agnostic, simple to use wrapper class KKInput.
Disclaimer: I'm the developer of Kobold2D. There's a slim chance that I may be biased. You should try Kobold2D anyway. :)