Tuesday, September 27, 2016

iOS 10 and xcode 8 tip

1.  xocode shows "development cannot be enabled while your device is locked, Please unlock your device and reattach. (0xE80000E2).

If your ios device is already unlocked and connected to mac and still get the error from xcode 8 after upgrading to ios 10, then the mac is not trusted by the device.
To fix it, first disconnect device to mac and then go to ios settings app, and open general->reset->Reset Location & Privacy.
Then connect device to mac and when prompted, set select trust the mac


2. Desymbolize the crash log using external symbol file
It has been much better to use xcode 8 to desymbolize the crash log. Just download the symbol file at any place, for example, the download folder and it seems xcode will do a full disk search to find the right symbol file.
Then from the xocde view device log screen, select the crash log and right click and select "re-symbolicate log", then it will update the symbolized file in the right panel.


3. in swift 2, raw NSData bytes can be converted to UnsafeMutablePoint<> directly as below sample

let derivedKey = NSMutableData(length: kCCKeySizeAES128);
UnsafeMutablePointer<UInt8>(derivedKey!.mutableBytes

However, in swift 3, that will cause an build error of "Cannot invoke initializer for type 'UnsafeMutablePointer<UInt8>' with an argument list of type '(UnsafeMutableRawPointer)'.
To fix it, just need to call assumeingMemoryBound method as below
let derivedKey = NSMutableData(length: kCCKeySizeAES128);
UnsafeMutablePointer<UInt8>(derivedKey!.mutableBytes.assumingMemoryBound(to:UInt8.self)),


4. avoid result unused warning for swift 3
in swift 2, calling a function without using its return value is normal. But it will generate a result unused warning in swift 3. To avoid the compile warning, just set the return value to _ as shown below

 _ = (UIApplication.shared.delegate as! AppDelegate).passwordManager.getPasswordItemList(currentCategory)

3 comments:

  1. All excellent points and very important for all the aspiring bloggers to take a note. I would like to add that for writing quality content one must write from the heart, write about some thing you are passionate about and quality content will follow.
    android app development company

    ReplyDelete
  2. Video gaming tips and tricks are very important when it comes to play them cleverly in your own way. As a new game player, you should know about the legit tips and tricks on these games. Visit https://nosurveynodownloadverification.com in order to read only real and legit video gaming guides.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete