Monday, July 8, 2013

Convert NSData into Base 64 string for SOAP services

Currently i was working on a SOAP request and wanted to send a file on the server, i looked at the SOAP request and saw that one of the parameter in the SOAP service accepted base64 as parameter, so i wanted to convert the NSData into base64 so after a long time spending debugging and breaking heads i finally surfed up and came saw a solution on stackoverflow  which i would like to share with you 

+ (NSString*)base64forData:(NSData*)theData {
    const uint8_t* input = (const uint8_t*)[theData bytes];
    NSInteger length = [theData length];
    static char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    NSMutableData* data = [NSMutableData dataWithLength:((length + 2) / 3) * 4];
    uint8_t* output = (uint8_t*)data.mutableBytes;
    NSInteger i;
    for (i=0; i < length; i += 3) {
        NSInteger value = 0;
        NSInteger j;
        for (j = i; j < (i + 3); j++) {
            value <<= 8;
            if (j < length) {
                value |= (0xFF & input[j]);
        NSInteger theIndex = (i / 3) * 4;
        output[theIndex + 0] =                    table[(value >> 18) & 0x3F];
        output[theIndex + 1] =                    table[(value >> 12) & 0x3F];
        output[theIndex + 2] = (i + 1) < length ? table[(value >> 6)  & 0x3F] : '=';
        output[theIndex + 3] = (i + 2) < length ? table[(value >> 0)  & 0x3F] : '=';
    return [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];


The above function will convert the NSData into base64 string which you can send in your SOAP service as a parameter. And if you are finding it difficult to work with SOAP services then here's a link to my old tutorial on SOAP service.

Happy iCoding and have a great day.

Join Us on Facebook

Thursday, July 4, 2013

How to jailbreak iOS device

The author of this post is my friend Faisal Mohd, he is one "TECH GEEK" when it comes to Mobile Technologies and he came up with this article on how do you jailbreak the ios device so i would like to thank him for sharing his knowledge with us. 

And yes if you have any questions or queries feel free to post it as a comment or via mail or on our Facebook group.

How to jailbreak an iOS device

The untethered jailbreak, a gateway to a whole new world of apps and tweaks and themes and what not is out there, how to do it?

Follow these simple steps to jailbreak iOS 6 and enjoy all the goodness of Cydia.
1) An iOS device running iOS 6.x
2) A desktop or a laptop running either Windows(XP minimum), Mac OS X(10.5 minimum) or Linux.
3) A USB cable to connect your iDevice to your desktop/laptop. And needless to say, iTunes.
The Procedure
1) If your device is not updated and you were waiting for the jailbreak, now is the time when you update your iOS. Connect your iDevice to iTunes and update it. Once it is updated, eject your iDevice and close iTunes. Work of iTunes is finished now.
2) Once updated, download the jailbreaking software developed by the evad3rs from here .
3) Connect your iPhone to your desktop/laptop again and see to it that iTunes is not open as it can cause unwanted errors.
4) Open the jailbreaking application. You will see a button which says “Jailbreak”. Press that button and let the process begin to jailbreak iOS 6.
5) After some time, you will be asked to unlock your device and once you do that, you will see an icon which for your information will be the icon of the developers, the evad3rs. Tap that icon once and leave it. The process will resume again.
6) Once the process is complete, the place where you saw the “Jailbreak” button, at the very same place you will now see “Exit”. Press that and you are almost done with jailbreaking iOS 6.x.
7) The last and the final step is, you will see the Cydia icon in your iPhone, Open it and let Cydia run its setup. Once that is complete, you are done.
8) Congrats. You now have an untethered jailbreak iOS 6 running on your iDevice. Enjoy.
Do let us know your comments or queries about how to jailbreak iOS 6. Be it a problem during the process or any general query.
1) It is highly recommended for you to take a backup of your device before continuing with the following procedure.
2) If you have a lock pass code, please disable it. This is an advice from the developers before you jailbreak iOS 6.
3) If by some bad luck, though I sincerely hope there is none, but if in the middle of the process something goes wrong or the process is stuck, don’t panic. Just restart the program or if necessary, reboot your device and do it one more time.

Happy iCoding and have a great day while you jailbreak.

Join Us on Facebook