A (brief) review of iOS 11 and macOS High Sierra

As promised, here is a short review of iOS 11 and macOS High Sierra. I’ll also do a review of the iPhone X when I get one.

iOS 11

So far, my experience with iOS 11 has been pretty ok. Running on my iPhone 6, performance has been similar to that of iOS 10 with some animations sped up making it seem a bit faster. The scrolling in apps like Safari is noticeably smoother and feels more like scrolling using the fantastic trackpad on my Late 2013 Retina MacBook Pro. The new Control Center customization and long-press options (requires Force Touch’ing on later iPhones) are a welcome addition, however I do have some gripes. Not being able to directly switch off WiFi/Bluetooth is annoying since those controls only disconnect you instead of turning off the radio itself. You now have to go to the Settings app to do that. Secondly, the new interface for playing music is buggy, as I have had trouble with 3rd party apps like Amazon Music responding to the play/pause/skip controls. Hopefully this will be fixed in a future update. The new notification center is basically the lock screen view which is strange and doesn’t work as well as the iOS 10 notification center did. Speaking of the lock screen, having to tap “Use Passcode” when I don’t is annoying when I don’t want to use Touch ID. This is actually pretty often since my Touch ID sensor can be spotty at times. These are just some annoyances caused by having older hardware. All in all, it’s a ok update, nothing spectacular.

macOS High Sierra

This was a bit more eventful, mainly because things broke after installing. The install process was quick on my MacBook and slow as expected on my Mac mini. APFS doesn’t seem particularly faster than HFS+, but maybe I just haven’t noticed it yet. Apple did announce that spinning hard drives and Fusion Drives would be supported in a future update. Opening apps such as Safari have become a bit smoother likely thanks to Metal 2, since the window manager is now rendered directly by Metal. Overall UI is a bit faster and higher consistent frame rates. Now for the things that inevitably broke, one of which is a huge annoyance. The first thing was Outlook which refused to open, but this was easily solved by downloading the latest version of Office 2016 for Mac. The more pressing problem was my VPN client, Watchguard IPSec Mobile VPN, stopped working. This is a bummer since I use my VPN to work from home. Looks like Watchguard takes forever to update, and that breaking after OS upgrades is common, so it might be a while before there is support for High Sierra. If you happen to rely on this client, hold back on upgrading to High Sierra. If there is no update in sight within a few weeks, I might just buy equinux VPN Tracker, which supports connecting to Watchguard endpoints as well as yearly OS updates as long as you purchase the yearly subscription ($79/year). This might be a better option than paying once for Watchguard’s own client.

That’s all for now. I will update this if I find anything else broken or interesting about iOS 11 or High Sierra.

[UPDATE 9/28/17]: There is a workaround for WatchGuard’s Mobile VPN Client on High Sierra. Completely uninstall the client using the Uninstaller package included in the dmg for the latest version (2.05). Reboot after uninstalling, then re-install using the Installer package. You should be go to go now. WatchGuard is waiting on NCP, the original author of the client, to issue an update for full High Sierra compatibility.

iPhone X, iOS 11, and macOS High Sierra

Over the past few months I had been closely following almost every major rumor about the iPhone X, and the one everyone hoped would be wrong was of course true, the pricing. My development Mac mini cost less than the baseline 64GB iPhone X, but you should opt for the $1,149 256GB version if you are going to spend $1k anyways. The iPhone X seems to represent a evolution of the iPhone that is really unparalleled to previous releases for a few things such as price, hardware and design, and a vision towards a new interface for the phone. The price just seems like typical Apple greed, and I agree, $1k is a hell of a lot of money for a phone regardless of who made it, but this is a pivotal device for the future of the iPhone. Just like the first iPhone launched in 2007 it can demand that price because of all the hype surrounding it. Come early November (or whenever my order ships), I will finally know if that hype pays off. Secondly is the new hardware, and i’d say the single biggest change is getting rid of the home button. Removal of this once piece of hardware has led to a new authentication mechanism, a completely new way to navigate about iOS, a edge to edge screen, new potential (or hurdles) for app development, heavier focus on machine learning due to Face ID, the list goes on. The third thing would be a new vision for the future of iPhone, and that is really what the X is aiming for. They are trying to move to the all touch based approach that I’d say they have been working towards since the first iPhone. Apple imagined the iPhone as a purely touch centric device with minimal user interaction through physical buttons, and now that the hardware and software are capable it was finally time to make that plunge.

In regards to iOS 11, I don’t really have much to say considering there actually are not that many big features. Peer to peer Apple Pay seems pretty appealing and the tweaked UI is welcome but there really isn’t much else for the average end user. For developers, Core ML and ARKit are cool and welcome additions. I don’t see myself using either any time soon for work but seem like they would be fun to mess with (Xamarin support for these two frameworks and more are already in the works).

Finally, for macOS High Sierra, which focuses more on under the hood improvements, the biggest one being the introduction of APFS as the primary filesystem for macOS. APFS found its way onto iDevices as of iOS 10.3 and is finally making its debut on Mac desktops and laptops. This is a pretty big deal since the whole filesystem will be upgraded during the install which poses many risks. This is an upgrade where you would likely want to back up any important data. According to Apple, APFS should boost performance for flash based mediums, but no word on if it will improve the performance of molasses slow 5400RPM mechanical drives like the one in my Mac mini (I am still regretting not getting at least a Fusion Drive). I am also expecting general performance improvements like those found between Yosemite to El Capitan. Anyways, I plan on upgrading on day 1 as usual on my Mac mini and my MacBook Pro. I’ll keep this blog updated regarding macOS High Sierra, iOS 11, and when it finally arrives, the iPhone X.

 

Reverse Engineering Xamarin Forms Apps

Xamarin Forms as well as Xamarin Native rely on the Mono runtime and framework for cross platform code sharing between iOS, Android, and UWP. This means that a .NET assembly will be generated for the solution and, on Android, will use JIT compiling on the device upon runtime to translate the C# code to native Android code (Apple restricts JIT compiling on device so AOT is implemented for iOS solutions, this will come into play later).

Since this process generates a .NET assembly, we can use standard .NET decompiler tools such as ILSpy to deconstruct the assembly and have a complete, in depth look at the source code. The following is how anyone could download a Xamarin Forms app from iTunes/App Store or Google Play, extract the .NET assembly, and decompile it to view the entire source code.

iOS (Requires a Mac)

[UPDATE 9/28/17: Apple has removed the ability to download apps through the latest version of iTunes, so this method no longer works. It may continue to work on versions prior to version 12.7, but I haven’t tested this.]

[UPDATE 10/9/17: Apple has now reinstated the App Store functionality in iTunes 12.6.3. Odd move by Apple to bring it back just 2 weeks later. If you are already running 12.7, you will need to download and install 12.6.3 from here: https://support.apple.com/en-gb/HT208079]

-Open up iTunes

-Search iTunes for a Xamarin Forms app. Hit Get and then Download. The downloaded .IPA file will be found under ~/Music/iTunes/iTunes Media/Mobile Applications/

-Copy the IPA file to a temporary directory on your desktop. Rename the .ipa to app.ipa.

-In Terminal, cd into that directory and enter in unzip app.ipa. Wait until the unzip finishes.

-Open up the Payload folder and right click on AppName.iOS. Click on Show Package Contents.

-In the Finder search bar, enter in .dll. This will locate all the DLLs in the project. Find the AppName.dll file and copy it to a flash drive. We will need to decompile this dll on a Windows machine.

Android (Mac or Windows; I tested this on a Mac)

-Since we cannot directly download the .apk from the Play Store, we need to use a frontend client to download the apk for us. I used Raccoon (http://raccoon.onyxbits.de/)

-Download and open up raccoon using Terminal (java -jar raccoon.jar). Login to a Google account when prompted. Choose “Let Raccoon create a pseudo device”.

-Search for a Xamarin Forms app in the search bar. Once you have found it, hit download. Once downloaded click on show where the file was downloaded to.

-Copy the .apk to the desktop. Again use a temporary folder and run the command unzip in terminal. On Windows you could probably use 7-Zip to do this.

-Open the assemblies folder and copy AppName.dll and AppName.Droid.dll on to a flash drive for the next step of decompiling the DLLs.

DLL Decompile (Windows)

-Download ILSpy  (https://github.com/icsharpcode/ILSpy/releases/download/v2.4/ILSpy_Master_2.4.0.1963_Binaries.zip)

-Unzip it and run ILSpy.exe

-Click open and select the DLLs you want to decompile

-View the source of the DLLs

Installing macOS Sierra on a 2009 HP Pavilion laptop

For the past few years I have been trying to install OS X on my now 8 year old HP Pavilion dv6t-2000. It features a 4 core, 8 thread Intel Core i7-720QM running at 1.67GHz, a NVIDIA GeForce GT 230M graphics card, 4GB of 1067MHz RAM and a 350GB SATA HD. This hardware may seem quite old, and it is, so I have had constant trouble installing anything from Snow Leopard to Mavericks. I could never complete a installation, until yesterday. I decided to take a long and focused look at how I could complete a successful install of Apple’s latest operating system on a 8 year old machine from HP. Here are the biggest problems normally faced by someone who wants to install macOS on a laptop:

-Lack of WiFI driver support for many common adapters

-Motherboard and BIOS support

-Trackpad and keyboard

-Mobile graphics cards

-Audio and webcam

The easiest solution for WiFi use a external dongle, I used a spare Edimax EW-7811Un USB adapter which has up to date drivers for all versions of OS X starting from 10.4

-You can usually find a patch for your specific BIOS (issues such as local APIC crashing can be solved through a simple patch built into the Clover bootloader)

-VoodooPS2 solved my trackpad and keyboard issue

-NvidiaInject inside of Clover does the job perfectly for graphics support

-Since this is mainly a development/messing around computer I do not really need audio and surprisingly enough the webcam worked out of the box

Creating the install media is fairly simple thanks to the latest version of Unibeast. Download the latest copy from here. You will need a tonymacx86 account to do so. Format your USB drive to Mac Extended Journaled with GUID partition table. You will also need to download the Sierra installer from the Mac App Store. Once you have done all that select the drive you want to install to, use legacy BIOS, and let the install media be created.

Boot your installer by selecting your drive in your BIOS boot manager, you will now land on the Clover boot screen. This is the hard part, you will need to pass some boot arguments to get to the installer. Use the following arguments: dart=0 nv_disable=1 cpus=1 -v. This should allow us to eventually reach the installer. Once at the installer, we need to erase the current hard drive. Select the drive, partition to Mac Extended Journaled with GUID partition table. Erase the drive. If you run into any errors, try to force unmount the drive and run the erase again. To do this run the following:

diskutil list

and find the disk that you are installing to (internal should be /dev/disk0)

then run

diskutil unmountDisk force /dev/[disk number]

Let the drive be formatted. Proceed to accepting the license agreements and wait for the install to finish. Once it finishes and reboots, you will need to boot from the installer drive once again. Once at the Clover boot screen select the drive you installed Sierra on. Again, pass the same boot parameters. Once finished, install Multibeast from tonymacx86, run it, select legacy options, let it finish installing. Reboot, this time it should boot Clover from your hard drive. Same boot params, now get into OS X and install KextBeast from tonymacx86. Download the latest VoodooPS2 driver from here. Install it using KextBeast. Download Clover Configurator from here open it, and mount the EFI partition. Once mounted open up /BOOT/CLOVER and find the config.plist. Open it using TextWrangler or a similar code editor. Find the local APIC patch and set it to true as well as Nvidia Injector to true. Save and reboot. You will no longer need any boot arguments. Install any other drivers you need afterwards. This will give you the most basic usable operating system, its up to you on what you need working.

The install was long and frustrating as it took me a while to figure out what boot arguments to use to get into the installer, but once I got in I was able to figure out the post install relatively easily. Now for the final question, was this really worth it. Yes and no; yes because I finally learned how to do a hackintosh relatively properly and no because I was expecting the old but powerful sounding CPU to hold up its performance. In the end I got this:

Screen Shot 2017-07-07 at 8.54.24 PM.png

Yeah that is some pretty lackluster performance for a seemingly powerful GPU and CPU. But then again, this was from a first get Core i-Series CPU and a 2nd gen GeForce GT GPU. But all in all, the system is actually pretty fast. I am yet to test out compiling some Xamarin projects and I am curious if it can utilize the 4 cores for faster builds compared to my dual core MacBook Pro and Mac mini.

 

EyeToy Vision – facial recognition using the PlayStation 2 EyeToy camera

The PlayStation 2 EyeToy was released in 2003 and was basically a USB webcam that you could attach to your PS2 to play certain games using your body and voice commands. For my current job, I have been developing a strength training application using Microsoft’s Kinect for Xbox One which piqued my interest in computer vision. I started messing around with facial recognition on the Kinect using HD face as well as a more traditional PCA based approach using Eigen Faces from this great sample here. I then remembered that I had an old EyeToy USB camera laying around at home that I could use as a capture device and use OpenCV for some basic face recognition. I started work on it last night and now have an working(ish) example of how to use the EyeToy for facial recognition using OpenCV. Bear in mind this is the first time I have done a VC++ project so I probably didn’t do everything in an optimal way.

screenshot

Requirements:

-EyeToy USB Camera (The one I used was an early model and was manufactured by Logitech, later EyeToys were manufactured by Namtai. I have not tested the driver with a Namtai made EyeToy but I am pretty sure it will work.)

-An open USB port (does not work properly with USB hubs)

-Visual Studio 2015 or higher (I compiled with VS 2017 Enterprise)

-EyeToy Vision Source Code: https://shravanj.com/files/EyeToyVision.zip

Before we can begin discussing the program, we need to install the EyeToy drivers, since there is no official PS2 EyeToy driver for Windows. I followed this guide and got it working on Windows 10: http://metricrat.co.uk/ps2-eyetoy-on-windows-8-64-bit-working/

You’ll need to download the driver (which I have uploaded to my website for your convenience here) and extract it. Once you have done that open up a command prompt window with administrator permissions. We need to temporarily disable driver signing verification so we can install the driver. Enter in the following commands:

bcdedit -set loadoptions DISABLE_INTEGRITY_CHECKS

bcdedit -set TESTSIGNING ON

From the Device Manager, find the EyeToy, right click and select Update Driver. Select let me pick from list -> have disk -> locate the unzipped driver folder and select HLCLASSIC.inf. Click continue when prompted about the unsigned driver. Once finished, re-enable driver signing enforcement like so:

bcdedit -set loadoptions ENABLE_INTEGRITY_CHECKS

bcdedit -set TESTSIGNING OFF

Verify the driver works by opening up the testing application inside the driver folder.

Now that we have the driver setup and ready, we need to prepare Visual Studio. In my initial stages of development, I tried linking OpenCV directly to VS but I never got it to work properly, so instead I found a NuGet package that manages the whole thing for me. Named opencvcontrib, it contains a x64 compiled version of OpenCV 3.1 and more importantly includes the contributed modules which contains the FaceRecognizer class which is not found in the stand alone version of OpenCV. In order for this to work, we need the Visual Studio 2015 platform tools because that was what the whole OpenCV source was built against. If you are using VS 2015 you do not need to do anything, but if you are using VS 2017 like me, you will need to install the 2015 platform tools. To do this, go to Start Menu > Visual Studio Installer. Click the menu icon for you installed VS 2017 product and select Modify. Open the Individual Components tab and scroll down to Compilers, build tools, and runtimes. Select the “VC++ 2015.3 v140 toolset (x86,x64)” and install it. You are now ready to compile the program.

I will get more in depth on the actual programming in another post, I just wanted to share my initial progress on this project.

 

 

Recommended Software: Kaspersky Anti-Ransomware for Business

I generally don’t recommend using anti-virus apart from Windows Defender and Malwarebytes Anti-Malware, but due to recent developments it seems like protection against ransomware is needed. I am aware that a future Windows 10 update will allow protection against ransomware in the idea that you can protect specific folders from unauthorized programs accessing it. This, along with Windows Defender Application Guard seem to be a good combination to thwart ransomware. Of course, the best technique is simply following general internet security rules: never open or download files from any unknown email senders or sketchy websites. Use websites like Virus Total when opening an potentially risky file. But if you want an extra line of defense, look no further than Kaspersky Anti-Ransomware. This free download (yes, it is free, unlike most Kaspersky security products) provides solid ransomware and general malware protection via real-time scanning (something that the free version of Malwarebytes does not provide). In essence, its basically a stripped down and free version of Kaspersky Internet Security, a product I used to use a few years ago but never really deemed necessary considering I needed to purchase a new subscription every year. In today’s state of computer security, you can never be too careful. You can find a download link to Kaspersky Anti-Ransomware for Business below (you don’t actually have to own a business to use this software) along with a review from AvGurus posted on the MalwareTips forum.

Link for download: https://go.kaspersky.com/Anti-ransomware-tool.html

Link for review: https://malwaretips.com/threads/kaspersky-anti-ransomware-tool-for-business-quick-test.62451/

 

Why your Xamarin Forms 2.3.x project stopped working in Visual Studio for Mac

(Originally published 5/11/17)

On May 10th, 2017 Microsoft launched the public release of Visual Studio 2017 for Mac. It is intended to be a replacement for Xamarin Studio as it integrates .NET Core along with Xamarin and cross platform game development components. From a UI standpoint it looks very similar to the latest version of Xamarin Studio, but under the hood a few key changes are lurking. The one I am concerned about is the switch from xbuild to MSBuild as the build system for Xamarin.iOS. MSBuild was optional before but is now the default system. For many projects, the transition is seamless, but for those who are using the outdated 2.3.x versions of Xamarin.Forms, a huge problem is evident: it does not support MSBuild at all. In fact, many builds of 2.4.x do not work, but the latest version guarantees compatibility. This was a rather perplexing problem that took me a while to figure out because I had no idea why the build process was failing in both Xamarin Studio and Visual Studio for Mac. Since the VS for Mac installer bundles the latest versions of Xamarin.iOS and Mono MSBuild is the default in both VS and Xamarin if you use them side by side on the same machine. Trying to build a project that uses the 2.3.x version of Xamarin.Forms will fail with a xbuild failure to start error on VS and a missing pdb file error in Xamarin Studio. This could be avoided if Microsoft warned about potential incompatibility with apps that rely on xbuild. This leaves me with two options: roll back to an earlier version of Mono and Xamarin.iOS (which is basically uninstalling everything and reinstalling Xamarin Studio which is a huge pain), or figuring out how to safely update to the latest version of Forms. This is tricky since there are many crucial packages in my solution that rely on this specific version of Forms, so all of them will need to be updated without breaking functionality or legacy code. This is the only way to ensure things will work properly in the future since Microsoft has stated that VS for Mac will be the future for Xamarin. This means that in order to stay up to date with Xamarin, we need to be using the latest version of Forms. This will not be an easy task, but who said cross-platform development was easy?

Update macOS through Terminal

(Originally published 4/26/17)

Downloading updates in the Mac App Store, especially Xcode, has always given me problems. Recently I discovered that you can actually update system software and 3rd party apps via Terminal using the “softwareupdate” command. To list the updates, issue “softwareupdate -l” and install them with “softwareupdate -iva” which will install all available updates. If you want to install a specific update, just use “softwareupdate -i ‘name of update'”. Make sure you have sufficient user privelages before installing.

Xamarin Tips and Tricks – Custom push notification sounds on iOS and Android

(Originally published 4/21/17)

Upon the receiving a push notification, iOS and Android will automatically use the default tone for the notification (or just vibrate if your device is set to silent). Normally, you would have to change the notification tone within settings, but if you want your app’s notification tone to stand out from the default tones, you can set your own notification tone. Today we will look at how to implement this in Xamarin.Forms (you will need a dependency service for this to work since the Android and iOS solutions use platform specific code).

iOS

Before you can use your custom notification tone, you need to have it in the .caf format for it to work inside of a push notification (MAKE SURE YOUR SOURCE FILE IS 30 SECONDS OR LESS IN DURATION). To do this on macOS, issue the following command in Terminal: afconvert -f caff -d LEI16@22050 input.mp3 output.caf. Now that you have converted the file, you need to add it to your iOS Resources directory. Inside Xamarin Studio, under your iOS solution right click on the Resources folder and click “Add files” and select your converted .caf file. Now that you have the file converted, we can build a local notification with the custom tone:

IMPORTANT NOTE: iOS limits 3rd party apps on how long notification sounds can play to 30 seconds. Banner style alerts (the default style) only allows a few seconds, so the user will need to change the alert type to “Alerts” under Settings > Your App > Notifications > Alert Style When Unlocked. You will also need to make sure your sound file itself is only equal to or less than 30 seconds in duration.

Android

You can use a .mp3 file of any duration you see fit because we won’t actually be using the notification’s tone payload to play the sound due to some quirkiness in the way Xamarin handles custom notification tones on Android. We will actually build a notification and then use Xamarin MediaPlayer to play the tone when the notification fires. First we need to create a new folder inside of the Android solution’s Resources folder. Right click on the Resource folder and click “New folder”. Name the folder “Raw”. Now add the .mp3 file into the Raw folder. The gist below shows basic notification setup:

IMPORTANT NOTE: Before compiling, do a clean and rebuild of the project using right click -> “Clean” and right click -> “Rebuild”. This will solve issues involving the resources folder not being compiled properly. Highly recommended every time you add new files to the folder.