Archivio tag: apple

Check if WiFi is ON or OFF on iOS with Swift

I could find lots of guides or sample codes about checking WiFi SSID or other informations, but none about WiFi power status, eg. know if WiFi is turned on or off.

This can be done and it’s pretty simple: when it’s on, the awdl0 interface is enabled, and it’s disabled when it’s off.

You can use this simple function to check that.

func isWiFiOn() -> Bool {
        var address : String?
        var ifaddr : UnsafeMutablePointer<ifaddrs> = nil
        if getifaddrs(&ifaddr) == 0 {
            var ptr = ifaddr
            while ptr != nil {
                defer { ptr = ptr.memory.ifa_next }
                let interface = ptr.memory
                let addrFamily = interface.ifa_addr.memory.sa_family
                if addrFamily == UInt8(AF_INET) || addrFamily == UInt8(AF_INET6) {
                    if let name = String.fromCString(interface.ifa_name) where name == "awdl0" {
                        if((Int32(interface.ifa_flags) & IFF_UP) == IFF_UP) {
                            return(true)
                        }
                        else {
                            return(false)
                        }
                    }
                }
            }
            freeifaddrs(ifaddr)
        }
        return (false)
    }

 

How to downgrade Apple Watch from WatchOS 2 Beta to WatchOS 1.0.1

Apple_WatchApple recently released a new beta version of their WatchOS operating system for Apple Watch, WatchOS 2.

This system has, of course, some issues. There’s a reason if it’s a beta, after all!

However, downgrading from WatchOS 2 Beta 1 to an earlier version of WatchOS is not really straightforward as it’s with iOS.

If you have a backup of your Apple Watch made with an earlier version of WatchOS, like 1 or 1.0.1, you can downgrade. Backups are automatically created when you unpair your Watch or before initializing it.

If you do, you can downgrade your Apple Watch following these instructions:

  • On your Watch, go to Settings > General > Reset > Erase all contents and settings
  • Let it restore for a while. If it seems stuck with a black screen and pressing keys does nothing, keep pressed power and the digital crown to force a reboot
  • Connect your Apple Watch to your iPhone (iOS 9 is required at this time)
  • Restore your backup that features WatchOS 1 or WatchOS 1.0.1
  • (Optional) Now you can also downgrade iOS 9 to the official version!

UPDATE: it seems like this method does not downgrade the Watch.

iOS 4 on HTC HD2? DFT was working on that

HTC HD2 has got lots of unofficial development. Born with Windows Mobile 6.5, developers got it running Android (up to KitKat!), Windows Phone 7 and some Linux distributions.

Most of the credit goes to the Dark Forces Team, some great developers that made the HD2 run also Windows Phone 8 and Windows 8 RT; even if they didn’t release anything.

Following one of the members on Twitter, however, I found that they were also working on another great operating system: iOS 4!

Continua a leggere

Mac OS X 10.9 Mavericks – upgrade from iATKOS ML2

Mavericks on M17xR2

OS X Mavericks has just been released… for free. That means you can get it from the App Store and install it, as long as you already have OS X installed.
So, even if you’re running an hackintosh, you can download it from the App Store and avoid looking for it somewhere else.
But if you try to install it, you’ll find out that it just doesn’t work. It prepares for installation, then reboots on your old system as usual.

This guide will show you how I upgraded my iAtkos ML2 installation to 10.9 Mavericks using vanilla system files. You’ll need a spare USB drive (at least 8Gb). Installing from USB is easier, faster and cheaper (you don’t have to buy a DL-DVD for a one-time use).

Continua a leggere