Wednesday 27 November 2013

How to deploy your app to web site


You may start reading this below:
http://stackoverflow.com/questions/11131605/cannot-connect-to-website-for-iphone-app/12136168#12136168?newreg=6ed9a87e3acc47feb7ef66f57c63327d


1. Go to Xcode => Product => Archive
2. Distribute button
3. Select second 'ad hoc' option
4. After selecting a proper provisioning profile, press Export
5. It will make .ipa and .plist files.

You are led to this page.
Make sure you click the check box, and enter URL correctly: type http:// and extension is .ipa.


Beside .htm, ipa, plist, I had web.config.
I am not sure whether it helped.


One stage, I had the below error.
In my case, it was server authentication things, it was just a typo in default.htm not referencing .plist file but test.txt file (i was doing this and that to make it work :( )


In this end, everything worked good!



Some people mentioned about authentication. But it wasn't my problem.


Wednesday 20 November 2013

KAL Calendar - Markeddates

I wanted to show dots on the dates I wanted.
The site http://stackoverflow.com/questions/12111309/kal-calendar-walkthrough was talking about related functions for this purpose, but I couldn't figure out where to start.

My KAL Calendar example downloaded did not show any Holiday dots!

But I found from GitHub site that the holiday information is actually in the 2010 and 2009. At this writing it is 21 Nov 2013. Of course I couldn't see anything! So I had to click all the way down to 2010.



To debug properly, i changed the Today button action to point to 1 Nov 2010.



 Then the debug mode showed 11 holidays are loaded by reloadData() in KalViewController.m.

Let's look at in detail.

(1) KalViewController.m - reloadData()
(2) HolidaySqliteDataSource.m - presentingDatesFrom()
- loadHolidaysFrom()
(3) KalViewController.m - loadedDataSource()
- reloadData() is finished.

(1)

(2)




(3)


At this point, I have the following two questions.
The answer for second question is Yes. Let's do this easy one first. By manually changing the array, you can control which dates to be marked!!


The answer for question 1 is that theDatasource is initailly set up when the view is loaded, but it never has a number of holidays until we press the 'Today' button.

What 'Today' button does is it assigns proper value to logic.FromDate and ToDate, so theDataSource will have proper holidays through the process explained above - (1),(2),(3)



If your purpose is to show some dates dotted, you don't have to use theDataSource (SQLite). Maybe writing some dates on text file and reading them on view load is enough - by changing the array markedDates[] in KalViewController.m.


Monday 18 November 2013

KAL Calendar - how to use

Source code:
storyboard version
xib version

In this article, I like to add a few more explanation to the following article.
http://www.edumobile.org/iphone/iphone-programming-tutorials/custom-calender-view-in-iphone/

The above link is a great article, but it was missing a few critical points and some screen shots.
The above link will  be referred as 'Edu URL' for the rest.
My environment is XCode 5.1 but using the Simulator IPhone->iOS6.1


Firstly download the KAL source code.
https://github.com/klazuka/Kal

Drag and drop whole src folder from Finder  into your Xcode project.


Build and run. I chose iOS6.1 as simulator.
(when iOS 6 SDK doesn't show:





We need to implement protocol in src/KalViewController.h
I think the Edu URL is incorrect about this one. It's not your viewcontroller. Protocol should be implemented from KalViewController.h.







Open your controller, ViewController.h.
As Edu url, declare three properties.
Note that, in the source code below, you imported "KalViewController.h" to use <calendarDelegate>



Open story board. As Edu URL, make one button and two labels.
Connect each control.

Build and run. You must have ARC error.
Find 'auto' in Build setting and disable ARC check.





Build and run. Your button should be working and returning error (we didn't implement function yet)
Go to ViewController.m. Implement date().


Build and run. At this stage, it doesn't make compile error but it doesn't show KAL view either.
It's because we haven't done NavigationControl. 

Open Main.storyboard.
Add NavigationControl.
The video without sound may help how to add NavigationControl in story board.

So, now, when you click 'Get Date' button, it opens calendar view.



Then we want to dismiss the calenar view when you select the date.
Open ViewController.m and implement delegate function dateSelectedAs().

Now when you click a date, it calls
KalViewController.m -> didSelectDate()
then it calls delegate function,
ViewController.m -> (void) dateSelectedAs()
and it dismisses the Calendarview.


Note that KalViewController.m didSelectDate() is called whenever the calendar view is called. NSLog shows that the function is called when the first date is showing and today's date is showing. 

So, in KalViewController.m, I added int variable, calCount. This int was used to call delegate function only when use clicks the date from calendar view. (1st and 2nd call of the function ignored).



Build and run. You will see the screen shots below.