My cross-platform development practices

I have learned how to develop apps for mobile platform since 2013. It was a very different area for a back-end engineer start working on client.
Almost all projects I worked need cross platform, at least iOS + Android.

After trying 5 different cross platform solutions, I decided to use native platform for my new project now.
The shortage of these solutions are more than the convenience it brings.

  1. Apache Cordova
    Details feel not like real native app. Feature pass.
  2. C++ Manually build library use ObjC link and JNI load it.
    It works perfect, but it’s too complex to keep C++ and ObjC and JNI at the same time.
  3. Xamarin Forms
    Good for CMS like app, if you don’t care the details for different platforms. Cross platform interface design is a wrong direction for most of my projects.
  4. Xamarin Native
    For now, I think this is the best cross platform solution. C# is also better language than Java.
  5. Native for each platform, use OpenAPI generate server stub.
    The most shared logic I wrote with other 4 solutions are client/server RPC. OpenAPI/Swagger solved this natively.

[Resolved] Codesign error over SSH on macOS 10.12+

Background

I have a shell script running in Jenkins to build my iOS projects. It runs over ssh on a Mac mini.

This stopped working since upgrading to macOS Sierra.

Causes

The root error of this problem is xcodebuild returns permission denied.

After step-by-step try on a hello world program, codesign returns the detailed error:

SecKey API returned: -25308, (null)____FILE_PATH____: unknown error -1=ffffffffffffffff

The explanation of this error is:

$ security error -25308
Error: 0xFFFF9D24 -25308 User interaction is not allowed.

This does not make any sense because the script created a new keychain and unlocked it. It needs no user interaction.

Solution

After three weeks contacting with Apple support, the solution is adding following command before using the newly created keychain:

security set-key-partition-list -S apple: -k <Password> -D <Identity> -t private

This works perfectly, but I cannot find any related document.

The script have been updated.

You-get 用命令行下载离线视频

这个工具很赞,命令行下载离线各大网站的视频和音乐。能自动合并分段的高清视频,并且把flv转换成mp4格式(都是用ffmpeg)。

家里电视连着RaspberryPi跑Kodi,看下载的视频比stream要方便。

上周想看英雄联盟总决赛,但是you-get的腾讯视频功能只能下载最差的质量那个版本。于是花了几个小时写了个patch,这周已经合并到主线了。现在从腾讯视频就可以下载到1080p和720p的版本了,优先选最高的。腾讯视频有限速,但是1MB/s也足够了,1小时的1080p只需要15分钟,限速还不是按IP,可以同时开多个。

网站:https://you-get.org/

源码:https://github.com/soimort/you-get

下一步有空写个浏览器插件,省去复制粘贴,直接post到下载机上就更方便了。

PsiApp: A simple beta app distribution tool

Recently, fir.im and pgyer.com both started to ask personal ID verification for their service.

I use them to install testing build on devices only, It is good to use HockeyApp oversea but clients from China usually have trouble downloading large files.

This result a small distribution tool created to host IPA and APK files easily and privately.

https://github.com/sinofool/PsiApp

  • It is PHP only
  • No database required
  • Local write access is optional
  • Support iOS/Android/UWP/Windows/macOS

 

Resetting the Push Notifications Permissions Alert on iOS

转自Apple官方文档,如何 重新显示 苹果 消息推送 的 权限提示。

Resetting the Push Notifications Permissions Alert on iOS

The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.

If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:

  1. Delete your app from the device.
  2. Turn the device off completely and turn it back on.
  3. Go to Settings > General > Date & Time and set the date ahead a day or more.
  4. Turn the device off completely again and turn it back on.

Protobuf for iOS

https://github.com/sinofool/build-protobuf-ios

在iOS开发中使用Google Protobuf,已经更新到最新iOS SDK 8.1

Build Google Protobuf for iOS development Only build script, please find Google Protobuf here:http://code.google.com/p/protobuf/

Tested on iOS SDK 8.1 on MacOSX 10.8 Tested Google Protobuf 2.6.1
** If older version 2.5.0 is needed, check the repoisitory history and find patch-arm64.patch

Binary output will be on your Desktop and named “protobuf_dist”

Usage

curl -O https://protobuf.googlecode.com/files/protobuf-2.6.1.tar.bz2
tar xf protobuf-2.6.1.tar.bz2
cd protobuf-2.6.1
curl https://raw.githubusercontent.com/sinofool/build-protobuf-ios/master/build_protobuf_dist.sh |bash
......