Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-05-2011, 12:01 PM   #1 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 1
DelNewc is on a distinguished road
Angry ARGH!! - XMLParsing and selector delegate functions

Hello all,

Right, this is my first post, so please dont blast me if this is in the wrong section. ;-)

Right, so we have built an iphone app called "The NightLife Bible by NightOutGroup" and its approved and in the app store.
We are trying to make some updates for version 2 but are having some difficulty.

Feel free to download v.1.1 if you like, to get a feel for the app - it is completely free.


In crude terms the part of the app giving me problems currently does the following:

I have a tableViewController inside a TabBarController.

The TVC pulls an xml feed from one of our web services listing all the Nightclubs and venues in Sunderland, and displays the data inside the TVC. (This feed collector is pretty much a copy of the seismic demo from Developer.Apple - No point re-inventing the wheel)
From there, the tableViewController rows are clickable to get further info about the venue.

All fine and dandy, and works fine.

That is version 1 which just works for Sunderland.


For Version 2 We have added a settings page where you can select a city, and it stores the city in the AppPreferences.
This city value is then used in the NSURL RequestString bit to get the xml and return it.
Again all this fine, and the correct venues are returned for each city.


The problem is this:
If you change the city, the screen did not refresh.

So i moved the XML getter function from viewdidload to viewdidappear, and did some checks for to make sure the cities are not the same, to prevent reloading data from the same city.
This now runs the functions, mostly as expected, and returns the data!

For some reason, when the city is changed, one call is made to the xmlparser, as should happen, but the "insertEarthquaqes" delegate selector method is being run multiple times.

It works propperly the first time,
returns 2 sets of the same data the second time,
3 sets the 3rd time...
and so on.

This is not because i am forgetting to remove the existing data. I am removing all data from the TVC and the dataset at the start of the refresh function. - The multiple sets of data are not the old and new lists of venues, but the new set of venues multiple times...!

The Update Function is only called once.
The XML is only being collected from the server once
The XMLparser is only called once.
The List of venues is only being created once.
The insertVenues (or insertEarthquakes as it is called in the demo code) selector delegate method is being called the same number of times the view has been refreshed. Thus returning the same set of data, which is always correct, that number of times.

!!!!! Everything only runs once (as far as i can see) except the "insertEarthquakes" selector method, which is running the number of times the refresh is happening, and then adding that number of sets of complete results (venues)!!!!!



It is driving me mad! I have been on this for a week.



I then tried manually re-calling the function using a button and the same happens. If it is clicked multiple times, then you get the same number of multiples of correct results displaying.


It seems to know how many past requests for the data were made, and running the selector delegate function that many times!


Please can someone help. Its driving me MAD!!!

I will post the code as soon as I can.
DelNewc is offline   Reply With Quote
Reply

Bookmarks

Tags
delegate functions, selector functions, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 355
10 members and 345 guests
dansparrow, iOS.Lover, lorrettaui53, MikaelBartlett, Nobbsy, oztemel, pbart, PlutoPrime, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:56 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0