shadowsocks / shadowsocks-iOS

Removed according to regulations.
8.18k stars 3.47k forks source link

Problem when importing shadowsocks-iOS into my own project #33

Closed portwatcher closed 10 years ago

portwatcher commented 10 years ago

I'm actually doing an iOS project and want to let chinese users use facebook and twitter through shadowsocks.

I read your codes and understand what you are doing, but I encounter errors when I'm trying to import your related source files into my project.

Sorry for bothering you but I'm not familiar with C/C++ and I don't really know how to let Objc and C++ work together.

It is these files that I encounter errors with:

Also, I import GCDWebServer, GZIP, NSData+Base64 through CocosPod. As for OpenSSL, I use this one: https://github.com/krzyzanowskim/OpenSSL, also through CocosPod.

Can you paste some guides about it or provide some code-level help? I'll appreciate.

clowwindy commented 10 years ago

Just use the libshadowsocks target:

image

portwatcher commented 10 years ago

I sent you this mail last night and I guess this mail is in your dustbin since you are using Gmail and my mail domain is customized:

抱歉这么晚打搅你,希望没能影响你观看世界杯。

我是今天在github上向你请教如何把shadowsocks整合进我自己的项目中的人。 按照你的指示,我已经将libshadowsocks添加进了我的项目中,现在它看起来像这样:

image

这里我编译了一遍,没有任何问题,因为我没有用到任何你的代码。

之后,我将你的AppProxyCap和ShadowsocksRunner进行了封装,封装在自己的ShadowsocksManager这个类中。但是在编译时却出了compile errors。

image

以下是我已经尝试的解决方案:

我没有尝试将AppProxyCap.m和ShadowsocksRunner.m添加进Compile Sources中,因为这两个文件当前不在我的项目目录中,虽然这两个文件所在的shadowsocks.xcodeproject出现在了我的项目目录中。如果我将这两个文件又手动添加进我的项目,那和我之前一个一个源码添加有何区别呢。

我今年大二,之前js写的比较多,还是一名iOS开发新手。有做的不对的地方还请不吝赐教!抱歉占用你宝贵的时间!

clowwindy commented 10 years ago

你看一下 ShadowsocksRunner 可能不在 libshadowsocks 项目里,你可以自己写一个或者把代码复制过去。

portwatcher commented 10 years ago

果然不在libshadowsocks里,加上之后。还要在自己的项目中包含libev/AppProxyCap/Shadowsocks/才行。

现在能成功编译也不会报错了,但是我用目前的public server会访问不了墙外的网站,直接运行模拟器或者是iphone上的shadowsocks-iOS也是一样无法访问。会报如下错误:

getpeername: Invalid argument

CFNetwork SSLHandshake failed (-9806)

换成自己电脑正在正常使用的server时,会出现如下报错,同时也访问不了墙外网站:

Connecting mobile.twitter.com

remote recv: Connection reset by peer

CFNetwork SSLHandshake failed (-9806)

NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806)

可能是因为:

抱歉再次占用你宝贵的时间。

portwatcher commented 10 years ago

解决了,是加密方式不匹配,改成匹配的就ok了。

这问题弄了两个下午了,解决了有点小兴奋啊 :-)