我试图在swift中分享图像和文本.但是当我选择通过facebook,messenger或whatsapp进行分享时,它只提供文本(图像不共享).我正在使用UIActivityViewController进行共享.
这是我的代码:
func displayShareSheet(latitude:NSString?, longitude:NSString?, image:UIImage?, address:NSString? ) {
let activityViewController = UIActivityViewController(activityItems: [(latitude as NSString?)!, (longitude as NSString?)!, (image as UIImage?)!, (address as NSString?)!], applicationActivities: nil)
presentViewController(activityViewController, animated: true, completion: {}
)
}
Run Code Online (Sandbox Code Playgroud) 我应该如何在Python 2.7中保护我的密码?getpass.getpass()
方法不起作用.在我运行代码时,密码是可见的.
我做过这样的事情:
M = imaplib.IMAP4_SSL('imap.gmail.com')
try:
emailid=input("what is your email id: ")
password=getpass.getpass("enter your password: ")
M.login(emailid,password)
Run Code Online (Sandbox Code Playgroud) 我已经放置了一个GoogleMap
包含的标记Image
.但是图像的大小要大得多.那么我怎样才能减小标记的大小.我试过这个:
marker.icon = self.image(marker.icon, scaledToSize: CGSize(width: 3.0, height: 3.0))
Run Code Online (Sandbox Code Playgroud) 我制作了一个标签栏应用程序,其中一个标签(MapTab)由一个GoogleMap组成,另一个标签(ImageTab)保存所有图像.现在,当图像保存在ImageTab中时,它将以Marker的形式显示在MapTab上.
现在我的问题是,当我从ImageTab中删除图像时,它会被删除但是如何从MapTab中删除它,即谷歌地图.
我正在尝试为示例烧瓶应用程序编写一些单元测试.我想检查响应中是否有特定的字符串.我一直在接受TypeError: 'str' does not support the buffer interface
.为什么我会收到此错误,我该如何解决?
======================================================================
ERROR: test_empty_db (__main__.FlaskrTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_flaskr.py", line 31, in test_empty_db
assert 'No entries here so far' in rv.data
TypeError: 'str' does not support the buffer interface
Run Code Online (Sandbox Code Playgroud) 我已经尝试过这段代码在python上找到facebook上的朋友的名字,但它不起作用
import facebook
token='my token'
graph= facebook.GraphAPI(token)
profile=graph.get_object("me") #extracting your own profile
friends=graph.get_connections("me","friends")['data']
friend_list=[friend['name'] for friend in friends]
print friend_list
Run Code Online (Sandbox Code Playgroud)
错误:SyntaxError:调用'print'时缺少括号