我正在开发一个iOS应用程序,它调用web服务进行登录,然后我将登录凭据与供应商标识符(identifierForVendor)一起发送到Web服务器,以便为这些凭证唯一地标识设备.因此用户只能拥有一个设备和一个凭证.
我有了identifierForVendor
NSString *uuid = [[UIDevice currentDevice] identifierForVendor].UUIDString
Run Code Online (Sandbox Code Playgroud)
然后该标识符将存储在Web服务器的数据库中以及设备数据库中.当用户打开应用程序并尝试从Web服务器下载数据时,用户设备上的本地identifierForVendor将与存储在Web服务器上的标识符进行比较.
用户卸载应用程序并重新安装时出现问题,我发现identifierForVendor已更改.因此用户无法继续前进.
我阅读了苹果文档UIDevice Documentation
如前所述,如果来自同一供应商的所有应用程序都从设备卸载,则在从该供应商新安装任何应用程序时将采用新的identifierForVendor.
那么在我的案例中如何处理这个问题呢?
我在我的应用程序中有故事板,但我不想Main storyboard file base name在info.plist中设置,以及我不想设置入口点,即Is Initial View Controller在任何viewcontroller场景的storyboard中.
虽然我想用故事板中的一些场景启动应用程序,但所有人都向我显示黑屏.
当我尝试
let testob:testClass = testClass()
self.window?.rootViewController = testob
Run Code Online (Sandbox Code Playgroud)
在AppDelegate中,它没有工作,并获得相同的黑屏.
但是当我Main storyboard file base name在info.plist中设置,并且Is Initial View Controller在故事板中的入口点时,每件事都有效.
有没有解决办法?
我将以下代码与 Firebase SDK 8 一起使用。
const db = firebase.firestore();
const collectionRef = db.collection(collectionName);
var query = collectionRef.where('isFinal', '==', true);
query = query.where(firebase.firestore.FieldPath.documentId(), 'in', docIds);
return query;
Run Code Online (Sandbox Code Playgroud)
我想用模块化 SDK 替换它的代码。所以我写了,
const dbInstance = getFirestore(firebaseApp);
const collectionRef = collection(dbInstance, collectionName);
query(collectionRef, where(???, 'in', docIds));
return query;
Run Code Online (Sandbox Code Playgroud)
但不知何故,我找不到获取 FieldPath 的语法。从参考文献中,我可以读到,
/**
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
* It can be used in queries to sort or filter by the document ID.
*/
export declare …Run Code Online (Sandbox Code Playgroud) ios ×2
firebase ×1
identifier ×1
iphone ×1
javascript ×1
storyboard ×1
swift ×1
uuid ×1
web ×1