提交 839b299f authored 作者: JarvanMo's avatar JarvanMo

swift docs

上级 569a7dc8
...@@ -74,7 +74,8 @@ isWeChatRegistered = YES; ...@@ -74,7 +74,8 @@ isWeChatRegistered = YES;
* [Payment](./doc/WXPay.md) * [Payment](./doc/WXPay.md)
* [Response](./doc/RESPONSE.md) * [Response](./doc/RESPONSE.md)
### Other
* [Using Swift?]().
### Waiting ### Waiting
## LICENSE ## LICENSE
......
...@@ -75,6 +75,8 @@ isWeChatRegistered = YES; ...@@ -75,6 +75,8 @@ isWeChatRegistered = YES;
* [支付](./doc/WXPay_CN.md) * [支付](./doc/WXPay_CN.md)
* [回调](./doc/RESPONSE_CN.md) * [回调](./doc/RESPONSE_CN.md)
### 其他
* [使用Swift?]().
### 更多功能敬请请期待 ### 更多功能敬请请期待
......
...@@ -45,13 +45,15 @@ For the rule of creating `WXEntryActivity`and`WXPayEntryActivity`,please read[ex ...@@ -45,13 +45,15 @@ For the rule of creating `WXEntryActivity`and`WXPayEntryActivity`,please read[ex
### iOS ### iOS
override the following function in`AppDelegate.m`: override the following function in`AppDelegate.m`:
```objective-c ```objective-c
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler responseHandler]]; return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
} }
// NOTE: 9.0以后使用新API接口
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options{ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler responseHandler]]; {
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
} }
``` ```
> NOTE:Don't forget to add URL Schema in order to go back to your app. > NOTE:Don't forget to add URL Schema in order to go back to your app.
......
...@@ -45,13 +45,15 @@ ...@@ -45,13 +45,15 @@
### iOS ### iOS
在你的`AppDelegate.m`中重写下面方法: 在你的`AppDelegate.m`中重写下面方法:
```objective-c ```objective-c
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler responseHandler]]; return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
} }
// NOTE: 9.0以后使用新API接口
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options{ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler responseHandler]]; {
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
} }
``` ```
> 注意:为了能够返回你的app,请不要忘记添加URL Schema。 > 注意:为了能够返回你的app,请不要忘记添加URL Schema。
......
## Using Swift?
`fluwx` supports `swift` since 2.0.0. However,before using swift, there's still a little work to do.
If anyone has better solutions, tell me please or open a PR.
## Make Headers Public
There is an exception called `include non-modular headers` if compiling `fluwx` directly because `WeChatOpenSDK` uses static library.
We have to make the headers in `WeChatOpenSDK` public in order to support swift:
![make_headers_public](./arts/public_headers_1.png)
![make_headers_public](./arts/public_headers_2.png)
##
\ No newline at end of file
## 使用Swift?
`fluwx`*2.0.0*开始支持 `swift`。 但是在使用swift之前, 我们还有一些工作要做。
如果有人知道更好的方式,请告诉我或者提一个PR。
## Make Headers Public
由于`WeChatOpenSDK`用到了静态库,所以当我们编译swift的时候会报一个错误: `include non-modular headers`
为了支持swift,我们不得不将`WeChatOpenSDK`里的头文件变成public的:
![make_headers_public](./arts/public_headers_1.png)
![make_headers_public](./arts/public_headers_2.png)
##
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论