Tardy Timer APP – Never be late for School Again

February 8, 2017 Leave a comment

Finally, got tired of the fragmented mobile market and decided to learn IONIC. In a month, here is my first app and it was a great learning experience.

Here is the link: https://itunes.apple.com/us/app/tardy-timer/id1199682959

 

Advertisements
Categories: IOS, Uncategorized Tags:

Upgraded Xcode and now it can’t find

February 14, 2013 Leave a comment

So, I upgraded XCode to 4.6 some time back and now it stops compiling my project. I am using Matt Gemmell’s twitter engine and it uses xmlreader.h. I checked my header search paths, then I checked my linker settings and found that libxml2.dylib was missing, so I removed it added it back again. But still no luck!

This is what fixed it for me finally.

  1. in XCODE go to Project–>Target–>Build Settings
  2. In the search box, type “header search paths”
  3. Either add or update libxml settings to $(SDKROOT)/usr/include/libxml2.

That should fix it!

Categories: IOS, XCode Tags:

Phonegap collaborator cannot install IOS app (app rolls back after partial install)

June 4, 2012 1 comment

The problem: You used Phonegap build to build your app and it is working great on your iPhone. You are super excited and you email your friend/collaborator/tester the QR code to download the app. But the app doesn’t install on his phone. At first it appears that the app is installing but right about 70% through the install it rolls back itself.

The solution: I struggled for hours with this. And since I am an IOS developer, I knew this was something to do with the provisioning profile (since I had experience similar issues with testflightapp.com in the past). I remembered that with testflightapp, all I had to do was make sure I login to Apple developer portal–> go to provisioning profiles and make sure my friend’s device ID was added to the ADHOC provisioning profile. In this particular case he was very much there but was still facing issues. In the end I realized, that Phonegap docs say that you should upload your developer cert and developer provisioning profile to Phonegap to share the app with others. Once I did this it worked like a charm. (Make sure your friend’s device ID is added to the developer provisioning profile though)

Categories: Uncategorized Tags: , ,

Initial GPS fix always incorrect : Corelocation, CLLocationManager

June 28, 2011 7 comments

The Problem:

You use CLLocationManager.StartUpdatingLocation( ) to get an initial fix on the user’s location in your code. But you notice that the location is always wrong and way-off.

Analysis:

Take a look at Apple’s own documentation of CLLocationManager here : (link to documentation)

Because it can take several seconds to return an initial location, the location manager typically delivers the previously cached location data immediately and then delivers more up-to-date location data as it becomes available. Therefore it is always a good idea to check the timestamp of any location object before taking any actions. If both location services are enabled simultaneously, they deliver events using the same set of delegate methods.

Basically, IOS returns you previously cached information. This could also mean that if you used Corelocation in San Francisco today and then used the app in Dallas next, it will still report your location in San Francisco.

Solution:

In my code below, I have used two ways of making sure I have the correct location. One is to make sure horizontalAccuracy is < 100 meters and the next is the location timestamp is < 15 seconds ago. If it falls under any of these two conditions, the location is probably wrong and can be discarded. In this case I just wait for IOS to give me a fresher more accurate location fix.

Point to be noted here is that because of this, be prepared to wait for upto 10 seconds depending on how accurate the location info you want to get. More accurate = more delay especially after a cold start. Chances are, if you are not writing a GPS turn-by-turn navigation app, you don’t need pin-point location info. So, play around with it and relax the accuracy as much as possible depending on what fits your app’s scenario.

– (void) locationManager:(CLLocationManager*) manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation
{
@try
{
if(newLocation.horizontalAccuracy > 100)
{
NSLog(@”Ignoring GPS location more than 100 meters inaccurate :%f”, newLocation.horizontalAccuracy);
return;
}

NSDate* eventDate = newLocation.timestamp;
NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
if (abs(howRecent) < 15.0)
{
NSLog(@”Ignoring GPS location more than 15 seconds old(cached) :%d”, abs(howRecent));
return;
}

[myLM stopUpdatingLocation];
}
@catch (NSException* ex)
{
[self debugMessage:ex.reason withTitle:@”Uncaught Error in didUpdateToLocation()”];
}
}

SOLVED: Application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv6

June 24, 2011 11 comments

The Problem :

I upgraded to a recent version of XCode, let us call it 4.x.x and when I submit my app to the appstore after making a release build, Application Loader slaps me in my face with this error “iPhone/iPod Touch: Application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv6″
When I went to build settings for my project and saw the architecture settings, I could only see armV7. ArmV6 was completely missing and I couldn’t do anything to add armV6 back.

My 2 days of effort to solve this problem. Here goes :

  1. Tried every damn thing to resolve the architecture issue as suggested by these posts ( I have tried 10 more posts but lost the links to those :
  2. Installed the previous stable version of XCode, this completely fuc….ed! my XCode. I mean XCode wouldn’t even launch after this.
  3. Installed the latest version of XCode again, stuck with same problem
  4. Finally uninstalled latest version of XCode using this command : sudo /Developer/Library/uninstall-devtools –mode=all. Don’t forget to REBOOT !! I forgot to do that and had to pay the price with 2 more hours of wasted effort.
  5. Reinstalled old stable version after SUDO command and reboot in step#4. Things started to look better, but ended up with this new problem. Basically, my project’s name disappeared from the Dropdown next to the RUN and STOP buttons in the top-left corner. I could only see the libraries I was using.
  6. Finally solved that by clicking Product –>Manage Schemes and clicking “AutoGenerate Schemes”, which added my project name back in the list

I am a happy camper now 🙂 The whole point of me blogging about all this stuff is to share my experiences and help a fellow developer out there so that he/she doesn’t have to waste the same time and effort which I had to. Hope it helps someone!

Downgrade from iOS5 to iOS 4.3.3

You are an iOS developer and obviously you downloaded and upgraded your iOS device to iOS5 beta the day Apple announced it on 6th June. At least I did. Really liking lot of the new features in iOS 5 now.

But if for any reason you want to go back to 4.3.3, Apple says you can’t do that. Not true! It is extremely easy :

  1. Download the iOS 4.3.3 IPSW file for your device from here
  2. Connect your device to iTunes on your computer
  3. In iTunes simply click (Mac) OPTION + Restore button. I believe on Windows it is Option = Shift or Alt.
  4. Browse to the IPSW file and and hit restore. Thats it !!!

How to detect /handle changes in network from 3G to Edge to Wifi in your IOS apps

June 21, 2011 2 comments

The Problem :

You want to detect in your iOS app if the user is on Wifi, 3G or Edge for some reason. Maybe your app downloads large amounts of data or streams media and you want to make sure that the appropriate signal is available for the operation

Also, you would like to detect any changes in the network as well. eg. when your app starts, the user is on wifi, which is awesome for your media rich app, but then he moves into 3G network and you want to take an action based on this change.

The Solution :

Apple has been nice enough to create a complete sample for us. It is called Reachability (Apple link). Here is the gist of it :

in .h file:

// declare Reachability, you no longer have a singleton but manage instances 
Reachability* reachability; 

in .m file:

[[NSNotificationCenter defaultCenter] addObserver:self selector:(handleNetworkChange:) name:kReachabilityChangedNotification object:nil]; 
reachability = [Reachability reachabilityForInternetConnection]; 
[reachability startNotifier]; 
NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus]; 
if(remoteHostStatus == NotReachable) 
{
NSLog(@"no");
} 
else if (remoteHostStatus == ReachableViaWiFiNetwork) 
{
NSLog(@"wifi"); 
} 
else if (remoteHostStatus == ReachableViaCarrierDataNetwork) 
{
NSLog(@"cell"); 
} 
..... 

- (void) handleNetworkChange:(NSNotification *)notice 
{   
NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus];   
if(remoteHostStatus == NotReachable) 
{
NSLog(@"no");
}   
else if (remoteHostStatus == ReachableViaWiFiNetwork) 
{
NSLog(@"wifi"); 
}   
else if (remoteHostStatus == ReachableViaCarrierDataNetwork) 
{
NSLog(@"cell"); 
} 
}