Skip to content

Commit 92c7eb9

Browse files
authored
docs: update README.md (#745)
when trying to get WeChat authentication work on iOS i struggled a bit with the limited available docs in English. I updated the README.md with some more clear English instructions on how to configure everything correctly.
2 parents cbe4668 + 5315970 commit 92c7eb9

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,48 @@ Register your app via `fluwx` if necessary.
111111

112112
```dart
113113
Fluwx fluwx = Fluwx();
114-
fluwx.registerApi(appId: "wxd930ea5d5a228f5f",universalLink: "https://your.univerallink.com/link/");
114+
final success = fluwx.registerApi(appId: "wxd930ea5d5a228f5f",universalLink: "https://your.univerallink.com/link/");
115+
print("register API success: $success");
115116
```
117+
### iOS
118+
The parameter `universalLink` only works with iOS. You can read [this document](https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/iOS.html) to learn
119+
how to create universalLink and what additional configuration is needed on iOS. In what follows is a summary:
120+
121+
1. A valid iOS universal link for this app is needed.
122+
123+
2. Make sure the app has the entitlement Associated domains enabled
124+
125+
3. Add or modify `LSApplicationQueriesSchemes` in Info.plist in your iOS project. This is essential. The following strings should be added: `weixin`, `wechat`, `weixinULAPI` and `weixinURLParamsAPI`.
126+
127+
4. Add or modify `CFBundleURLTypes` in Info.plist in your iOS project. Add a URL type with name `weixin` and role `editor`. Put your WeChat App ID in URL Schemes.
128+
Example how this looks like in Info.plist after modifying via XCode:
129+
```xml
130+
<key>CFBundleURLTypes</key>
131+
<array>
132+
<dict>
133+
<key>CFBundleTypeRole</key>
134+
<string>Editor</string>
135+
<key>CFBundleURLName</key>
136+
<string>weixin</string>
137+
<key>CFBundleURLSchemes</key>
138+
<array>
139+
<string>wx123456789</string>
140+
</array>
141+
</dict>
142+
</array>
143+
```
144+
145+
146+
### Android
147+
Make sure the MD5 fingerprint of the signature of your app
148+
is registered at WeChat. You can extract this signature from your `keystore` using Java's keytool.
149+
150+
In debug mode your app is signed with a debug key from the development machine which will not be recognized by WeChat and you'll get `errCode = -1`. If you want to test in debug mode you will have to modify your debug key
116151

117-
The param `universalLink` only works with iOS. You can read [this document](https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/iOS.html) to learn
118-
how to create universalLink. You can also learn how to add URL schema, how to add `LSApplicationQueriesSchemes` in your iOS project. This is essential.
152+
You can read more about it on [this page](https://developers.weixin.qq.com/doc/oplatform/Downloads/Android_Resource.html).
119153

120-
For Android, you shall know to how generate signature for your app in [this page](https://developers.weixin.qq.com/doc/oplatform/Downloads/Android_Resource.html).
121-
And you have to understand the difference between debug signature and release signature. Once the signature is incorrect, then you'll get `errCode = -1`.
122154

123-
It' better to register your API as early as possible.
155+
It's better to register your API as early as possible.
124156

125157
## Capability Document
126158

0 commit comments

Comments
 (0)