月度归档: 2021 年 5 月

Android Studio汉化教程

是不是有很多小伙伴安装使用AS的时候因为英文感到费力。想采用中文的内容。因此就不得不用汉化。

本人亲测汉化过程。首先查看下AndroidStudio中的的版本信息。

打开AS进入主界面。选择工具栏中的help –> about。能够查看AS的版本。下载

下载对应版本的汉化包。链接:https://pan.baidu.com/s/13txkfOA-mcJ_X12JLfyGSw
提取码:1234

下载完成之后会得到相对应的jar包。

无需修改jar包名称。直接复制到AS安装文件的lib文件中。不知道AS安装路径的话,可以通过点击桌面的AS图标–>点击鼠标右键–>点击属性   就可以查看图标的安装位置。

重新启动AS。即可看到汉化后的效果。

注意:

一般软件小版本更新时,汉化包是通用的,可以保留继续使用
Android Studio 更新时会自动删除汉化包,请先备份汉化包或更新后重新下载。
理论上不可能汉化失败,如果汉化不生效,请认真学习下方的常见问题,仍有问题可反馈
不需要重命名,不需要解压,不需要删除任何 jar 包,不会覆盖任何 jar 包
软件安装路径的 lib 目录例     D:\AS安装文件\lib
该目录下应该有一个文件: resources_en.jar 如果没有,说明没有找对路径
MAC 用户请在 Finder > 应用程序 中找到软件,右键 > 显示包内容
汉化后如果需要还原,删除汉化包即可

Android PDF开发:android-pdfview

Android PDF开发:android-pdfview

Android平台自身没有直接可以阅读和处理pdf的方案,在github上面有一个第三方开源的pdf开发SDK,其主页地址是:

https://github.com/JoanZapata/android-pdfview

android-pdfview使用比较简单,关键的地方是PDFView,将PDFView作为像Android的ImageView或者TextView一样写进xml布局文件:
<FrameLayout xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:tools=”http://schemas.android.com/tools”
android:layout_width=”match_parent”
android:layout_height=”match_parent” >

<com.joanzapata.pdfview.PDFView
android:id=”@+id/pdfView”
android:layout_width=”match_parent”
android:layout_height=”match_parent” />
</FrameLayout>

然后在Java上层代码直接加载pdf文件资源装载进去即可:
package zhangphil.pdfview;

import com.joanzapata.pdfview.PDFView;
import com.joanzapata.pdfview.listener.OnPageChangeListener;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

PDFView pdfView = (PDFView) findViewById(R.id.pdfView);

// 在我这个测试例子中,事先准备一个叫做sample.pdf的pdf大文件放到assets目录下。
// 从assets文件目录下读取名为 sample.pdf的文件,缺省把该pdf定位到*页。
pdfView.fromAsset(“sample.pdf”).defaultPage(1).onPageChange(new OnPageChangeListener() {

@Override
public void onPageChanged(int page, int pageCount) {
// 当用户在翻页时候将回调。
Toast.makeText(getApplicationContext(), page + ” / ” + pageCount, Toast.LENGTH_SHORT).show();
}
}).load();
}
}

我把该第三方开源库整理成Eclipse下可用的lib,上传到github上,地址链接:
https://github.com/zhangphil/android-pdfview-lib-for-eclipse
使用时候,下载该lib,导入到eclipse作为lib,然后在项目中直接引用即可。

Android控制文字水平间距android:letterSpacing

Android控制文字水平间距android:letterSpacing

附录文章1实现的是Android的文字在水平方向的缩放,然而不是水平方向的文字间距。如果要想实现Android TextView之类的文字保持间距,那么需要设置android:letterSpacing,android:letterSpacing的值是一个浮点数,为标准字体的倍数作为间距。写一个小demo示例。
Xml布局代码:

<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:orientation=”vertical”>

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Zhang Phil CSDN 默认” />

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:letterSpacing=”0.1″
android:text=”Zhang Phil CSDN 0.1″ />

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:letterSpacing=”0.2″
android:text=”Zhang Phil CSDN 0.2″ />

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:letterSpacing=”0.3″
android:text=”Zhang Phil CSDN 0.3″ />

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:letterSpacing=”0.4″
android:text=”Zhang Phil CSDN 0.4″ />

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:letterSpacing=”0.5″
android:text=”Zhang Phil CSDN 0.5″ />

</LinearLayout>

代码运行结果:

mac上配置java开发环境

刚在mac上配置了java开发环境,多数步骤是参考链接做下来的,记录下来供参考。

1.下载jdk
我mac os 的版本是 :10.13.6;

打开终端,输入 java -version ,回车显示如下:

点 更多信息 进到 https://www.oracle.com/technetwork/java/javase/downloads/index.html 的界面

点击download,跳转到jdk的下载,选择对应的*新版本下载即可,我下的是

jdk-12_osx-x64_bin.dmg

2.安装
jdk-12_osx-x64_bin.dmg 下载完,点击安装即可。在终端输入 java -version 命令查看是否安装成功,如下:

java -version

java version “12” 2019-03-19
Java(TM) SE Runtime Environment (build 12+33)
Java HotSpot(TM) 64-Bit Server VM (build 12+33, mixed mode, sharing)
说明安装成功了。

可以进到目录 /Library/Java/JavaVirtualMachines/ 查看jdk安装的的位置,方法:打开Finder,快捷键 “Command + Shift + G”,输入 /Library/Java/JavaVirtualMachines/ ,回车就能看到安装的jdk,如下图所示:

所以jdk的目录为:

/Library/Java/JavaVirtualMachines/jdk-12.jdk

这个目录后面会用到

3.配置
在终端输入

sudo vim /etc/profile
然后输入自己的电脑密码,然后就进入了profile文件,在文件内容末尾添加JAVA_HOME路径(切换英文输入法,键入“i”,进入插入模式),如下所示:

JAVA_HOME=”/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home/”

CLASS_PATH=”$JAVA_HOME/lib”

PATH=”.:$PATH:$JAVA_HOME/bin”
拼接起来,如下所示:

# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi

if [ “${BASH-no}” != “no” ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi

JAVA_HOME=”/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home/”

CLASS_PATH=”$JAVA_HOME/lib”

PATH=”.:$PATH:$JAVA_HOME/bin”
~
~
~
~
~
~
~
“/etc/profile” [readonly] 16L, 323C
确认添加完毕,按esc退出插入模式,英文输入发下键入“:wq!”保存并退出profile文件

重启终端,重新打开输入如下所示:

builderdeMacBook-Pro:~ builder$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home/
这个路径出来了,说明配置成功了

4.测试
新建一个文件,名为Hello.java,注意是.java为后缀,在文件里,写下如下java代码:

class Hello {
public static void main(String[] args) {
System.out.println(“Helllo”);
}
}
在终端里cd到Hello.java文件所在目录,然后在终端输入以下命令:

javac Hello.java
然后就会在Hello.java文件所在目录,生成class文件:Hello.class

再在终端输入以下命令:

java Hello
如果出来一句打印的 :Helllo

说明运行正常,我们的java环境已经配置好了

开发 IOS app 不通过 苹果商店安装的几种方式

开发App,苹果App少不了。不过,苹果商店的审核确实太烦,更新也费劲。

一、IOS App不通过苹果商店,有几种办法可以完成安装?

不通过苹果商店安装苹果app(即ipa)的方法较为复杂;如果是非越狱的手机,首先需要注意以下条件:

  1. 如果是299美元的企业证书打包的ipa,那没有任何限制。注意:企业证书是不能发布到苹果市场的,只有99美元那个可以。
  2. 如果是99美元的个人/公司证书打包的ipa,那必须在生成证书的时候,把需要安装ipa的手机的uuid增加到证书里面(*多可以增加100个)。

假设Studio中Native下有一个MyApp的本地应用,在dist目录下已经生成MyApp.ipa。 不通过苹果商店安装ipa有3种方法:

  1. 同android的*种方法类似,可以通过ios版本的UI浏览器扫描二维码,但要注意,默认下载后是无法安装ipa,可以安装一个叫“同步推”的工具,这样UI下载ipa后使用“同步推”打开ipa就可以安装
  2. 在PC上安装iTunes,并用数据线连接手机,ipa用iTunes打开,在iTunes中点击自己的手机后在“应用程序”页面会列出ipa,把ipa拖动到右边的页面,并点右下角的“同步”即可安装
  3. 部署https,通过一个描述文件plist 指定安装文件,在手机的safari浏览器中通过itms-services:///?action=download-manifest&url=http://域名/xxxx.plist”的方式安装。本文随后详细说明:苹果App如何通过部署HTTPS实现不经过苹果商店的在线下载安装?。

注意:上面的方法越狱和非越狱都适用,但快捷打包生成的ipa只能安装在越狱手机上

二、苹果App如何通过部署HTTPS实现不经过苹果商店的在线下载安装?

部署https提供ipa的下载,步骤如下:

1. 搭建一个HTTPS服务,可以使用HTTPD或者Tomcat构建,具体可搜索相关帖子。由于https好用的证书(就是浏览器默认支持)需要付费,这里巧用github.com可以实现部署。

2. 编写plist文件。plist文件中需注意提供正确的ipa文件路径,以及版本号和Bundle ID。

<?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>items</key>

<array>

<dict>

<key>assets</key>

<array>

<dict>

<key>kind</key>

<string>software-package</string>

<key>url</key>

<!– http或者https链接的ipa文件地址 –>

<string>http://x5.justep.com/apps/x5.ipa</string>

</dict>

<dict>

<key>kind</key>

<string>full-size-image</string>

<key>needs-shine</key>

<true/>

<key>url</key>

<!– http或者https链接的图片地址,可直接使用app对应的icon(分辨率没强制要求) –>

<string>http://x5.justep.com/apps/x5.png</string>

</dict>

<dict>

<key>kind</key>

<string>display-image</string>

<key>needs-shine</key>

<true/>

<key>url</key>

<!– http或者https链接的小图片地址,可直接使用app对应的icon(分辨率没强制要求) –>

<string>http://x5.justep.com/apps/x5.png</string>

</dict>

</array>

<key>metadata</key>

<dict>

<key>bundle-identifier</key>

<!– BundleID,就是新建app时的包名 –>

<string>com.justep.x5.demo</string>

<key>bundle-version</key>

<!– 版本号 –>

<string>5.3.2</string>

<key>kind</key>

<string>software</string>

<key>title</key>

<!– 安装app时的提示信息 –>

<string>X5 App download</string>

</dict>

</dict>

</array>

</dict>

</plist>

3. 将plist文件放在https服务目录下。这样就有一个有效的连接地址指向这个文件,例如:

1  https://github.com/myuser/myapp/blob/master/myapp.plist

手机如果要安装app,可以在safari浏览器输入:

1  itms-services:///?action=download-manifest&url=https://xxx/…/myapp.plist

注意:是三个/,不是笔误,url后面写的就是一个有效的可访问plist的https地址,一定要https,否则无法打开

当然,你可以做一个页面,里面用一个链接指向这个地址,方便下载,例如:

1 <a οnclick=”window.location.href=’itms-services:///?action=download-manifest&url=https://xxx/…/myapp.plist'”>下载IPA</a>

开发App,苹果App少不了。不过,苹果商店的审核实在太烦,更新也费劲。WeX5跨前端开源框架,应广大App开发者的要求,做了精心整理, 帮助大家实现苹果App不上传苹果商店、让其他人也能安装,分享如下:

 

WeX5跨前端开源项目页面:http://www.oschina.net/p/x5

一、IOS App不通过苹果商店,有几种办法可以完成安装?

不通过苹果商店安装苹果app(即ipa)的方法较为复杂;如果是非越狱的手机,首先需要注意以下条件:

  1. 如果是299美元的企业证书打包的ipa,那没有任何限制。注意:企业证书是不能发布到苹果市场的,只有99美元那个可以。
  2. 如果是99美元的个人/公司证书打包的ipa,那必须在生成证书的时候,把需要安装ipa的手机的uuid增加到证书里面(*多可以增加100个)。

假设Studio中Native下有一个MyApp的本地应用,在dist目录下已经生成MyApp.ipa。 不通过苹果商店安装ipa有3种方法:

  1. 同android的*种方法类似,可以通过ios版本的UI浏览器扫描二维码,但要注意,默认下载后是无法安装ipa,可以安装一个叫“同步推”的工具,这样UI下载ipa后使用“同步推”打开ipa就可以安装
  2. 在PC上安装iTunes,并用数据线连接手机,ipa用iTunes打开,在iTunes中点击自己的手机后在“应用程序”页面会列出ipa,把ipa拖动到右边的页面,并点右下角的“同步”即可安装
  3. 部署https,通过一个描述文件plist 指定安装文件,在手机的safari浏览器中通过itms-services:///?action=download-manifest&url=http://域名/xxxx.plist”的方式安装。本文随后详细说明:苹果App如何通过部署HTTPS实现不经过苹果商店的在线下载安装?。

注意:上面的方法越狱和非越狱都适用,但快捷打包生成的ipa只能安装在越狱手机上

二、苹果App如何通过部署HTTPS实现不经过苹果商店的在线下载安装?

部署https提供ipa的下载,步骤如下:

1. 搭建一个HTTPS服务,可以使用HTTPD或者Tomcat构建,具体可搜索相关帖子。由于https好用的证书(就是浏览器默认支持)需要付费,这里巧用github.com可以实现部署。

2. 编写plist文件。plist文件中需注意提供正确的ipa文件路径,以及版本号和Bundle ID。

<?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>items</key>

<array>

<dict>

<key>assets</key>

<array>

<dict>

<key>kind</key>

<string>software-package</string>

<key>url</key>

<!– http或者https链接的ipa文件地址 –>

<string>http://x5.justep.com/apps/x5.ipa</string>

</dict>

<dict>

<key>kind</key>

<string>full-size-image</string>

<key>needs-shine</key>

<true/>

<key>url</key>

<!– http或者https链接的图片地址,可直接使用app对应的icon(分辨率没强制要求) –>

<string>http://x5.justep.com/apps/x5.png</string>

</dict>

<dict>

<key>kind</key>

<string>display-image</string>

<key>needs-shine</key>

<true/>

<key>url</key>

<!– http或者https链接的小图片地址,可直接使用app对应的icon(分辨率没强制要求) –>

<string>http://x5.justep.com/apps/x5.png</string>

</dict>

</array>

<key>metadata</key>

<dict>

<key>bundle-identifier</key>

<!– BundleID,就是新建app时的包名 –>

<string>com.justep.x5.demo</string>

<key>bundle-version</key>

<!– 版本号 –>

<string>5.3.2</string>

<key>kind</key>

<string>software</string>

<key>title</key>

<!– 安装app时的提示信息 –>

<string>X5 App download</string>

</dict>

</dict>

</array>

</dict>

</plist>

3. 将plist文件放在https服务目录下。这样就有一个有效的连接地址指向这个文件,例如:

1  https://github.com/myuser/myapp/blob/master/myapp.plist

手机如果要安装app,可以在safari浏览器输入:

1  itms-services:///?action=download-manifest&url=https://xxx/…/myapp.plist

注意:是三个/,不是笔误,url后面写的就是一个有效的可访问plist的https地址,一定要https,否则无法打开

当然,你可以做一个页面,里面用一个链接指向这个地址,方便下载,例如:

1 <a οnclick=”window.location.href=’itms-services:///?action=download-manifest&url=https://xxx/…/myapp.plist'”>下载IPA</a>

iOS #include file not found问题?

错误原因:

(1)项目中缺少对应的文件

(2)Header Search Paths没有设置

解决办法:

(1)下载对应的SDK等文件,将其导入到项目中

(2)添加正确的Header Search Paths 如:$(SRCROOT)/xxx/xxx  $(PROJECT_DIR)/xxx/xxx

ios app安装的四种方式

*种,用户直接通过App Store下载安装

苹果官方通过非对称加密生成一对公私钥,在iOS设备内置了一个公钥,在苹果后台保存了对应的私钥,在开发者把app上传到App Store时,苹果用私钥对这个app进行签名,当iOS设备用户下载了这个app之后,用公钥验证这个签名,这也就保证了每一个app的来源都是苹果官方的。

第二种,开发者直接把app装进手机调试

1.开发者向苹果后台申请证书,开发者在本地Mac生成一对公私钥,把公钥通过本地子签名根证书传到开发者后台,苹果后台用苹果的私钥去签名我们所传上去的公钥,这样就得到了一个叫开发者证书的东西,以及包含app信息的pp文件,在本地编译完一个app后,用本地的私钥对这个app签名,同时把pp文件打包进app里,然后在安装时,iOS设备取得证书,通过苹果的公钥去验证这个证书的签名已经pp文件的信息是否正确,通过这种方式,就控制了app安装的泛滥。

第三种,企业内部安装

这种方式的app安装需要开发者通过企业证书编译的安装包才能实现,这种方式的签名已经验证和第二种是差不多的,*大的区别就在于企业级证书的app不限制安装设备数量,然后需要用户手动点击信任这个企业才能通过验证,但不能将app上传到App Store。

第四种,AD-Hoc安装

这种方式相比于企业级证书安装,则是限制了安装的设备数量,签名以及验证和第二种也是一样的,这种方式用于公司内部用户的安装测试。

ios模拟器安装app

需要用到终端命令行来操作

1.查找模拟器
instruments -s
输出(只贴出ipad和iphone的):
iPad (5th generation) (11.2) [520E435E-640D-486D-861A-DC78EF09CF27] (Simulator)
iPad Air (11.2) [6A009D9C-4855-4978-B59F-0C31F8C84931] (Simulator)
iPad Air 2 (11.2) [D3A5A401-1126-4666-AE3C-A0B00871CCF9] (Simulator)
iPad Pro (10.5-inch) (11.2) [E5FA9EF6-795F-4759-876E-94708C427548] (Simulator)
iPad Pro (12.9-inch) (11.2) [D5FA5FEF-286B-406B-AE6F-79E0081E4F64] (Simulator)
iPad Pro (12.9-inch) (2nd generation) (11.2) [7E23AC31-4E73-4726-A7B9-151F57A8001B] (Simulator)
iPad Pro (9.7-inch) (11.2) [6FD10B83-E012-4A01-82F4-833AFBF602DC] (Simulator)
iPhone 5s (11.2) [4E38DF1F-D5FF-4EF7-BCBC-39D45D1A3FF9] (Simulator)
iPhone 6 (11.2) [6082A07F-9B51-4B47-B821-7FA17050552F] (Simulator)
iPhone 6 Plus (11.2) [2C44FCB0-2414-4010-996A-6D572CC1532F] (Simulator)
iPhone 6s (11.2) [1F752F2B-7BB3-427A-AD75-C84676DF9259] (Simulator)
iPhone 6s Plus (11.2) [505E165D-9138-440F-ADAC-9B2F732C80D8] (Simulator)
iPhone 7 (11.2) [CAC3FBF3-EF6B-4C02-B777-2A8F836D2F24] (Simulator)
iPhone 7 (11.2) + Apple Watch Series 2 – 38mm (4.2) [B2DAA065-EC06-475E-8D7E-C0271048FD5A] (Simulator)
iPhone 7 Plus (11.2) [D1018F94-A83F-4A63-A56F-C8A0EF03288F] (Simulator)
iPhone 7 Plus (11.2) + Apple Watch Series 2 – 42mm (4.2) [865455A6-AB35-4056-AE51-51B3BB0C5995] (Simulator)
iPhone 8 (11.2) [252478EF-74C5-4BB1-BCB3-F6972D37A6A0] (Simulator)
iPhone 8 (11.2) + Apple Watch Series 3 – 38mm (4.2) [52DBED0B-9EF2-4352-A286-FB7C61690191] (Simulator)
iPhone 8 Plus (11.2) [634BF487-28E8-452B-891E-4EA3049DF3D2] (Simulator)
iPhone 8 Plus (11.2) + Apple Watch Series 3 – 42mm (4.2) [BB93A8FE-F1C3-4824-9977-F00AA294FC7F] (Simulator)
iPhone SE (11.2) [4E67039C-57CF-4483-9603-82B890788B0A] (Simulator)
iPhone X (11.2) [3CC4B576-B6C6-48C9-A1F7-7C03EF963BF5] (Simulator)
2.启动模拟器
xcrun instruments -w ‘iPhone X’
iPhone X就是模拟器的名称
3.安装app
xcrun simctl install booted /Users/builder/builder/document/other/551/Payload/DYZB.app
xcrun simctl install booted是命令,后面的是需要安装的app路径,先去appstore下载或者自己打包编译的ipa,用归档工具打开,拖动playload文件夹下的程序文件到终端即可,按下enter,即可在模拟器上看到安装的app

4.启动app
xcrun simctl launch booted ‘com.tencent.live4iphone’
com.tencent.live4iphone是腾讯视频的Bundle identifier,可通过playload文件夹下程序文件,右键有显示包内容,进入查看info.plist找到;

注:如果app不能运行在模拟器,会一直在启动,这时你可以手动启动,看看是不是一进去就退出,如果是,说明可能app有些库没有支持模拟器的,导致崩溃退出,很正常,一般app上线前会将适配模拟器的库去掉,减少体积。

5.卸载app
xcrun simctl uninstall booted ‘com.tencent.live4iphone’

也是通过 Bundle identifier来卸载

ios之域名转IP和获取IP

之前的项目有域名转IP这需求,所以查了这方面的资料,然后站在一些大牛的肩膀上写了一个网络工具类,感觉还可用,就把一些代码分享下,让有这方面需要的人参考参考。

1.要引入的头文件

//域名转IP
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
//获取IP
#include <arpa/inet.h>
#include <netdb.h>
#include <net/if.h>
#include <ifaddrs.h>
#import <dlfcn.h>
#import <SystemConfiguration/SystemConfiguration.h>

2.域名转IP:需有网络才能进行

+ (NSString *)queryIpWithDomain:(NSString *)domain
{
struct hostent *hs;
struct sockaddr_in server;
if ((hs = gethostbyname([domain UTF8String])) != NULL)
{
server.sin_addr = *((struct in_addr*)hs->h_addr_list[0]);
return [NSString stringWithUTF8String:inet_ntoa(server.sin_addr)];
}
return nil;
}
调用代码:

[NetUtil queryIpWithDomain:@”www.baidu.com”];

3.通过查询网址,解析html得到ip地址

+ (NSString *)whatismyipdotcom
{
NSError *error;
NSURL *ipURL = [NSURL URLWithString:@”http://iframe.ip138.com/ic.asp”];
NSString *ip = [NSString stringWithContentsOfURL:ipURL encoding:1 error:&error];

NSRange range = [ip rangeOfString:@”<center>ÄúµÄIPÊÇ£º[“];
NSString *str = @”<center>ÄúµÄIPÊÇ£º[“;
if (range.location > 0 && range.location < ip.length)
{
range.location += str.length ;
range.length = 17;
ip = [ip substringWithRange:range];

range = [ip rangeOfString:@”]”];
range.length = range.location;
range.location = 0;
ip = [ip substringWithRange:range];
}

return ip ? ip : nil;
}

4.查询内网地址ip方法1
+ (NSString *)queryIPAddress
{
BOOL success;
struct ifaddrs * addrs;
const struct ifaddrs * cursor;

success = getifaddrs(&addrs) == 0;
if (success) {
cursor = addrs;
while (cursor != NULL) {
// the second test keeps from picking up the loopback address
if (cursor->ifa_addr->sa_family == AF_INET && (cursor->ifa_flags & IFF_LOOPBACK) == 0)
{
NSString *name = [NSString stringWithUTF8String:cursor->ifa_name];
if ([name isEqualToString:@”en0″]) // Wi-Fi adapter
return [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)cursor->ifa_addr)->sin_addr)];
}
cursor = cursor->ifa_next;
}
freeifaddrs(addrs);
}
return nil;
}

5.查询内网地址ip方法2

+ (NSString *)localIPAddress
{
char baseHostName[256] = {0}; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
// baseHostName[255] = ‘0’;
NSString *hostname=nil;
#if TARGET_IPHONE_SIMULATOR
hostname=[NSString stringWithFormat:@”%s”, baseHostName];
#else
hostname=[NSString stringWithFormat:@”%s.local”, baseHostName];
#endif

struct hostent *host = gethostbyname([hostname UTF8String]);
if (!host) {herror(“resolv”); return nil;}
struct in_addr **list = (struct in_addr **)host->h_addr_list;
return [NSString stringWithCString:inet_ntoa(*list[0]) encoding:NSUTF8StringEncoding];
}

 

苹果审核被拒以及解决方案大全

Guideline 1.2 – Safety – User Generated Content

Your app enables the display of user-generated content but does not have the proper precautions in place.

Next Steps

To resolve this issue, please revise your app to implement all of the following precautions:

– A mechanism for users to block abusive users

Request a phone call from App Review

At your request, we can arrange for an Apple Representative to call you within the next three to five business days to discuss your App Review issue. Our representative will be able to discuss the issue in English or Chinese.
被拒原因:用户产生的内容,如评论,提交的视频和图片等没有相应的监督方案。

解决办法:用户产生的内容增加举报功能,有用户的地方增加拉黑功能,登录或注册界面增加用户协议,协议中描述对用户产生的内容是怎样处理,责任归谁,出问题了找谁,*好还写明与苹果公司无关;在App审核信息的备注里写明你加了举报和拉黑功能,加在哪里了,*好截图给它,在附件里。

举报功能:增加举报的按钮,举报什么,举报成功后的提示

拉黑功能:增加拉黑/取消拉黑用户的按钮,有黑名单列表界面

用户协议示例:

1、用户充分理解并同意:xxx仅为用户提供信息存储、分享平台服务,用户必须为自己注册帐号下发生一切行为负责,包括因您所传送至xxx平台的任何内容、信息等所导致的不利后果,该等不利后果包括但不限于赔偿、罚款、司法/仲裁程序费用、律师费、合理支出、给xxx造成的损害等。用户应对xxx平台上其他注册用户发布的内容自行加以判断,并承担因使用该内容而给自己、他人及社会造成的法律责任,包括但不限于因对内容的准确性、真实性、完整性或实用性等的依赖而产生的风险。
2、用户在使用xxx服务中发布的任何内容、信息等并不反映或代表xxx的观点、立场或政策,xxx对此不承担任何责任。
3、用户充分理解并同意:xxx是一个基于用户关系网的点对点信息服务平台,用户须对在xxx上的注册信息的真实性、合法性、有效性承担全部责任,用户不得冒充他人或利用他人的名义传播任何信息,不得恶意使用注册帐号导致其他用户误认。否则,xxx有权立即停止提供服务,注销用户的xxx帐号,用户应自行承担由此而产生的一切法律责任。
4、xxx对用户上传的所有信息的真实性、合法性、无害性、有效性等不负任何单独或连带之保证责任,用户因其所传播的信息而引发的相关法律责任由用户自行承担。
5、用户充分理解并同意:因业务发展需要、突发情势等,xxx可能会临时变更,暂停、限制或者终止xxx部分或全部服务,xxx将努力但不保证能做到事先通知。用户知悉并愿意承担该类风险。
6、用户充分理解并同意:xxx提供的服务中可能包括广告。用户同意在使用服务过程中显示xxx和第三方供应商、合作伙伴提供的广告。同时,xxx有权在小视频内添加网站logo(或名称)和时间的水印标志。xxx将尽力但不保证不影响您的观看体验。
7、用户充分理解并同意:xxx提供的小视频平台为免费的分享平台,xxx打赏皆为自愿行为,用户上传所有的视频,均为互联网共享用途,如涉及隐私问题和版权问题,由上传者本人承担。
8、用户所产生内容,包含小视频,与苹果公司无关。
9、根据合理判断,xxx可以对违反法律法规、本《协议》约定,侵犯、妨害、威胁他人权利的内容,或者假冒他人名义发布的内容,依法采取停止传输、下线等措施,并有权依合理判断对违反本条款的用户采取适当的法律行动,包括但不限于:从xxx服务平台中保全具有违法性、侵权性、不当性等内容、限制或禁止用户使用xxx全部或部分服务、注销用户帐户以及依据法律法规保存有关信息并向有关部门报告等。
xxx:app名称,我的是小视频平台

小结:基本上能做到以上的措施,这个问题就能解决

—————————————————————————————————————————–

 

Guideline 1.1 – Safety – Objectionable Content

Your app includes content that many users would find objectionable and offensive. Specifically, your app objectified women.

Next Steps

To resolve this issue, please remove all potentially objectionable content from your app and submit your revised binary for review.

For app design information, check out the following videos: and “Designing Intuitive User Experiences,” available on the Apple Developer website.

You may also want to review the iOS Human Interface Guidelines for more information on how to create a great user experience in your app.
被拒原因:苹果说你的app的内容包含物化女性的东西,其实我的app里上传的小视频多数是女性拍的视频,不含很露的东西,都是正常视频,像抖音那样的,但因为包含了小视频打赏,审核人员认为物化女性了。

解决方案:若宣传截图全是女性的头像或照片,增加男性头像或照片;有女性内容的地方,增加男性的内容,如我的小视频列表,增加男生拍的小视频;若还是不行,则审核期间可以全部是男生的内容,审核过后换回来。

小结:付费的地方,如果女性的内容很多,则物化女性被拒的可能性很高,所以要搞下男女平衡。

 

—————————————————————————————————————————–

 

Guideline 2.3.3 – Performance – Accurate Metadata

We noticed that your screenshots do not sufficiently reflect your app in use.

Specifically, your 5.8-inch iPhone X screenshots do not display the app in the correct device frame.

Next Steps

To resolve this issue, please revise your screenshots to ensure that they accurately reflect the app in use on the supported devices. For iPhone, you need a set of 5.5-inch display screenshots and for iPad, you need a set for 12.9-inch display. This set will be scaled appropriately down to other device sizes when viewed on the App Store in each territory.

Note that 5.8-inch display assets for iPhone X are optional and don’t scale down to other devices sizes. Screenshots that include iPhone X layout features like rounded corners or sensor housing should only be used for the 5.8-inch display.
被拒原因:我的宣传图,做5.8尺寸是按钮5.5做的,没有刘海和底部的东西,它认为不符合iphonex的设计

解决方案:5.8尺寸的宣传图是可选的,所以我去掉了5.8尺寸,然后就可以了;也可以做5.8尺寸的图,但要按苹果的规范来做

小结:这个是小问题了,注意下就是了。

 

—————————————————————————————————————————–

 

Guideline 5.1.1 – Legal – Privacy – Data Collection and Storage

We noticed that your app requests the user’s consent to access their microphone but does not clarify the use of this feature in the permission modal alert.

Next Steps

To resolve this issue, please revise the permission modal alert to specify why the app is requesting access to the user’s microphone.

The permission request alert should specify how your app will use this feature to help users understand why your app is requesting access to their personal data.
被拒原因:使用了麦克风,但未写明使用的原因,很多要权限的可能遇到这问题,如定位,拍照,相机,通讯录

解决方案:在info.plist里的Privacy – Microphone Usage Description改为:亲,我们需要访问您的麦克风,用于使用语音功能

其他的可以这样:

Privacy – Camera Usage Description :亲,我们需要访问您的相机,用于使用图片功能和视频功能

Privacy – Photo Library Usage Description:亲,我们需要您的同意,来访问相册进行上传和发送照片

Privacy – Location Always Usage Description:亲,我们需要您的位置信息,来展示xxxx

写明需要使用它的理由就可以了

小结:写明使用该功能的原因就可以了

 

—————————————————————————————————————————–

 

Guideline 1.1 – Safety – Objectionable Content

Your app includes content that many users would find objectionable and offensive.

Next Steps

To resolve this issue, please remove all potentially objectionable content from your app and submit your revised binary for review.

For app design information, check out the following videos: and “Designing Intuitive User Experiences,” available on the Apple Developer website.

You may also want to review the iOS Human Interface Guidelines for more information on how to create a great user experience in your app.

Guideline 5.0 – Legal

Your app contains content – or facilitates, enables, and encourages an activity – that is not legal in all of the locations where the app is available.

Next Steps

To resolve this issue, please remove all content and features that are illegal in the locations where your app is available. Please note that app concepts that are considered illegal are not allowed on the App Store.

Please see attached screenshot for details.

Since your iTunes Connect status is Rejected, a new binary will be required. Make the desired metadata changes when you upload the new binary
被拒原因:应用程序必须遵守上线地区的法律法规,禁止含有赌博、色情、有偿陪伴等违反法律的内容,尤其为用户提供付费社交服务的APP,例如在线直播类APP,必须严格遵守相关规定。

解决方案:去掉相关内容,我的是因为审核人员认为我的app包含有偿服务,所以我去掉就解决这两个问题了

小结:这个问题其实有点蛋疼的,苹果的理解和我们认为的是不一样的,如果你的社交app含有付费,这个被拒可能性很大;要么去掉相关内容,要么做隐藏,跟苹果解释基本上是无效的。

 

—————————————————————————————————————————–

Guideline 2.1 – Information Needed

This type of app has been identified as one that may violate one or more of the following App Store Review Guidelines. Specifically, these types of apps often:

1.1.6 – Include false information, features, or misleading metadata.
2.3.0 – Undergo significant concept changes after approval
2.3.1 – Have hidden or undocumented features, including hidden “switches” that redirect to a gambling or lottery website
3.1.1 – Use payment mechanisms other than in-app purchase to unlock features or functionality in the app
3.2.1 – Do not come from the financial institution performing the loan services
4.3.0 – Are a duplicate of another app or are conspicuously similar to another app
5.2.1 – Were not submitted by the legal entity that owns and is responsible for offering any services provided by the app
5.2.3 – Facilitate illegal file sharing or include the ability to save, convert, or download media from third party sources without explicit authorization from those sources
5.3.4 – Do not have the necessary licensing and permissions for all the locations where the app is used

Before we can continue with our review, please confirm that this app does not violate any of the above guidelines. You may reply to this message in Resolution Center or the App Review Information section in App Store Connect to verify this app’s compliance.

Given the tendency for apps of this type to violate the aforementioned guidelines, this review will take additional time. If at any time we discover that this app is in violation of these guidelines, the app will be rejected and removed from the App Store, and it may result in the termination of your Apple Developer Program account.

Should you choose to resubmit this app without confirming this app’s compliance, the next submission of this app will still require a longer review time. Additionally, this app will not be eligible for an expedited review until we have received your confirmation.

Since your App Store Connect status is Rejected, a new binary will be required
被拒原因:2018年初开始,在苹果审核中,只要应用中涉及,支付,定位等涉及用户隐私的功能,苹果都可能会机器审核,即人审之后,提交机审,可能会不分青红皂白的打回来,这其实很可能不是APP本身的原因,只是苹果要你自查,但是如果你的app确实含有这些问题,如隐藏功能,第三方支付等问题,你回复或申诉后,苹果再审,如果查出真有问题,那你的开发者账号就可能会被封。

解决方案:自己的app确实没这问题的,回复或申诉怼苹果;换开发者账号再试;内容更换为其他不太可能机审的内容再提交审核,审核过了换回来;

小结:机审可能是查你引用的包是否有第三方支付的包,如查支付宝,查引用的包有无alipay字样;这个2.1大*包是很蛋疼的,很多人都遇到了,不怕开发者账号被封的,就怼苹果。我就是回复苹果,然后过一段时间,状态变成在审,一天后审核通过。

回复或申诉内容模板:

尊敬的苹果审核团队:

感谢您的耐心审核, 对于您提到的7个审核条款, 我们开发团队经过认真自查和研究, 我们现在对此回复如下:

1.1.6:我们并没有包含虚假信息,和误导用户的功能,全都是真实的。

2.3.0:我们没有在通过后修改任何概念和功能。

2.3.1:我们没有切换到任何赌博或彩票的网站,我们是原生App

3.1.1:我们游戏内都是使用的苹果支付,并没有使用任何第三方支付。

4.3.0:我们的游戏内容都是我们自己开发的, 并不存在抄袭或者大量相似。

5.2.1:我们的App并没有法人实体和版权的风险。

5.3.4:我们的App也并没有使用任何定位相关功能和权限。
仅供参考。

 

—————————————————————————————————————————–

 

Hello,

Upon re-evaluation, we found that your app is not in compliance with the App Store Review Guidelines. Specifically, we found that app facilitates, enables, or encourages live video chat or performance (网络直播/表演/秀场), but the Internet Culture Business License (网络文化经营许可证) you have provided is not sufficient.

Next Steps

To resolve this issue, please complete the following:

— Provide both a copy and the direct link to the government website that displays your Internet Culture Business License (网络文化经营许可证).
— List Internet Show (网络表演/秀场) in the allowed business areas (经营范围) section of the Internet Culture Business License (网络文化经营许可证).
— Ensure the seller and artist names associated with your account match the authorized name (单位名称) listed in the Internet Culture Business License (网络文化经营许可证).

If you have any questions about this information, please reply to this message to let us know.

Best regards,

App Store Review
被拒原因:现在直播类的app需要网络文化许可经营证了,没有就不给过

解决方案:提供网络文化许可经营证照片,提交在附件里,若你是个人开发者账号,提供了许可证还不行,还得提供该公司委托你开发的证明,盖公司印章,我就是这样搞的,附件只能传一张图,我把许可证和委托证明ps在一起了,提交后,在审核备注里说明该公司委托你开发,附件含有什么什么

小结:提交了证件,基本上都能过审,要是你木有,那你只能做隐藏处理了。

 

—————————————————————————————————————————–

 

遇到被拒不要慌,总有解决方案。

 

友情链接: SITEMAP | 旋风加速器官网 | 旋风软件中心 | textarea | 黑洞加速器 | jiaohess | 老王加速器 | 烧饼哥加速器 | 小蓝鸟 | tiktok加速器 | 旋风加速度器 | 旋风加速 | quickq加速器 | 飞驰加速器 | 飞鸟加速器 | 狗急加速器 | hammer加速器 | trafficace | 原子加速器 | 葫芦加速器 | 麦旋风 | 油管加速器 | anycastly | INS加速器 | INS加速器免费版 | 免费vqn加速外网 | 旋风加速器 | 快橙加速器 | 啊哈加速器 | 迷雾通 | 优途加速器 | 海外播 | 坚果加速器 | 海外vqn加速 | 蘑菇加速器 | 毛豆加速器 | 接码平台 | 接码S | 西柚加速器 | 快柠檬加速器 | 黑洞加速 | falemon | 快橙加速器 | anycast加速器 | ibaidu | moneytreeblog | 坚果加速器 | 派币加速器 | 飞鸟加速器 | 毛豆APP | PIKPAK | 安卓vqn免费 | 一元机场加速器 | 一元机场 | 老王加速器 | 黑洞加速器 | 白石山 | 小牛加速器 | 黑洞加速 | 迷雾通官网 | 迷雾通 | 迷雾通加速器 | 十大免费加速神器 | 猎豹加速器 | 蚂蚁加速器 | 坚果加速器 | 黑洞加速 | 银河加速器 | 猎豹加速器 | 海鸥加速器 | 芒果加速器 | 小牛加速器 | 极光加速器 | 黑洞加速 | movabletype中文网 | 猎豹加速器官网 | 烧饼哥加速器官网 | 旋风加速器度器 | 哔咔漫画 | PicACG | 雷霆加速