write an iOS 5.1 app that uses a web service - ios

I am fairly new to iOS programming and I'm trying to make an iOS 5.1 app that communicates with a server to receive information from a database. I got the server returning the needed information from the database by following this tutorial:
http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app
But then I tried to follow a the other half of the tutorial by the same guy:
http://www.raywenderlich.com/2965/how-to-write-an-ios-app-that-uses-a-web-service
In this one we use JSON, ASIHTTPRequest and MBProgressHUD, but I get a lot of errors when I run this because ASIHTTPRequest is no longer supported in iOS 5.1.
Can anyone point me in the right direction here? I you can show me another tutorial that works for iOS 5.1 that would be great. I have looked but I can't find any.
Thanks

ASIHTTPRequest is most likely returning errors in your iOS 5.1 app because you're using ARC. ASIHTTPRequest wasn't written in ARC, which is why it's throwing tons of errors. But there's an easy workaround:
In Xcode 4's groups and files pane, select your project file at the top of the list.
Select your target towards the left hand panel.
You should now see a list of all the implementation (.m) files referenced and compiled throughout the course of the program.
Double click the implementation files for ASIHTTPRequest and add the following linker flag: -fno-objc-arc. This linker flag acts as a crossbridge between the old non-ARC files and your ARC-based project.
Although there may be residual warnings left, this trick should remove all other error messages associated with ASIHTTPRequest.

When I followed that same tutorial I got a lot of errors. and the build kept failing until I reliased it was because libz.1.2.3.dylib wasnt there. If you go to Build Phases, remove that from the list and add libz.1.2.5.dylib all mine worked first and I got the app working fully :)

Related

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

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.

No such module Parse using Swift in Xcode 7.1

There are several questions addressing this issue already, but all of them (I think) are in reference to earlier versions of Parse using an objective-C bridging header to connect the framework. I am using the latest version of Parse that has support for Swift directly, which is a different setup process.
I've downloaded and added Parse to Xcode in the Build Phases -> Link Binary With Libraries. The directions on their website are extremely straightforward...download the SDK, add it to Xcode, import it, and done.
Parse seems to be added properly everywhere it should be:
But alas, when I use import Parse, I get a no such module error. I've tried adding the framework search path $(PROJECT_DIR) under Build Settings both recursively and non-recursively, and a few other recommendations from the other questions addressing this issue, but with no luck.
I'm wondering if this could be an issue with Parse or the Xcode beta, since both are extremely new, but I'm assuming the error is on my end, just not exactly sure where to look since the quickstart guide on Parse.com seemed so simple.
Apparently if you drag the Parse library to the 'Link with Binary Libraries' section, you will continue to get this error.
You have to drag Parse to the project navigator for it to properly import.
Since it should work regardless of where you drag it into Xcode, it is possible this could be a problem with the Xcode 7.1 beta or the updated Parse API for Swift support. I'm not entirely sure, but either way, it's a really simple fix, so not a big deal.

iPhone PhoneGap restKit / jsonkit duplicate symbols

I was ask to take a existing website make it PhoneGap so all went well I converted it to backbone included phonecap.js for the more funky stuff. Then I was ask to create a AR view so I told the people I will do this in native rather because I am not sure it will be possible in PhoneGap or it will just take to long.
So I created a separate project where I did the AR component tested it and it worked fine. It uses RestKit to download data and then in camerapreview shows little bubbles representing data.
This week my job was to combine them so you click a button in PhoneGap and then it opens the native viewcontroller. Again all went well. I created the plug-in it calls the function so next step was to copy all the AR logic over and that where all hell broke loose.
I keep on getting duplicate symbols a whole lot of them I spend 6-7 hours trying to solve it but nothing I went thru 100 of websites with different solutions and none worked.
So 3 o'clock I decide f* restkit let me use just jsonkit and do the mapping myself but the same thing happened duplicate symbols and each time it cordova / PhoneGap and then the library.
Am i doing something wrong or is cordova just no good?
Found the problem. Basically my application and the library I used RESTKit/JSONKit used the same library. So to fix you remove the library that's conflicting either from yours or from the library most cases just remove yours. And then reference the libraries library .h file if you removed yours.

How to build against the RestKit framework in Xcode 4.2?

I am trying to follow this tutorial for integrating RestKit into my project but I am running into some problems. When I add a target dependencies the dialog that popup does not have the bulls eye. I still select the RestKit one (this has a little building next to that's white. Then when I click on Link with Libraries, and I dont get the choices to add the libraries for restkit. Ive tried this in my current project, a blank project, and nothing seems to work. Any ideas what I am doing wrong?
That tutorial is a little out of date. They updated the way Restkit builds (simplified it). There's a thread about it on the Restkit mailing list.
That said, here's what it would look like with the latest Xcode:
So for iOS you'd select the first on the list, with the little house-looking graphic. For Mac you'd choose the framework.
I found the tutorial at https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x to work with Xcode4.2. Make sure you follow all the directions. But, here's the catch. I couldn't get it to work with a project that I convert from xcode3. Probably could have but gave up. I made a new project in 4, dropped all my sources in it, then followed the directions in the above tutorial.
You can just drag the libRestKit.a file from the Products Group of the RestKit project into the Link with Libraries Build Phase of the build target that needs it.

Adding Chipmunk Files to XCode NSObjCRuntime NSZone Parse Issue

Im working on SpaceViking project from Ray Wenderlich's Cocos2D Book and the project has worked fine so far. Near the end we are told to add Chipmunk files to the Xcode project and compile & run to test everything is fine without adding any new code yet.
As soon as I do that I get many Parse Issue errors coming from NSZone, NSObject and NSObjCRuntime which I don't get otherwise.
Can anyone help me out on this one? It should be an error on some of the added files. How do I find which one and where the error is being generated so I can fix it?
I would check and make sure the added files are 'typed' correctly by Xcode. Make sure they are set to Objective-C, C++ or C (whatever is appropriate in this case). I used to get tons of errors when importing C files that were mistakenly recognized as Objective-C by Xcode. Just changing the file type would solve most of the compile errors. Just and idea.

Resources