플러터 웹뷰를 사용중에 화면을 당겨서 웹페이지 새로고침을 하는 기능이 있다.

이때, 새로고침이 완료되었음에도 상단에서 로딩 아이콘이 계속 돌아가는 이슈 해결 방법을 공유한다.

 

  void initState() {
    super.initState();

    pullToRefreshController = kIsWeb
        ? null
        : PullToRefreshController(
      settings: PullToRefreshSettings(
        color: Colors.black,
      ),
      onRefresh: () async {
        if (Platform.isAndroid) {
          webController?.reload();
        } else if (Platform.isIOS) {
          webController?.loadUrl(
            urlRequest:
            URLRequest(
              url: await webController?.getUrl()),
          );
        }

        pullToRefreshController?.endRefreshing(); // 이 코드 추가
      },
    );
  }

 

 

앱을 배포하기 위해 아카이빙을 진행하는 도중 xcode 에서 에러가 발생했다.

 

CFBundleIconFiles is not of the required type for that key 해결방법

 

flutter clean? flutter build ios? 다 필요없다.

 

xcode에서 info.plist 오픈.

 

info.plist를 IDE에서 열지 말고 directory단에서 텍스트 편집기로 열 것!!

 

1.

CFBundleIconFiles 검색해서 하단 <String></String> 태그까지 싹 삭제

 

2. 

info.plist 저장한 뒤 다시 Archive.

이 때, 프로젝트를 한번이라도 실행시킬 경우 다시 키 값이 생성되므로 주의!

 

이러면 해결된다.

 

 

 

에러코드:

E/MethodChannel#.com/flutter/local_notifications( 7674): Failed to handle method call
E/MethodChannel#.com/flutter/local_notifications( 7674): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/MethodChannel#.com/flutter/local_notifications( 7674):  at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setSmallIcon(FlutterLocalNotificationsPlugin.java:76)
E/MethodChannel#.com/flutter/local_notifications( 7674):  at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:88)

 

flutter app android error 

FlutterLocalNotificationsPlugin.setSmallIcon

 

안드로이드에서 FlutterLocalNotificationsPlugin을 통해 내부 알림을 보낼 때 나타나는 icon 설정이 잘못되어있기 때문에 이미지를 찾을 수 없어 알림이 안 나오는 에러!

 

따라서 icon 이미지만 지정해주면 해결된다:

 

FlutterLocalNotificationsPlugin().show(
  notification.hashCode,
  notification.title,
  notification.body,
  const NotificationDetails(
    android: AndroidNotificationDetails(
      'high_importance_channel',
      'High Importance Notifications',
      importance: Importance.max,
      playSound: true,
      enableVibration: true,
      icon: "mipmap/app_icon", //당신의 mipmap 폴더에 있는 보여주려는 아이콘 파일명 입력. 확장자 필요없음
    ),
    iOS: DarwinNotificationDetails(
      presentAlert: true,
      presentBadge: true,
      presentSound: true,
      presentBanner: true,
    ),
  ),
);

 

만약 SQLite를 사용, 수정하는 와중 xcode의 가상 시뮬레이터가 fatal error를 띄우면서 경로가 잘못되었다고 나타났을 때

 

Core Data에서 변경된 데이터를 찾을 수 없어서 오류가 났다.

 

1. xcode에서 실행하던걸 멈춘다

2. 가상 시뮬레이터에서 빌드한 앱을 삭제한다.

3. 다시 실행한다.

 

위의 절차로 해결 가능

 

개발하다 가장 화나는 순간이 언제인 지 아시나요?

 

남이 개발한 스파게티 소스 읽기?

촉박한 일정에 맞춰서 개발하기? 

 

물론 짜증나지만 아닙니다.

 

정답은

 

아주 쉬운 에러가 해결이 안될때

 

 

암튼 분명 cocoapod을 다운로드받고 설치 완료떴는데도 거지같은 맥이 pod 명령어 못알아 처먹을때 해결방법

 

 

https://stackoverflow.com/questions/73566730/how-to-resolve-error-command-not-found-pod-despite-cocoapods-successful-insta

 

How to resolve error "command not found: pod" despite cocoapods successful install?

I have run sudo gem install cocoapods. Lots of gems installed and no error shown. But despite that, when I run pod setup, I keep getting error "command not found: pod". I tried rerun the

stackoverflow.com

 

 

바쁜 당신을 위해 (될지 안될지 모르는) 3줄요약 

왜 될지 안될지 모르냐면 저는 해결을 위해 루비를 설치하고 지우고 brew를 통해서 다시 설치했기 때문 

암튼

 

 

1. brew 설치를 해보세요

2. 다음 코드를 적어보세요

brew link cocoapods

3. 위의 명령어도 안되면 이걸 적어보세요

brew link --overwrite cocoapods

 

그래도 안되면 파이팅!

 

안드로이드 마테리얼 데이트 픽커 오류.

 

앱에서 달력으로 기간을 선택해오는 머티리얼.. 마테리얼... 머테리얼... 그 라이브러리를 적용했을때 볼 수 있는 오류다.

 

java.lang.IllegalArgumentException: com.google.android.material.datepicker.MaterialDatePicker requires a value for the com.cyd.selllaundryadmin:attr/colorSurface attribute to be set in your app theme. You can either set the attribute in your theme or update your theme to inherit from Theme.MaterialComponents (or a descendant).

 

적혀있듯이 테마를 넣어달라고 한다. 테마는 필수 ~!

다른 액티비티에는 적용을 시켜뒀는데 새로운 액티비티 생성 후, 적용을 시켜주지 않아서 오류가났다.

 

 

해결책은 간단하다. 

maifest - 해당 액티비티에 적용시킬 테마를 명시해주면 끝.

 

 

자세히 설명해보자면

 

1. 달력에 적용시켜줄 테마 생성

 

res < values < themes < themes.xml 

 

xml 파일에서 달력에 적용시킬 커스텀 테마를 작성해준다.

<style name="MaterialCustomRoot" parent="Theme.MaterialComponents.Light">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:statusBarColor">@color/white</item>
    <item name="android:windowLightStatusBar">true</item>
    
    <item name="colorPrimary">@color/main_red</item>
    <item name="materialCalendarStyle">@style/Widget.MaterialComponents.MaterialCalendar</item>
    <item name="materialCalendarFullscreenTheme">@style/ThemeOverlay.MaterialComponents.MaterialCalendar.Fullscreen</item>
    <item name="materialCalendarTheme">@style/ThemeOverlay.MaterialComponents.MaterialCalendar</item>
</style>

 

 

2. manifest에 명시

 

데이트픽커를 적용한 액티비티에 위에서 작성한 테마를 적어준다.

 

<activity android:name=".Main.MyActivity"
    android:theme="@style/MaterialCustomRoot"
    />

 

 

오늘 라이브러리 Gson을 사용하다가 마주한 에러.

 

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 331

 

다른 곳에서 사용한 Gson parsing 코드를 그대로 복사붙여넣기했는데 특정 activity에서만 에러가 떠서 여기저기 뜯어보다가 알게됐다.

 

gson.fromjson(); 이 부분에서 터지는데, 결론적으로는 받아온 json의 값이 내가 준비해둔 class와 달라서. 

 

원인을 찾아내면 해결책은 생각보다 간단하다.

 

1. 서버에서 Class를 수정한다.

2. 클라이언트에서 Class를 수정한다.

 

내 경우에는 1번이 정답이었다. JSONObject를 갖고있는 JSONArray를 넘겨주고 있었는데, 받아온 배열 중 JSONObject가 아닌 스트링을 보내고 있어서 자꾸 에러가 터졌다.

+ Recent posts