Saturday 2 November 2013

Presenting a MFMailComposeViewController in a Preference Bundle

So, you want to throw up a modal mail form in your Preference Bundle for your tweak, perhaps in a support section? Sweet! Thankfully it's exceedingly simple; there's only one change to consider when comparing to Apple's example code for presenting a MFMailComposeViewController.


-(void)composeSupportEmail:(id)sender {
    NSString *emailTitle = @"Title";
    NSString *messageBody = @"Message";
    NSArray *toRecipents = [NSArray arrayWithObject:@"foo@bar.com"];
    
    MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
    mc.mailComposeDelegate = self;
    [mc setSubject:emailTitle];
    [mc setMessageBody:messageBody isHTML:NO];
    [mc setToRecipients:toRecipents];
    
    // Present mail view controller on screen
    [self.parentController presentModalViewController:mc animated:YES];
}

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
    [self.parentController dismissModalViewControllerAnimated:YES];
}

In the code above, all that has been changed is to use the parentController property inherited from PSViewController as the view to call presentModalViewController:animated: from. And that's all there is to it!

Monday 5 August 2013

Getting the homescreen and lockscreen wallpaper programatically (iOS)

Here's a small method that will return the homescreen or lock screen wallpaper of an iOS device as an UIImage.

#import <SpringBoard/SBWallpaperView>
#import <objc/runtime.h>

-(UIImage*)wallpaper:(int)var {

        SBWallpaperView *view = [[objc_getClass("SBWallpaperView") alloc] initWithOrientation:UIImageOrientationUp variant:var];
        UIImage *img = [[view.image copy] autorelease];
        [view release];
        return img;

}

Pass 0 for the lockscreen wallpaper, and 1 for the homescreen; feel free to change the orientation as necessary. Enjoy!

Monday 6 May 2013

So, where have I been?

As you can probably see, it's been a very long time since I last posted here! A lot of things have happened recently, but with schoolwork and everything, there hasn't been much time to do much else.

I've begun to learn Objective-C recently, and have an iPhone tweak that's about to go into a beta stage soon, once all the major bugs are finally ironed out. It's been tough to learn as I'm teaching myself it, but its very fun, and extremely rewarding. Also, I've been helping out over in the ModMyi community, creating a preference pane for a fantastic theme by the name of Strife (seriously, check it out, it's brilliant!).

If you want to check out any of my code, my github is https://github.com/Matchstic

The iPhone/Lumia project I was working on last year has seemed to died out currently, plus I've now got an ever-so-fancy transparent back on the iPhone - always turns heads when I'm out, people really think it's awesome to see the internals of an iPhone! I'll probably start work on it again at some point, although there was some fitting issues after I got the phone, so not sure if it'll work a-ok or not in the end.

Not sure if I've already mentioned this, but I now have a business - iRepairIT! It's only a small side thing, but I make a nice bit of money from it when I have time to fix things. The as yet unfinished website for it is http://i-repairit.webuda.com, but all my contact details are there if you need anything fixing.

"Here's to the crazy ones…"
-- Steve Jobs

Sunday 17 February 2013

A bit of a rant...


<rant>

Recently, I've become a bit disillusioned with Apple, mostly to do with their policy towards older devices and new features in both iOS and Mac OS X, and also with jailbreaking.

First off, I have an iPhone 4, with Siri and FaceTime over 3G, both of which are features only available on newer generations. Both of these run flawlessly, which really undermines Apple's argument that older devices can't support these newer features. I know of someone with an iPhone 3GS with Siri, so I honestly can't see why Apple would force iOS revisions with reduced features onto devices that can easily support them. Granted, on the 3GS, Siri doesn't run perfectly, but there's no reason to restrict it from the iPad 2 either - it has the same processor as the 4S! Same processor = same power, so it should be able to run it! In fact, I have first-hand experience of it running flawlessly, so the only reason I can see why Apple does this is for marketing, and money, not for the user experience. In the past, I'm certain Apple would have given users all features available in OS revisions to improve user experience, so why should Apple do this now? I do see the argument for Apple doing this - as a company, it would give them more profit - but in terms of user experience, it's a poor choice to make.

Now, I'm not an Apple hater - I personally own a few Apple devices, and use them all daily, even developing apps on them - but it's things like this that this that get under my skin. Users should not have to muck about in the system partiton of their devices to gain these features (although, I personally enjoy doing this). Which brings us to the subject of jailbreaking.

With jailbreaking, a whole new world is introduced to an iDevice - complete freedom over the device you bought. In fact, it can easily be argued that jailbreaking forced Apple's hand to bring about the App Store; the jailbreak community created Installer - a third-party "App Store" with apps for iPhone OS 1.0 - which showed just how innovative this community is. Since then, Apple has actually copied some features from the jailbreak community - the new Notification system introduced in iOS 5? That was a jailbreak tweak; same thing with FaceTime over 3G. Without this innovation, I'm certain iOS wouldn't have changed much from 2.0 to now. So, why does Apple try to dissuade people from enriching themselves and iDevice? According to their wiki, jailbreaking causes severe instabilities (couldn't find the link, sorry!). In truth, it's the complete opposite. Remember iOS 4.3.4 and .5? The security vulnerability they patched was patched by the jailbreak community weeks before they were released. If this doesn't show just how beneficial jailbreaking can be, then I don't know what will.

More importantly though, Apple attempting to prevent people from jailbreaking, such as through new security in the iOS kernel like KASLR, seems to suggest they want to prevent people from innovating. To me, this seems ridiculous. Instead, they should begin to open up iOS, and allow people to customise iOS to how they want it, rather than how Apple dictates. I have a feeling that doing this may even persuade a sizeable amount of Android users to switch over to iOS, since they currently enjoy much more customisability than stock iOS does.

Sorry if this seems rather biased - I am a member of the jailbreak community, and working on my first MS tweak - and if it made no sense whatsoever, but what I'm trying to say is that I believe that Apple shouldn't hold back software features to people on older hardware to force them to upgrade hardware, and that they should open up iOS much more than it currently is. Opening up iOS could be the best thing Apple could do in this situation; they would gain the combined resources of a community that has years of experience in pushing iOS to it's limits. Hopefully, an employee at Apple HQ on 1 Infinite Drive may see this, so I ask you, what's not to lose?
</rant>

Monday 24 December 2012

Christmas updates

Sorry for not posting for a while - I've been busy with A levels and launching my local business, iRepairIT.

Shameless plug: iRepairIT fixes your tech, from phones to laptops, routers to printers. I'm still working on a website, using the excellent Punch framework by laktek, but I have a Facebook page!

I guess you may be wondering what happened to the iPhone Lumia project I started this blog with. Well, everything is almost finished, just need to get it painted up with some good 'ol car spraypaint. However, I've decided to keep my iPhone's design intact, and install a transparent back, a dark chrome midframe, and of course, the glowing Apple logo. Even so though, I'll post a couple of pictures with the Lumia shell on the iPhone, but as a project, its unfortunately gone stale.

 As a bit of a side project though, I'm looking into decompiling the iOS kernel, finding the stub that prevents writing the hw.cpufrequency sysctl stub, and then patching it to be able to be written. Then, overclocking should work - the fstab method will just cause filesystem errors, and won't do anything. No guarantees though, since I've never done this sort of thing before. If it does work though, I'll be releasing the patch on my github for everyone to use.

Happy Christmas!

Sunday 4 November 2012

White screen of death fix, with broken buttons!

Yet again, my iPod Touch had the white screen of death. However, it was rather annoying to solve, since it now has a broken home button, so I could not simply do a hard reset to fix it.

To fix it, I needed the SHSH blobs for its current version of iOS, which is 5.1.1

First, I stitched these blobs into the appropriate 5.1.1 IPSW using redsn0w.
Next, again with redsn0w, I checked the status of the iPod. It appeared to be in normal mode, i.e. on.
*Without* going into pwnedDFU mode through redsn0w, I attempted to restore it through iTunes with my stitched IPSW.

iTunes then obliged to put the iPod into restore mode, nicely rebooting it in the process.

Once iTunes gave the error that I received last time, the iPod simply rebooted itself, back to a fully functional state.

Hope this information helps anyone in the same situation as me.

Sunday 28 October 2012

Rest in peace, iPad.

As many of you are aware, the Copyright Office recently ruled that the jailbreaking of tablet computers is no longer an exemption from the DCMA. This will undoubtedly have a large number of impacts for both the iPad, and the jailbreaking community. But firstly, what does this mean?

Since the jailbreaking of the iPad is no longer an exemption, it is now *illegal* to jailbreak the iPad. In MuscleNerd's words:



What implications will this have though?

For the average jailbreaker, it will mean a complete loss of freedom over their device, as of today.  They will no longer be able to customise their hardware as they see fit - no more SBSettings, and other usability enhancing tweaks. For many, this freedom offered through jailbreaking will be sorely missed, and it is likely many jailbreakers will switch to Android tablets, due to the freedom they allow. 

For Apple, it will mean a reduction in innovation. In the past, Apple has introduced many jailbreak tweaks into its official iOS updates, with one example being the greatly improved notification system in iOS 5. This was originally a tweak named MobileNotifier. See the new lock screen notifications? That could have easily been based off LockInfo. Without the availability of these tweaks, Apple will no longer be able to utilise these fantastic ideas to improve iOS for the iPad. Innovation will therefore be stifled, and so Apple could even lose sales of the iPad, as Android will be further ahead in terms of tablet innovation.

The developers of jailbreak tweaks, themes and apps for the iPad will be hit the harshest from this ruling. For some, the revenue generated in Cydia from sales to iPad owners is one of their main sources of income. Due to this, there will be a number of developers that move away from the platform to more open mobile OS's, such as Android, where there is a guaranteed revenue from modifications and themes. This would also affect iOS as a whole, as these developers also develop high-quality apps released in Apple's App Store, and so the general users of iDevices would be affected from the lessened availability of high-quality apps. In the past couple of hours, there has been at least two themes released in Cydia for the iPad, showing just how active the jailbreak community is around this device.

Many people rely on these jailbreak tweaks in their day-to-day use of their iPad - I for one use IntelliScreenX extensively. Jailbreakers have always been one step ahead of Apple, giving iOS features that cause many Android fans to go green with envy. Without the iPad being jailbroken, it's possible that the jailbreak community will lose some of its diversity, and therefore partially it's lead over Apple's development of iOS.

Whilst the ruling will only last for three years, it is possible that from the lack of innovation generated by the jailbreaking community for the iPad, Android tablets could easily have the largest market share by 2015. Many people will switch to the open nature of Android, since there is no option for total freedom over the iPad any longer, from the legality of producing jailbreaks for it. Apple will continue producing powerful hardware, such as the iPad 4, but will never allow users to have the freedom over their hardware like OS X allows. 

If this freedom isn't allowed, then the likes of the recently released Surface will easily take over it in terms of market.

The iPad is designed to be "a recreational tablet", in the words of Microsoft's Steven Sinofsky. It needs to be an open computer, with freedom over software, if it is to compete.

Until then, rest in peace, iPad.