iOS

Wirelessly deploying to an iOS to tvOS device

Feel my pain, we have an Apple TV in the office which runs a dashboard app that we knocked up, however the physical device is in the roof space, behind the TV, and about 10m of cable run from my Mac, the motivators to ‘do a quick update’ are low.

One thing most developers consistently do during app development is deploy to a testing device. One main drawback during this process is the struggle to find a cable, connect it to a computer, plug it into a device, and then finally deploy the app.

Looking forward to trying this, see how it works in reality, ask again later!

Full Article At: Lose the Cables: Make Deploying to an iOS or tvOS Device Easier | Xamarin Blog

Simple Cross-Platform File IO for iOS, Android, and Windows

One of the biggest challenges in Cross Platform Mobile App Development is implementing a mechanism of performing simple tasks on each diverse platform, such as reading a config file on app launch, when you know that each platform will store this file in a different location, have a preference for different file formats, and have different permission mechanisms for reading and writing. This plugin helps nail most of those issues.

Most mobile applications need to interact with the underlying file system. Be it building a database or caching data, some understanding of how file systems work on target platforms is required. If you’re working with multiple platforms, not only does this require understanding of how each individual file system works, but also how to work with the file system from shared code.

 

The File System Plugin for Xamarin and Windows reduces the underlying file system complexities for each platform into a cross-platform file IO API for iOS, Android, and Windows, making it extremely easy to work with the file system from shared code. In this blog post, you will learn how to use the File System Plugin for Xamarin and Windows to create, edit, and delete files and directories from shared code.

Introduction to the File System Plugin for Xamarin and Windows

Similar to desktop operating systems, mobile operating systems each have their own file system. Building applications that target multiple operating system requires knowledge of not just one file system, but the underlying file system for each platform. Another barrier when working with file systems is the inability to use code that talks to individual file systems in shared code. A common solution to this problem is to use preprocessor directives (#ifdefs) to access platform-specific features, but this won’t work with PCLs and results in messier code.

Plugins for Xamarin expose platform-specific functionality via a cross-platform API that can be consumed from a Portable Class Library or Shared Project, such as using device geolocation, sending an SMS, or storing app settings, to help make you share even more code and increase developer productivity. The File System Plugin for Xamarin and Windows makes working with the many different mobile file systems easy with a shared, cross-platform API. You can download the plugin using the Xamarin Component Store or via the NuGet Package Manager.

Exploring the APIs

The IFileSystem interface represents an abstracted file system at the highest level. The platform-specific implementation can be accessed via the FileSystem.Current property. The file system is made up of a collection of folders and individual files, which are abstracted via the IFolder and IFile interfaces. When creating folders and files, we are also given maximum control over collision detection preferences with theCreationCollisionOption enumeration, which allows us do everything from create an alternative name, replace the existing directory/file, open the existing directory/file, or throw an exception. Of course, all of these APIs are also async/await compatible as well.

1

2

3

4

5

6

7

8

9

10

11

// Access the file system for the current platform.

IFileSystem fileSystem = FileSystem.Current;

// Get the root directory of the file system for our application.

IFolder rootFolder = fileSystem.LocalStorage;

// Create another folder, if one doesn’t already exist.

IFolder photosFolder = await rootFolder.CreateFolderAsync(“Photos”, CreationCollisionOption.OpenIfExists);

// Create a file, if one doesn’t already exist.

IFile selfiePhotoFile = await photosFolder.CreateFileAsync(“selfie.png”, CreationCollisionOption.ReplaceExisting);

Renaming and deleting files is also super easy as well:

1

2

3

4

5

// Actually, this wasn’t a selfie of just me!

await selfiePhotoFile.RenameAsync(“groupSelfie.png”);

// It’s a horrible selfie anyways, let’s delete it!

await selfiePhotoFile.DeleteAsync();

Wrapping Up

In this blog post, you learned how to interact with native file systems for iOS, Android, and Windows from shared code using the File System Plugin for Xamarin and Windows. To learn more about Plugins for Xamarin or check out other plugins available, such as geolocation, messaging, and sharing, check out our complete plugin directory. Visit the plugin in the Xamarin Component Store for more documentation or view the source code online on GitHub.

Source: Simple Cross-Platform File IO for iOS, Android, and Windows | Xamarin Blog

BTServer causing high CPU utilization (When wake from Sleep)

Symptoms are that your Mac wakes from sleep and CPU usage spikes to 100%, Activity Monitor show’s it the BTServer process using it all and you have to quit it.  This happens, 100% reproducible, when you’ve used the iOS Simulator at some point since the last reboot.

This isn’t a perfect solution, in fact it’s ruddy useless of the iPhone / iPad app you’re developing uses Bluetooth, but if it doesn’t then you can get away without BTServer, so we disable it.

Thanks to ‘Frankie’ via the Apple Support Forums

 

Re: BTServer causing high CPU utilization

Mar 4, 2012 5:51 AM (in response to Ryan Homer)

I have the same issue. My mac is 10.6.8 and I’m using XCode 4.2.

 

Just try:

 

Go to the Macintosh HD > Developer > Platforms > iPhoneSimulator.platform > Developer > SDKs > iPhoneSimulator5.0.sdk > System > Library > LaunchDaemons directory and then open the plist file from there. Locate the “Disabled” key and change its value from “NO” to “YES”.

You need to change permission in the file and also its parent folder in order to save the new permission of plist file before modifying in XCode.

 

Hope this help.

 

Frankie

via BTServer causing high CPU utilization: Apple Support Communities.

Andy Flisher is a Software Developer based in the North East of England specialising in cross platform development. Mobile Development experience includes Windows Phone, Android, and iPhone Apps. Desktop Software Development includes bespoke Windows, Linux, and Mac Applications. Web Development Skills include PHP, Perl, Python, ASP (Classic and .NET) – Andy Flisher on Google+