我正在围绕这个问题旋转 - 看起来Facebook有关于它的一些开放票,但我想看看是否有人遇到了我遇到的同样问题,并找到了一个临时或更好的解决方案.
我下载了Facebook的"DemoApp",并且可以将appId其放入我的info.plist中:( fb1234567890其中1234567890是我的appId).它可以通过多任务处理来验证用户身份,输入我的凭据,允许我的应用程序访问,然后在我登录时重定向回"DemoApp"(我可以请求我的信息正常).
现在,我正在尝试将DemoApp的功能集成到我现有的应用程序中.
我可以访问登录屏幕,并输入我的凭据.它允许我让我的应用程序访问我的个人信息 - 我点击allow和Safari处理一个新请求,然后返回错误消息:Safari cannot open the request because the address is invalid在URL:http://www.facebook.com/connect/uiserver.php
但是,如果我已经DemoApp安装在我的模拟器和我自己的应用程序上,它会在我成功登录后切换回DemoApp.如果我卸载DemoApp并再次使用我的应用程序,我会收到Safari错误.
我该怎么做才能解决这个问题? 任何帮助都会很棒; 我在这里敲我的头.:(
我的info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1234567890</string>
</array>
</dict>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key> …Run Code Online (Sandbox Code Playgroud) 我的Django视图方法如下.我想传递place_data作为HTTPRequest的响应(在客户端的getJSON调用中,但这与问题无关).
我可以很好地传递字典,直到我包含event_occurrences,这是在幕后工作以传递具有开始和结束时间的事件字典.
def mobile_place_detail(request,place_id):
callback = request.GET.get('callback', 'callback')
place = get_object_or_404(Place, pk=place_id)
event_occurrences = place.events_this_week()
place_data = {
'Name': place.name,
'Street': place.street,
'City': place.city,
'State': place.state,
'Zip': place.zip,
'Telephone': place.telephone,
'Lat':place.lat,
'Long':place.long,
'Events': event_occurrences,
}
xml_bytes = json.dumps(place_data)
if callback:
xml_bytes = '%s(%s)' % (callback, xml_bytes)
print xml_bytes
return HttpResponse(xml_bytes, content_type='application/javascript; charset=utf-8')
Run Code Online (Sandbox Code Playgroud)
以下是尝试执行event_occurrences字典序列化的代码:
def events_this_week(self):
return self.events_this_week_from_datetime( datetime.datetime.now() )
def events_this_week_from_datetime(self, now):
event_occurrences = []
for event in self.event_set.all():
event_occurrences.extend(event.upcoming_occurrences())
event_occurrences.sort(key=itemgetter('Start Time'))
counter = 0
while counter < …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个makefile来复制我编写的客户端/服务器程序(实际上只是两个Python脚本,但这不是真正令人关注的问题)......
test:
python server.py 7040 &
python subscriber.py localhost 7040 &
python client.py localhost 7040;
Run Code Online (Sandbox Code Playgroud)
所以我跑了 make test
我能够从client.py以下位置输入消息:
python server.py 7040 &
python subscriber.py localhost 7040 &
python client.py localhost 7040;
Enter a message:
Run Code Online (Sandbox Code Playgroud)
当client进入一个空的消息,他将关闭连接并成功退出.现在,我如何自动subscriber关闭聊天室(谁只是一个"倾听者") - 这将反过来退出server流程.
我试图从这些调用中获取进程ID pidof- 但是不确定这是否是正确的路由.我不是makefile专家; 也许我可以写一个快速的Python脚本,从我的makefile执行为我做的工作?任何建议都会很棒.
编辑:
我已经编写了Python脚本路由,并具有以下内容:
import server
import client
import subscriber
#import subprocess
server.main(8092)
# child = subprocess.Popen("server.py",shell=False)
subscriber.main('localhost',8090)
client.main('localhost', 8090)
Run Code Online (Sandbox Code Playgroud)
但是,现在我得到的错误是我的全局变量没有被定义(我认为它直接与main我的方法添加方法有关server(subscriber而且client,但是我还没有达到那么远:).这可能值得一个单独的问题. .. …