Transferring Xcode Project from one computer to another brings random errors? - ios

I have a Xcode project I got from another developer. Initially when I opened it it has a bunch of errors (most of which were un-updated frameworks). I got it to work after a while and I fixed it. I want pass it back to the manager since I'm leaving uni in a few months. I copied it over to my friends Mac to see what would happen if I just took the project and all it's folders and made it a zipfile. It didn't work for some reason. It gave me an error:
error: using bridging headers with framework targets is unsupported
But why did that come up? I mean it's the same code on the slightly different versions of Xcode (13.1 versos 14.1) but I doubt there was a massive change between the two that would cause this. I want to be able to pass these app later in the future without having to care about this stuff. I made a GitHub (link below) would cloning that work? Also the laptop I chose was just a fresh reset. Would it be due to not having coco-pods installed?
I feel like I could go through and fix it all on that laptop and document that but then I'm afraid that every time I put it on a new one it would come up with random errors every single time making my documentation moot.
https://github.com/AbdullahMSaid/SonicExperiment-Works
With big help this was Fixed.
Things that fixed it.
Having the correct version of Xcode
Turning everything from absolute path to relative
Lots of other code fixes. But those are my project specific.

You don't need bridging headers in framework. Use should have something like "YourFramework.h" where you can import your .h files.

Related

Annoying XCode Source Kit bug with multiple targets

I'm struggling with this problem for nearly half a year now with multiple XCode versions and Macs.
I can't reproduce bug steps exactly but the things go off when project has multiple targets like for Mac and iOS.
First of all XCode declines to take #if os into account and always highlight syntax only in one type of sections. E.g. if I have os(iOS) and os(OSX) somewhere it will chose only one and highlight only them.
Same goes for autocompletion. Things just not working in that type of projects.
I really dont know what to do since developmenet process turns into struggling. I dont want to split my project into multiple one, I'm happy with multi-target setup.
Is there a way to fix that?
Almost a year late.
Anyway I faced the same situation where a multi target OSX/iOS application in Xcode did not take into account the #if TARGET_OS_IPHONE conditional and failed to autocomplete method names from framework only showing the iOS variant.
Found a solution, based on this blog entry : you have to clearly state the Framework search path on each target in Build settings
Edit: This line was present in the iOS target settings. I copy/pasted it to the MacOS target in Xcode where it was automatically adjusted to the right path.
Edit 2: Loosely related but if you run in trouble with interface builder picking wrong classe files see this answer I just posted in another old thread.

Xcode 7 crash every time I try to print something in the debugger console

I've searched around and can't find anything on this.
Using Swift 2 and Xcode Version 7.0.1 (7A1001). Every time I execute something in the debugger console, Xcode crashes.
The project is not very big, and has less than 10 third party frameworks.
I can't think of much more information that's relevant, but I'm sure there's more, so please do ask me if there's anything I should add to my question that would help.
I've of course cleaned build and derived data.
It's driving me insane. Thanks!
UPDATE 16/11/12
Submitted rdar://23559366.
How are you maintaining your third party frameworks? Via Carthage?
If so then this is probably your issue: https://github.com/Carthage/Carthage/issues/924
This is an issue if the location of the /Carthage/Build/iOS folder is in a different location to where it was produced (i.e if it was compiled on a different machine and the absolute file path has changed).
A temporary fix would be to run carthage build --no-use-binaries on your machine to rebuild the symbols using the current absolute file path working around the bug.
But if you wasn't using carthage then its probably not your issue so sorry
I had similar problem with Xcode whenever I hit breakpoint.
In case you see this screen right before your Xcode crashes - you are lucky and my fix might save you. All you need to do is open this window and in the Project Navigator, select any file that you want, so that instead of that white blank view you would get your code. After this you are most likely will be able to successfully stop your app at your breakpoint and perform the debug.
I am not sure why this happens, but I suspect that the reason is Debug View Hierarchy mode, which you might have triggered prior to setting you breakpoint and trying to stop at it. At least this is when it happens to me.
I have similar problem earlier.
If you try to print non-optional variable and unfortunately it holds nil value then it breaks/crash. so that make sure declare all possible variables as "Optional type".

How can you permanently change iOS app configuration in Meteor Cordova?

Every time I meteor build, I have to open XCode and do the following:
remove and add an item from "Link Binary With Libraries" (Facebook SDK)
add a URL Type (custom URL scheme for my app)
add a "Required device capabilities" to "Custom iOS Target Properties"
How can I edit my Meteor project to have these steps done automatically, and to auto add things to AndroidManifest.xml?
In some way use mobile-config.js or cordova-build-override?
I'm happy to see another guy who is trying to build a hybrid application using Meteor / extending a Meteor Cordova iOS app, since I'm facing the very same issues. So I'm very happy to share my experiences and approaches with you. :-)
So far, I ended up with the following approach:
I created a base template for my iOS app using meteor build (not meteor run ios-device, since I did not know if Meteor does some optimizations for production code).
Then, I copied the whole Xcode project under /platforms/ios to another loaction and used this new project as my "master" project from then on. This project is being enriched with native code, e.g. it also includes the Cocoa Pods I'm needing.
Of course, I also did not want to copy files each and every time I trigger a new Meteor build. At least, I would like to have the Staging/www folder updated, as this is happening quite frequently.
So my first (rather naive) approach was
delete the Staging/www folder in the master project
replace it with a relative link (using Xcode's linking functionality) to the Staging/www folder inside the .meteor/local/.../ios/ project
This approach did not work, since the shell script used in the Meteor Xcode project can't handle these links.
My second approach is to create a symlink on the filesystem level instead. This works as it should, and I'm able to build the project in Xcode as it should.
I could have followed the same approach for the Cordova plugins folder, but I've decided to replace the plugins manually in order to get a better control over them, even it means a bit more effort then.
Having the symlink in place also means that Xcode's version management (and also SVN which I am using for everything) will ignore everything below Staging/www, which is good in my opinion, because I'm already versioning the webapp code in the Meteor project itself.
BTW: I've started a discussion thread on hybrid mobile app on the Meteor forums as well, but so far it did not get too much attraction:
https://forums.meteor.com/t/building-a-hybrid-meteor-cordova-app-share-experiences/8212
Maybe we could follow up on Meteor-specific things there, to have the Meteor community participate in the discussion?
EDIT: I would also like to share an approach that failed completely, at least for me, maybe I was too dumb... Before I used Meteor's Xcode template as the starting point, I also tried it "the other way round", i.e. I started with my already existing Xcode app project and tried to include Meteor's / Cordova's part by hand. Using this approach, I never managed to set everything up correctly. I had lots of troubles and also had to tweak a lot of the compiler / linker flags to even get the code compiling. This grew me a lot of gray hairs. But even after I managed to get everything to compile, Meteor hang during startup - and I never figured out why.
One remaining problem I'm still facing is that Meteor's hot code push functionality seems to have some severe issues on iOS, that are also documented as GitHub issues. It can happen that the iOS app gets completely broken and needs to be reinstalled. I tried the mdg:reload-on-resume package, but this did not work as it should and made things even worse. As far as I can tell from the GitHub discussions, one should better disable hot code push until the Meteor team has addressed these issues. Breaking the app completely due to code pushes is not what my users would expect.
Unfortunately plist values (and assumably AndroidManifest.xml as well) can only be changed by a plugin:
Add entry to iOS .plist file via Cordova config.xml

More FacebookSDK/Facebook.h issues - file not found

Alright, guys. I'm going freakin' crazy with this one. It is utterly ridiculous that the FacebookSDK causes so many issues. I know there are a couple questions on here regarding this issue, but they all seem to be outdated.
I pulled my Xcode project onto a new computer, and can't build it because I get the "FacebookSDK/FacebookSDK.h" file not found error. There are answers such as This one, but I've followed the steps in every single answer and haven't found one that works. I've just made a fresh pull from my working project from the original machine to the new one. I'll take some screenshots showing my current settings for various fields mentioned in other answers, and maybe I Just have something wonky that is interfering.
Here are the contents of the SDK that I just downloaded
Here are the contents of my Xcode project folder. There isn't anything else Facebook in here.
Here are the frameworks inside my Frameworks group and inside the Link Binary with Libraries section of Build Phases
There are a couple frameworks that are red, and that's OK for now. They were not in the repo, and are instead referenced from Documents or Downloads, and they played nice when I moved the files over and linked them. I just reset my repo to when I pulled it to make sure I didn't have anything from weird stuff I tried that prevents a proper solution from working.
Framework search paths. You can also see that my library search paths is empty. I labeled the stuff I wanted to hide, as it was identifying information
For some reason, my Documents for the new machine is already under the framework search paths. I did not add this myself.
Any ideas on what I can try? This is endlessly frustrating. I've wasted an entire day of development on trying to get Facebooks SDK re-integrated on a new machine.
I was also face the same problem every time I got the checkout for new version from svn.What I did was just removed the Facebook SDK and add again from the backup.It taken me out that time.Please try this might be it works for you.

iOS - missing Platform Libraries

First of all, I've never worked on iOS, so this may or may not be a stupid question, I don't know :)
I have an iOS App, and I need to run it.
In the 'Project Navigator' I have a folder/package called 'Reuse and Platform Libraries'. Inside, I have another four folders but 3 of them seem like missing.
I am not sure if this is the case. I've tried googling their name but without results so I assume they are not some open source libraries.
Can someone clear this up for me? Do I need to install some XCode packages?
Thanks!
I suggest you search the folder of the project for those files, sometimes when copying a project the paths get screwed up because they were set as absolute paths and not relative paths.
If you can't find the files, it's most likely that the library is a private one used by the previous developers, and usually kept out of the project folder so they probably forgot to send it along. I'd suggest simply asking them to send the files over :).
There is also a slight chance they are not needed to run the file, in which case, just deleting them from the sidebar should make the project run.

Resources