万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    JavaScriptの長押し

    JavaScriptの長押しはこうする

    How to detect a long touch pressure with javascript for android and iphone? - Stack Overflow

    function onLongPress(element, callback) {
      let timer;
    
      element.addEventListener('touchstart', () => { 
        timer = setTimeout(() => {
          timer = null;
          callback();
        }, 500);
      });
    
      function cancel() {
        clearTimeout(timer);
      }
    
      element.addEventListener('touchend', cancel);
      element.addEventListener('touchmove', cancel);
    }

    を定義して

    onLongPress(element, () => {
      console.log('Long pressed', element);
    });

    みたいに渡す。

    不足している必須の dSYM をアップロードしてください

    f:id:shinriyo:20201001113828p:plain
    コマンド
    path/toじゃねーよ!

    FirebaseCrashlyticsPods/FirebaseCrashlytics にある appDsyms.zip は解凍する

    find . -name GoogleService-Info\*.plistとかで探す。

    Pods/FirebaseCrashlytics/upload-symbols -gap ./GoogleServiceInfo/GoogleService.plist -p ios /Users/自分の名前/Downloads/appDsyms

    みたいにする。

    flutter_webview_pluginでJS側からFlutterの関数を呼び出す

    これが参考になる https://cyublog.com/articles/flutter-ja/flutter-webview-plugin/

    FlutterAppは任意の文字

    WebView内のJavaScript

    FlutterAppが勝手にできてる?

    hoge_barが送られる文字。これを色々やれば統一感あるコードになりそう。

    if (typeof FlutterApp !== 'undefined') {
        Print.postMessage('hoge_bar')
        console.log('running inside a Flutter webview')
    } else {
        console.log('not running inside a Flutter webview')
    }

    ・Flutter側

    final jsChannels = [
      JavascriptChannel(
        name: 'FlutterApp',
        onMessageReceived: (JavascriptMessage message) {
          print(message.message);
        }
      )
    ].toSet();

    message.messagehoge_barが届く

    if (message.message == 'hoge_bar') {
      // 任意の処理
    }

    みたいにできそう。

    オプショナルのnil入ってるのはアンラップでエラー

    わかりやすい記事 どこよりも分かりやすいSwiftの"?"と"!" - Qiita

    https://tech.pjin.jp/blog/2016/06/24/%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%8A%E3%83%AB%E5%9E%8B%E3%81%AE%E5%BE%A9%E7%BF%92%E3%81%9D%E3%81%AE4/

    Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value

    nilが代入されているオプショナル型の変数をアンラップしてしまうとエラーになる」

    Swiftの Unable to simultaneously satisfy constraints.の警告

     [LayoutConstraints] Unable to simultaneously satisfy constraints.
        Probably at least one of the constraints in the following list is one you don't want. 
        Try this: 
            (1) look at each constraint and try to figure out which you don't expect; 
            (2) find the code that added the unwanted constraint or constraints and fix it. 
        (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
    (
    // 略
    )

    wayohoo.com

    storyboard系のファイル探し方。

    find . -name \*.storyboard

    または、

    translatesAutoresizingMaskIntoConstraints = false

    を該当するView煮付けたら直るかもしれない。