GithubHelp home page GithubHelp logo

millo-l / react-native-kakao-share-link Goto Github PK

View Code? Open in Web Editor NEW
30.0 3.0 24.0 907 KB

리액트 네이티브 카카오 링크 오픈 소스

License: MIT License

Kotlin 20.62% JavaScript 2.63% TypeScript 30.80% Swift 23.89% Objective-C 7.59% Ruby 2.98% Java 11.31% C 0.18%
react-native kakao-link ios android swift kotlin kakaosdk react-native-kakao-link react-native-kakao-share react-native-kakao-share-link

react-native-kakao-share-link's Introduction

react-native-kakao-share-link

React Native 카카오 링크 라이브러리 입니다. 문제가 있으면 issue에 남겨주시기 바랍니다.

[주의 사항]

  • 안드로이드 minSdkVersion 19 이상
  • 안드로이드 gradle 3.6.1 이상
  • iOS 11.0 이상

Change logs

Change logs 링크

Deep Link 사용법

카카오 링크를 사용한 딥링크 방식을 제대로 사용하지 못하고 있는 분들을 위한 예시 코드를 작성했습니다. 여기에서 확인하시고 궁금한 점은 댓글로 남겨주세요.

Getting started

해당 라이브러리는 kakao sdk v2를 사용하므로 안드로이드 minSdkVersion 19이상, iOS 11.0 이상만 지원합니다.

Installation

npm install react-native-kakao-share-link
# pod install 명령어는 iOS Deployment Target을 모두 11.0 이상으로 올린 후 진행해야 합니다.
# 자세한 내용은 아래의 iOS 설정 부분에 있습니다.
cd ios
pod install

React Native Link

RN >= 0.60


자동으로 링크가 진행됩니다.

RN < 0.60


react-native link를 사용하시면 빠른 링크가 가능합니다.

react-native link react-native-kakao-share-link

수동 링크

iOS


  1. In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
  2. Go to node_modules ➜ react-native-kakao-share-link and add KakaoShareLink.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libKakaoShareLink.a to your project's Build Phases ➜ Link Binary With Libraries
  4. Run your project (Cmd+R)<

Android


  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactnativekakaosharelink.KakaoShareLinkPackage; to the imports at the top of the file
  • Add new KakaoShareLinkPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle
// android/settings.gradle

...

include ':react-native-kakao-share-link'
project(':react-native-kakao-share-link').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-kakao-share-link/android')
  1. nsert the following lines inside the dependencies block in android/app/build.gradle
// android/app/build.gradle

...

compile project(':react-native-kakao-share-link')

Setting

Kakao 개발자 홈페이지에서 iOS와 Android 각각을 등록하고 네이티브 앱키를 발급받았다고 가정하고 진행하겠습니다.

iOS


  1. iOS 설정 관련 사항은 공식문서 - 메시지 - 카카오링크:iOS에서 확인하실 수 있습니다.

  2. Podfile에서 iOS 버전을 11.0 이상으로 설정합니다.

# Podfile

...

platform :ios, '11.0' # 혹은 그 이상
  1. Xcode 상에서 iOS Deployment Target을 모두 11.0 이상으로 변경합니다.

  2. Info.plist에 카카오 네이티브앱 키를 추가합니다.

<!-- ios/{ProjectName}/Info.plist -->

  <key>CFBundleURLTypes</key>
  <array>
+   <dict>
+     <key>CFBundleTypeRole</key>
+     <string>Editor</string>
+     <key>CFBundleURLSchemes</key>
+     <array>
+       <string>kakao{카카오 네이티브앱 키}</string>
+     </array>
+   </dict>
  </array>
  <key>CFBundleVersion</key>
  <string>1</string>
+ <key>KAKAO_APP_KEY</key>
+ <string>{카카오 네이티브앱 키}</string>
+ <key>KAKAO_APP_SCHEME</key> // 선택 사항 멀티 플랫폼 앱 구현 시에만 추가하면 됩니다
+ <string>{카카오 앱 스킴}</string> // 선택 사항
+ <key>LSApplicationQueriesSchemes</key>
+ <array>
+     <!-- 카카오톡으로 로그인 -->
+     <string>kakaokompassauth</string>
+     <!-- 카카오링크 -->
+     <string>kakaolink</string>
+ </array>
  1. Xcode -> Build Settings -> Search Paths -> Library Search Paths 에서 "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)" 를 제거합니다. (제거하지 않을 시에는 ld: symbol(s) not found for architecture x86_64 오류가 발생합니다.)

  2. 모듈이 swift로 개발됐기 때문에 objective-c와 swift 사이에 브릿지 역할을 할 swift 파일을 생성합니다. (이미 생성해 놓으셨다면 넘어가셔도 됩니다.) 아래의 사진을 따라가시면 쉽게 추가하실 수 있습니다.

    swift1

    swift2

    swift3

    swift4

    여기서 꼭 Create Bridging Header를 눌러주셔야합니다!

  3. (선택사항) 여러 라이브러리(@react-native-seoul/kakao-login 등)에서 동일한 버전의 SDK를 써야 하는 경우 Podfile에 아래와 같이 추가하여 SDK 버전을 강제로 지정할 수 있습니다.

# 없는 경우에는 package.json의 sdkVersions.ios.kakao를 따릅니다.
$KakaoSDKVersion=YOUR_KAKAO_SDK_VERSION
  1. cocoapods
cd ios
pod install
cd ..

Android


안드로이드 수정시에는 반드시 Android Studio를 사용해주세요!

  1. Android 설정 관련 사항은 공식문서 - 메시지 - 카카오링크:Android에서 확인하실 수 있습니다.

  2. 카카오 SDK 경로를 android/build.gradle에 추가하고 minSdkVersion을 19이상, build gradle을 3.6.1이상으로 설정합니다.

build gradle은 각각의 버전 별로 android/gradle/wrapper/gradle-wrapper.propertiesdistributionUrl의 버전도 변경해야합니다.

// android/build.gradle

...
buildscript {
  ext {
    ...
    minSdkVersion = 19 // 혹은 그 이상
  }
  ...
  dependencies {
    classpath('com.android.tools.build:gradle:3.6.1') // 혹은 그 이상
  }
}

allprojects {
    repositories {
        ...
        maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
    }
}
  1. AndroidManifest.xml을 수정합니다.
  <manifest>
    ...
+   <uses-permission android:name="android.permission.INTERNET" />
    ...
    <application
+     android:allowBackup="true"
      ...>
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
+     <intent-filter>
+       <action android:name="android.intent.action.VIEW" />
+       <category android:name="android.intent.category.DEFAULT" />
+       <category android:name="android.intent.category.BROWSABLE" />
+       <data android:host="kakaolink" android:scheme="kakao{카카오 네이티브 앱키}" />
+     </intent-filter>
    </application>
  </manifest>
  1. app/src/main/res/values/string.xml 을 열어 다음을 추가합니다.
  <resources>
    ...
+   <string name="kakao_app_key">{카카오 네이티브 앱키}</string>
+   <string name="kakao_custom_scheme">{카카오 앱 스킴}</string> // 선택 사항 멀티 플랫폼 앱 구현 시에만 추가하면 됩니다
    ...
  </resources>
  1. 위의 설정까지 마무리하면 디버그 모드에서 기기 테스트 진행 시에는 잘 진행되지만 릴리즈 모드에서는 오류가 납니다. 바로 릴리즈 모드에서 사용되는 축소와 난독화 구성 때문인데, 이를 방지하기 위해 android/app/proguard-rules.pro 파일 맨 끝에 아래 두 줄을 추가해줍니다.
...
-keep class com.kakao.sdk.**.model.* { <fields>; }
-keep class * extends com.google.gson.TypeAdapter

이렇게 하면 com.google.gson.TypeAdapter에 대한 오류가 나올텐데 android/app/build.gradle를 수정하고 Sync Now를 눌러줍니다.

...
dependencies {
  ...
  implementation 'com.google.code.gson:gson:2.8.5'
}

Usage

현재 지원하는 기능

[주의사항]

  • 링크 URL은 카카오 디벨로퍼에서 등록한 도메인으로만 설정 가능합니다. 그 외에는 오류가 납니다.
  • 링크 실행 우선순위는 (android/ios)ExecutionParams > mobileWebURL > webURL 입니다.
  • 전송하는 모든 이미지는 최소 200px * 200px 이상, 2MB 이하여야합니다.

예제 코드

ContentType

이름 설명 타입 필수
title 콘텐츠의 타이틀 string O
link 콘텐츠 클릭 시 이동할 링크 정보 LinkType O
imageURL 콘텐츠의 이미지 URL string O
desc 콘텐츠의 상세 설명 string X
imageWidth 콘텐츠의 이미지 너비 (단위: 픽셀) number X
imageHeight 콘텐츠의 이미지 높이 (단위: 픽셀) number X

LinkType

이름 설명 타입 필수
webUrl PC버전 카카오톡에서 사용하는 웹 링크 URL string X
mobileWebUrl 모바일 카카오톡에서 사용하는 웹 링크 URL string X
androidExecutionParams 안드로이드 카카오톡에서 사용하는 앱 링크 URL에 사용될 파라미터. Array<{ key: string; value: string; }> X
iosExecutionParams iOS 카카오톡에서 사용하는 앱 링크 URL에 사용될 파라미터. Array<{ key: string; value: string; }> X

SocialType

이름 설명 타입 필수
likeCount 콘텐츠의 좋아요 수 number X
commentCount 콘텐츠의 댓글 수 number X
sharedCount 콘텐츠의 공유 수 number X
viewCount 콘텐츠의 조회 수 number X
subscriberCount 콘텐츠의 구독 수 number X

CommerceType

이름 설명 타입 필수
regularPrice 정상가격 number O
discountPrice 할인된 가격 number X
discountRate 할인율 number X
fixedDiscountPrice 정액 할인 가격 number X

ButtonType

이름 설명 타입 필수
title 버튼의 타이틀 string O
link 버튼 클릭시 이동하는 링크 정보 LinkType O

CommerceTemplateType

이름 설명 타입 필수
content 메시지의 메인 콘텐츠 정보 ContentType O
commerce 상품에 대한 가격 정보 CommerceType O
buttonTitle 기본 버튼 타이틀("자세히 보기")을 변경하고 싶을 때 설정 string X
buttons 버튼 목록. 버튼 타이틀과 링크를 변경하고 싶을때, 버튼 두개를 사용하고 싶을때 사용.(최대 2개) ButtonType[] X

commerce

import KakaoShareLink from 'react-native-kakao-share-link';

// ...
try {
  const response = await KakaoShareLink.sendCommerce({
    content: {
      title: 'title',
      imageUrl:
        'http://t1.daumcdn.net/friends/prod/editor/dc8b3d02-a15a-4afa-a88b-989cf2a50476.jpg',
      link: {
        webUrl: 'https://developers.kakao.com/',
        mobileWebUrl: 'https://developers.kakao.com/',
      },
      description: 'description',
    },
    commerce: {
      regularPrice: 100000,
      discountPrice: 80000,
      discountRate: 20,
    },
    buttons: [
      {
        title: '앱에서 보기',
        link: {
          androidExecutionParams: [{ key: 'key1', value: 'value1' }],
          iosExecutionParams: [
            { key: 'key1', value: 'value1' },
            { key: 'key2', value: 'value2' },
          ],
        },
      },
      {
        title: '웹에서 보기',
        link: {
          webUrl: 'https://developers.kakao.com/',
          mobileWebUrl: 'https://developers.kakao.com/',
        },
      },
    ],
  });
  console.log(response);
} catch (e) {
  console.error(e);
  console.error(e.message);
}

ListTemplateType

이름 설명 타입 필수
headerTitle 리스트 상단에 노출되는 헤더 타이틀 string O
headerLink 헤더 타이틀 내용에 해당하는 링크 정보 LinkType O
contents 리스트에 노출되는 콘텐츠 목록. 최소 2개, 최대 3개 ContentType[] O
buttonTitle 기본 버튼 타이틀("자세히 보기")을 변경하고 싶을 때 설정 string X
buttons 버튼 목록. 버튼 타이틀과 링크를 변경하고 싶을때, 버튼 두개를 사용하고 싶을때 사용.(최대 2개) ButtonType X

list

import KakaoShareLink from 'react-native-kakao-share-link';

// ...
try {
  const response = await KakaoShareLink.sendList({
    headerTitle: 'headerTitle',
    headerLink: {
      webUrl: 'https://developers.kakao.com/',
      mobileWebUrl: 'https://developers.kakao.com/',
    },
    contents: [
      {
        title: 'title1',
        imageUrl:
          'http://t1.daumcdn.net/friends/prod/editor/dc8b3d02-a15a-4afa-a88b-989cf2a50476.jpg',
        link: {
          webUrl: 'https://developers.kakao.com/',
          mobileWebUrl: 'https://developers.kakao.com/',
        },
        description: 'description1',
      },
      {
        title: 'title2',
        imageUrl:
          'http://t1.daumcdn.net/friends/prod/editor/dc8b3d02-a15a-4afa-a88b-989cf2a50476.jpg',
        link: {
          webUrl: 'https://developers.kakao.com/',
          mobileWebUrl: 'https://developers.kakao.com/',
        },
        description: 'description2',
      },
      {
        title: 'title3',
        imageUrl:
          'http://t1.daumcdn.net/friends/prod/editor/dc8b3d02-a15a-4afa-a88b-989cf2a50476.jpg',
        link: {
          webUrl: 'https://developers.kakao.com/',
          mobileWebUrl: 'https://developers.kakao.com/',
        },
        description: 'description3',
      },
    ],
  });
  console.log(response);
} catch (e) {
  console.error(e);
  console.error(e.message);
}

LocationTemplateType

이름 설명 타입 필수
content 위치에 대해 설명하는 콘텐츠 정보 ContentType O
address 공유할 위치의 주소
예) 경기 성남시 분당구 판교역로 235
string O
addressTitle 카카오톡 내의 지도 뷰에서 사용되는 타이틀
예) 카카오판교오피스
string X
social 메인 콘텐츠의 부가 소셜 정보 SocialType X
buttonTitle 기본 버튼 타이틀
("자세히 보기")을 변경하고 싶을 때 설정
string X
buttons 버튼 목록. 기본 버튼의 타이틀 외에 링크도 변경하고 싶을 때 설정.
(최대 1개, 오른쪽 "위치 보기" 버튼은 고정)
ButtonType X

location

import KakaoShareLink from 'react-native-kakao-share-link';

// ...
try {
  const response = await KakaoShareLink.sendLocation({
    address: '경기 성남시 분당구 판교역로',
    addressTitle: '카카오판교오피스',
    content: {
      title: 'title',
      imageUrl:
        'http://t1.daumcdn.net/friends/prod/editor/dc8b3d02-a15a-4afa-a88b-989cf2a50476.jpg',
      link: {
        webUrl: 'https://developers.kakao.com/',
        mobileWebUrl: 'https://developers.kakao.com/',
      },
      description: 'description',
    },
  });
  console.log(response);
} catch (e) {
  console.error(e);
  console.error(e.message);
}

FeedTemplateType

이름 설명 타입 필수
content 메시지의 메인 콘텐츠 정보 ContentType O
social 콘텐츠에 대한 소셜 정보 SocialType X
buttonTitle 기본 버튼 타이틀("자세히 보기")을 변경하고 싶을 때 설정 string X
buttons 버튼 목록. 버튼 타이틀과 링크를 변경하고 싶을때, 버튼 두개를 사용하고 싶을때 사용 ButtonType[] X

feed

import KakaoShareLink from 'react-native-kakao-share-link';

// ...
try {
  const response = await KakaoShareLink.sendFeed({
    content: {
      title: 'title',
      imageUrl:
        'http://t1.daumcdn.net/friends/prod/editor/dc8b3d02-a15a-4afa-a88b-989cf2a50476.jpg',
      link: {
        webUrl: 'https://developers.kakao.com/',
        mobileWebUrl: 'https://developers.kakao.com/',
      },
      description: 'description',
    },
    social: {
      commentCount: 10,
      likeCount: 5,
    },
    buttons: [
      {
        title: '앱에서 보기',
        link: {
          androidExecutionParams: [{ key: 'key1', value: 'value1' }],
          iosExecutionParams: [
            { key: 'key1', value: 'value1' },
            { key: 'key2', value: 'value2' },
          ],
        },
      },
    ],
  });
  console.log(response);
} catch (e) {
  console.error(e);
  console.error(e.message);
}

TextTemplateType

이름 설명 타입 필수
text 최대 200자의 텍스트 정보 string O
link 해당 컨텐츠 클릭 시 이동 할 링크 정보 LinkType O
buttonTitle 기본 버튼 타이틀
("자세히 보기")을 변경하고 싶을 때 설정
string X
buttons 메시지 하단에 추가되는 버튼 목록. 버튼 타이틀과 링크를 변경하고 싶을때, 버튼 두개를 사용하고 싶을때 사용. 최대 2개 ButtonType[] X

text

import KakaoShareLink from 'react-native-kakao-share-link';

// ...
try {
  const response = await KakaoShareLink.sendText({
    text: 'text',
    link: {
      webUrl: 'https://developers.kakao.com/',
      mobileWebUrl: 'https://developers.kakao.com/',
    },
    buttons: [
      {
        title: '앱에서 보기',
        link: {
          androidExecutionParams: [{ key: 'key1', value: 'value1' }],
          iosExecutionParams: [
            { key: 'key1', value: 'value1' },
            { key: 'key2', value: 'value2' },
          ],
        },
      },
    ],
  });
  console.log(response);
} catch (e) {
  console.error(e);
  console.error(e.message);
}

CustomTemplateType

이름 설명 타입 필수
templateId 생성해놓은 카카오 링크 메시지 템플릿 number O
templateArgs 메시지 템플릿에 유동적으로 넣을 args Array<{ key: string; value: string; }> X

KakaoTalk_Photo_2021-10-30-13-18-36

import KakaoShareLink from 'react-native-kakao-share-link';

const sendCustom = async () => {
  try {
    const response = await KakaoShareLink.sendCustom({
      templateId: 64386,
    });
    console.log(response);
  } catch (e: any) {
    console.error(e);
    console.error(e.message);
  }
};

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

react-native-kakao-share-link's People

Contributors

millo-l avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-native-kakao-share-link's Issues

button title 적용 안됨

sendFeed 예제 코드를 그대로 적용했는데
자세히보기에서 앱에서 보기로 바뀌지 않습니다.

Android일 때, 무반응

iOS, 그리고 Android에서 필요한 것 전부 세팅 했는데, Android에서만 카카오톡 공유 하기 했을 때, 무반응입니다...

혹시 무엇을 살펴보면 좋을지 아시는 분 있으신가요...?

error : 카카오톡이 설치되어 있지 않습니다.

안녕하세요!

라이브러리 사용 도중 카카오톡이 설치되어 있는 디바이스에서 해당에러가 발생하였습니다.
제공해주신 코드를 이리저리 살펴보았는데 잘 모르겠어서 질문 드립니다 ㅜㅜ
혹시 어느 부분을 살펴보면 좋을 지 조언해주실 수 있나요?

KakaoTalk_Photo_2021-08-06-15-25-57

감사합니다!

@react-native-seoul/kakao-login 과 함께 사용시, xcode 14 버전에서의 빌드가 되지 않는 문제 해결 필요

@react-native-seoul/kakao-login 패키지와 함께 사용하게 되면 xcode 14 버전에서, 빌드가 되지 않는 문제가 발생합니다.

이러한 부분에서 kakaoSDK 는 해결이 되었지만,
https://developers.kakao.com/docs/latest/ko/sdk-download/ios#changelog

이 패키지에는 적용이 되어 있지 않은 것 같습니다.

kakaoSDK를 2.11.1 로 업데이트 해야할 뿐 아니라, 2.11.0 의 내용인 패키지 이름 및 메서드 이름 변경에 대해서도 업데이트가 필요한 상황입니다. kakaoSDK 관련 dependency 버전들을 '~> 2.4.0' 에서 일단 '2.11.1' 로 변경하였고, (react-native-kakao-share-link.podspec)
.swift 파일의 전체적인 메서드 및 패키지 이름을 변경하였습니다.

import KakaoSDKLink -> import KakaoSDKShare
LinkApi -> ShareApi
isKakaoTalkSharingAvailable(), shareCustom(), shareDefault() 등등

등등의 메서드 이름의 변경은 링크를 참고해주시면 될 것 같습니다. 일단 갑작스럽게 동작을 위해 변경한 것이니, 확인 부탁드립니다.
https://developers.kakao.com/docs/latest/ko/message/ios-link#custom-template-msg

[Android] 모듈 설치시 빌드 오류

안녕하세요.
안내된 내용을 따라 안드로이드 설정은 완료한상태입니다.
앱 빌드시 하기와 같은 오류가 발생하는데, 최근 kakao측 sdk 업데이트관련 문제인지 궁금하여 문의드립니다.
동일한 현상 처리하신분이나 개발진행에 있어 도움이 될만한 댓글 공유주시면 감사하겠습니다..
220714

CocoaPods could not find compatible versions for pod "KakaoSDKTemplate"

안녕하세요!

"react": "17.0.2",
"react-native": "0.68.2",
"@react-native-seoul/kakao-login": "^4.0.0"

환경에서 IOS pod install 시 아래와 같이 에러가 나며 진행이 안되네요 ㅠㅠ
해결법이 있을까요??

[!] CocoaPods could not find compatible versions for pod "KakaoSDKTemplate":
In Podfile:
kakao-login (from ../node_modules/@react-native-seoul/kakao-login) was resolved to 4.0.0, which depends on
KakaoSDKTalk (~> 2.9.0) was resolved to 2.9.0, which depends on
KakaoSDKTemplate (= 2.9.0)

react-native-kakao-share-link (from ../node_modules/react-native-kakao-share-link) was resolved to 1.0.6, which depends on
KakaoSDKTemplate (~> 2.4.0)

[iOS] imageUrl 이 빈문자일때 예외발생

안드로이드에서는 이미지 없이 공유가 되는데 iOS에서는 아래 부분에서 예외가 발생합니다.
let imageUrl = dict["imageUrl"] != nil ? createURL(dict: dict, key: "imageUrl")! : URL(string: "http://monthly.chosun.com/up_fd/Mdaily/2017-09/bimg_thumb/2017042000056_0.jpg")!

Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

안드로이드에서 오류 발생하면서 앱이 Shut down 됩니다.
해결 방법 아시는 분 계신가요? ㅠㅠ

D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: com.reselloapp, PID: 28956 android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? at android.app.ContextImpl.startActivity(ContextImpl.java:1080) at android.app.ContextImpl.startActivity(ContextImpl.java:1056) at android.content.ContextWrapper.startActivity(ContextWrapper.java:411) at android.content.ContextWrapper.startActivity(ContextWrapper.java:411) at com.kakao.sdk.common.util.KakaoCustomTabsClient$openWithDefault$connection$1.onCustomTabsServiceConnected(KakaoCustomTabsClient.kt:48) at androidx.browser.customtabs.CustomTabsServiceConnection.onServiceConnected(CustomTabsServiceConnection.java:33) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2077) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2110) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7839) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

[버전 정보]
"react": "18.1.0",
"react-native": "0.70.5",
"react-native-kakao-share-link": "^1.0.6"

buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
kotlinVersion = "1.7.20"

웹으로 이동이 아예 안됩니다.

const response = await KakaoShareLink.sendCommerce({
        content: {
          title: 'title',
          imageUrl:
            'http://t1.daumcdn.net/friends/prod/editor/dc8b3d02-a15a-4afa-a88b-989cf2a50476.jpg',
          link: {
            webUrl: 'https://developers.kakao.com/',
            mobileWebUrl: 'https://developers.kakao.com/',
          },
          description: 'description',
        },
        commerce: {
          regularPrice: 100000,
          discountPrice: 80000,
          discountRate: 20,
        },
        buttons: [
          {
            title: '웹에서 보기',
            link: {
              webUrl: 'https://developers.kakao.com/',
              mobileWebUrl: 'https://developers.kakao.com/',
            },
          },
        ],
      });

이렇게 아예 앱부분이 없이 webUrl 만 넣어서 구현해도 앱으로만 routing 됩니다.
앱이 없는 경우는 아예 아무 동작도 없습니다...

제가 뭔가를 잘못 구현한건지는 모르겠지만 혹시 다른 분들은 잘 되시나요?

Crashed on iOS with Kakao Login Library installed

I have React Native Kakao Login library installed before getting this lib to install but the app will crash whenever I call the share function.

I cannot get the full log anymore but I still have this:

Error log: Crashed:: Dispatch queue: com.facebook.react.KakaoShareLinkQueue

Platform iOS 15, run on iPhone 13 Simulator (Also crashed on physical device)

Test function:

try {
    const response = await KakaoShareLink.sendFeed({
        content: {
            title: `Evermay`,
            imageUrl: '',
            link: {},
            description: `Referral link: ${referralLink}`,
        },
    });
    console.log(response, referralLink);
} catch (e) {
    console.error(e);
    console.error(e.message);
}

[AOS] Feed template 공유 에러

[이슈]

Could not invoke KakaoShareLink.sendFeed

null

공유 진행 시 위와 같은 에러가 발생합니다. 설정은 제공해주신 내용에 맞춰서 다 적용하였으며 ios동작은 원활하게 동작합니다.
(디버그모드에 카톡이 설치되지 않은 환경입니다)
seoul/kakao-login도 사용 중입니다.

혹시 의심되는 부분이 있을까요 ?

[환경]
react": "17.0.2",
react-native": "0.67.3",
react-native-kakao-share-link: "1.0.6"

[Android] 카카오 앱 미설치 시 앱 오류

카카오 앱이 설치 되어있지 않은 경우 앱 크래시가 나는데 오류를 보니 KakaoCustomTabsClient에 문제가 있는 것 같습니다.

android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:974)
at android.app.ContextImpl.startActivity(ContextImpl.java:950)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:384)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:384)
at com.kakao.sdk.common.util.KakaoCustomTabsClient$openWithDefault$connection$1.onCustomTabsServiceConnected(KakaoCustomTabsClient.kt:48)
at androidx.browser.customtabs.CustomTabsServiceConnection.onServiceConnected(CustomTabsServiceConnection.java:57)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1839)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1871)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7073)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

[IOS] CRA RN에서의 IOS 빌드 실패 이슈

안녕하세요.
IOS 로 정상적인 빌드가 작동하는 것을 확인한 프로젝트에서
npm install react-native-kakao-share-link 이후
ios 폴더 내에서 pod install 후 run-ios 시 빌드가 crash나는 현상이 있습니다.

제 개발환경은 맥 M1의 13.3 OS에
Ruby: 2.7.5
React native: 0.71.6 입니다.

자세한 크래시 내용은 본문에 추가하였습니다.

카카오톡이 설치되어 있지 않은 경우

안녕하세요 개발자님

카카오 SDK 업데이트 후 사용할 마땅한 카카오 링크 라이브러리를 찾고 있는 찰나에 해당 라이브러리를 발견하여 유용하게 사용 중에 있습니다.
유용한 라이브러리 제작 감사드립니다!

공유드리고 싶은 이슈는 현재 라이브러리에서는 카카오톡 설치가 안 되어있는 경우 카카오톡 설치가 안 되어있다는 에러를 반환하고 있는데요, 카카오 링크는 웹을 통한 공유 역시 지원하고 있어서 그 부분에 맞춰 수정을 하면 어떨까 건의 드립니다.

다음과 같이 설치되어있지 않은 경우에 대한 예제가 기술되어있습니다. 링크 참고 부탁드립니다.

// 카카오톡 설치여부 확인
if LinkApi.isKakaoLinkAvailable() {
    // 카카오톡으로 카카오링크 공유 가능
    // templatable은 메시지 만들기 항목 참고
    LinkApi.shared.defaultLink(templatable: templatable) {(linkResult, error) in
    if let error = error {
        print(error)
    }
    else {
        print("defaultLink() success.")

        if let linkResult = linkResult {
            UIApplication.shared.open(linkResult.url, 
                            options: [:], completionHandler: nil)
        }
    }
}
else {
    // 카카오톡 미설치: 웹 공유 사용 권장
    // Custom WebView 또는 디폴트 브라우져 사용 가능
    // 웹 공유 예시 코드
    if let url = LinkApi.shared.makeSharerUrlforDefaultLink(templatable: templatable) {
        self.safariViewController = SFSafariViewController(url: url)
        self.safariViewController?.modalTransitionStyle = .crossDissolve
        self.safariViewController?.modalPresentationStyle = .overCurrentContext
        self.present(self.safariViewController!, animated: true) {
            print("웹 present success")
        }
    }
}

AndroidManifest.xml intent-filter 내에 <data>태그 삽입 시 빌드 실패 이슈

Document에서 제시하는

태그를 넣고 (카카오 APP 키 넣음) 빌드 할 시

Starting: Intent { cmp=com.rnwebview/.MainActivity }
Error type 3
Error: Activity class {com.rnwebview/com.rnwebview.MainActivity} does not exist.

이렇게 에러가 발생합니다.

해당 태그를 제거할 경우 정상적으로 빌드가 됩니다.

프로젝트는 CRA를 이용하여 만들었습니다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.