ERROR - Database connection failed: (20002, b'DB-Lib error message 20002,

severity 9: Adaptive Server connection failed 

DB-Lib error message 20002, severity 9:Adaptive Server

 

 

api 서버 마이그레이션 작업 중에 이런 에러가 발생했다.

 

해결방법 : 

 

self.connection_params = {
    'server': settings.MS_HOST,
    'port': settings.MS_PORT,
    'user': settings.MS_USER,
    'password': settings.MS_PASSWORD,
    'database': settings.MS_DB,
    'tds_version': '7.0' // 추가!!!!!!!!
}

 


에러 배경:

 

Flutter Flavor 를 통해 앱을 Dev, Prod 모드로 분리시켜서 빌드 시키기 위해 개발을 하고있었다.

Xcode에서 Debug-Dev, Debug-Prod, Release-Dev, Release-Prod, Profile-Dev, Profile-Prod 로 configurations 생성하고 스키마도 추가해서 알맞게 적용까지 완료.

기존에 있었던 파이어베이스도 잘 분리시켜서 적용해서 Xcode로 빌드까지 성공했다.

 

그런데 Xcode로 빌드한 앱이 기기에서 그냥 실행하면 크래시가 발생했다.

 

에러:

Terminal로 연결해서 빌드해도 잘 되고 Xcode로 연결해서 빌드해도 문제 없이 잘 작동되던 앱이

기기에서 실행만 하면 크래시가 발생하는 현상 발생. 

빌드하지 않고 기기에서 앱을 실행하면 앱이 터진다.

 

콘솔로 확인한 에러 메시지:

 

[ERROR:flutter/runtime/ptrace_check.cc(75)] Could not call ptrace(PT_TRACE_ME): Operation not permitted

Cannot create a FlutterEngine instance in debug mode without Flutter tooling or Xcode.

 

To launch in debug mode in iOS 14+, run flutter run from Flutter tools, run from an IDE with a Flutter IDE plugin or run the iOS project from Xcode.

 

Alternatively profile and release mode apps can be launched from the home screen.

 

 

최근 Xcode를 15로 업데이트 했더니 이런 새로운 이슈가 발생했다. ㅎㅎ 즐거운 iOS 앱개발..

 

 

원인: 

configuration이 Debug 로 선택되어있으면 기기에서 앱을 단독으로 실행시킬 때 권한이 없어서 크래시가 발생한다.

즉, 빌드할때 사용하는 configuration을 Release 로 설정해야한다.

 

 

해결방안:

 

 

1. 빌드할때 사용하는 스키마를 선택 - Edit Scheme 클릭

 

 

2. 앱을 빌드할때 사용하는 configurations를 수정하자.

Run - Info - Build Configuration - Release 

 

 

 

이렇게 빌드하면 Xcode와 터미널로 실행하지 않아도 기기에서 앱이 제대로 실행된다.

 

별 것 아닌 이유로 오랜 시간을 허비했다... ㅠ


하 ㅋㅋㅋㅋ ㅋ구글 공식문서에 속았다.
나를 속인 문서 링크 : https://firebase.google.com/docs/cloud-messaging/send-message?hl=ko&_gl=1*6icy9e*_up*MQ..*_ga*Mzk1OTMyMTQ1LjE3MzEzOTk2OTc.*_ga_CW55HF8NVT*MTczMTM5OTY5Ny4xLjAuMTczMTM5OTY5Ny4wLjAuMA..#python_1

 

분명 이렇게 하면 된다고 적어놨으면서!!!!!!

# Create a list containing up to 500 registration tokens.
# These registration tokens come from the client FCM SDKs.
registration_tokens = [
    'YOUR_REGISTRATION_TOKEN_1',
    # ...
    'YOUR_REGISTRATION_TOKEN_N',
]

message = messaging.MulticastMessage(
    data={'score': '850', 'time': '2:45'},
    tokens=registration_tokens,
)
response = messaging.send_multicast(message)
# See the BatchResponse reference documentation
# for the contents of response.
print('{0} messages were sent successfully'.format(response.success_count))

 

 

 

 

결론부터 말하자면 

Messaging.sendMulticast() is deprecated.

수많은 501 에러와 

Operation is not implemented, or supported, or enabled.
 
에러 메시지를 받으며 원인을 찾아봤는데, 이제 사용하지 않아서 에러가 발생하는 것이다.
 
 
 
 
이제 사용하지 않는다고 적어둔 공식문서 :
 

https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.messaging?hl=ko#messagingsendmulticast

 

Messaging class  |  Firebase Admin SDK

 

firebase.google.com

 

 

 

해결책은 공식문서에 적혀있지만, 요약 정리를 해보자면

 

Messaging.send_multicast() 를 대신해서

Messaging.send_each_for_multicast() 사용하면 해결 된다.

 

 

 

 

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

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

 

  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