macOS error: cannot be opened because the developer cannot be verified

macOS error: cannot be opened because the developer cannot be verified

With macOS Cataline some nice new safe feature appeared. Apple always try to defend users from malicious softwares. Unfortunately this can cause several “safe” apps and tools won’t work any more.

If the message appears “cannot be opened because the developer cannot be verified” you have allow somehow to run that app.

In general you should delete these kinds of apps. On the other side if you know the app is safe you can get rid of this problem.

Find the app in finder, right-click on that and press ‘Open’ in the context menu. If this doesn’t solve the problem go to ‘System Preferences/Security & Privacy/General’. In the section ‘Allow apps downloaded from:’ the app should appear where you can give an exception to run it.

When the app doesn’t appear you need more trick.
The problem comes from that macOS now places special ‘quarantine’ attributes to the downloaded content. You have to remove that.
If you have administrator rights on your machine open a terminal, and run:

sudo xattr -rd com.apple.quarantine <full /path/to/your/app or file>

This command removes that annoying attribute.

Have fun! 🙂

Strange issues with certificates on iOS

Good to know: in case of HTTPS/SSL/TLS connection iOS devices cache the used certificate. The side effect come along when you create (get) certificate at runtime and try to use them to connect to a server. The first time you get the certificate challenge, but not the second time – at least if you try within 10 minutes. This is because iOS (and MAC OS) uses a TLS cache because the computational cost to set up a TLS connection is expensive (because of asymmetric key exchange).

To understand why it is necessary read: http://andras.palfi.hu/to-know-how-symmetricasymmetric-encryption-is-used-in-every-day/

The problem occurs using NSURLConnection or using the same NSURLSession instance.

More precisely the relevant Apple note: https://developer.apple.com/library/ios/qa/qa1727/_index.html

Quick solution: use new NSURLSession instances when you want to use different certificates.

UI Design: avoid “hamburger” icon and hidden menu

Just read a nice article about the icon frequently used to present a menu (menu-alt-20) – and whether a “hidden” menu is appropriate – it isn’t.

https://lmjabreu.com/post/why-and-how-to-avoid-hamburger-menus/

By the way, I just went after who and why and when find it out: it was a guy at xerox – you know the company found out the graphic interface for computers – was applied by apple – and stolen by windows….

const pointer to const memory… what?

After several years I found lots of people – and me 🙂 – still confused about the pointer declarations – if it contains some const keyword somewhere.

So const char * or char const * or char * const still confusing.

To keep it simple: read it backward as this excellent post describes: Clockwise/Spiral rule

So:

  • const char * is equivalent to char const * : pointer to a constant character (character constant). It means you can change the pointer – so it points to somewhere else – but cannot change the memory at that address.
  • char * const : constant pointer to a character. It means you cannot change the pointer value – but you can change the memory at that address
  • const char * const which is equal to char const * const is the one where you cannot change anything – constant pointer to a constant character.

 

 

Viewing a Viewcontroller of a Storyboard in several device aspects at the same time

The preferred way to design a viewcontroller is using storyboard and use autolayout.
To help to set up the layouts properly and at the same time visible check the result open more device layouts in preview mode – it is the best moving it to a separate window.
Here are the steps:

  • Open the storyboard (click on it in the project) I suggest to open it in a separate window (double-click)
  • Menu/View/Assistant editor/Show the Assistant editor
  • I suggest to hide the left part by dragging the divider as left as you can – you cannot close it but we don’t need it right now 🙂
  • Open the (same) storyboard in the Assistant editor: on the top click the icon with the four rectangle and select the User interfaces and the storyboard
  • Now click on the same icon and you will find a Preview menu, select the proper storyboard
  • Wow, you will se the preview of the selected viewcontroller in aspect of one of the devices.
  • at the bottom there is a + sign, click and open other devices
  • Selecting and already presented device it will be presented in landscape mode! You can also switch between the landscape/portrait mode moving the cursor above the device and clicking the rotate icon at the bottom of the device

Cheers

ARC-Block-Avoid retain cycles and crashes

Using blocks which captures self (explicitly or automatically by referencing an iVar!) you have the chance to a retain cycle where the block keeps self and self keeps the block or a crash when self is released.

This is true for Obj-C as well as for Swift.

The proper usage declared by Apple itself: store self in a weak ref and in the block put it to strong ref to avoid the release of self just in the time the code runs.

Apple link: Transitioning to Arc RC and search for the section: “For non-trivial cycles, however, you should use”

Looks strange but if you think carefully you realize how efficient the solution is.

For a more deeper explanation see: this post